# Python Radioplayer Dataclasses
Classes for generating [radioplayer](https://radioplayer.co.uk) compatible data. Generated using [xsdata](https://xsdata.readthedocs.io/).
## Installation
```bash
pip install radioplayer-dataclasses
```
## Usage
The `radioplayer.dataclasses` module may be used to build radioplayer compatible structures.
Serializing is done using the `xsdata` library.
```python
>>> from radioplayer.dataclasses import *
>>> epg = Epg(lang="en")
>>> epg
Epg(programme_groups=[], schedule=[], alternate_source=[], lang='en', system=<SystemType.DAB: 'DAB'>)
>>> from xsdata.formats.dataclass.serializers import XmlSerializer
>>> from xsdata.formats.dataclass.serializers.config import SerializerConfig
>>>
>>> config = SerializerConfig(
... pretty_print=True,
... xml_declaration=False,
... )
>>> serializer = XmlSerializer(config=config)
>>> xml = serializer.render(epg, ns_map={None: Epg.Meta.namespace})
>>> print(xml.strip())
<epg xmlns="http://www.radioplayer.co.uk/schemas/11/epgSchedule" xml:lang="en" system="DAB"/>
```
Additional examples are available in the `tests/` directory.
## Development
### Getting Started
```bash
# setup a dev env
python -mvenv env
. env/bin/activate
# install a modern poetry version
python -mpip install 'poetry>=1.2.0'
# install deps and dev version
poetry install
```
### Loading XSD files
```bash
mkdir schemas
pushd schemas/
curl -L -O http://www.w3.org/2001/xml.xsd
curl -L -O https://radioplayer.co.uk/schemas/11/epgSchedule_11.xsd
curl -L -O https://radioplayer.co.uk/schemas/11/epgDataTypes_11.xsd
curl -L -O https://radioplayer.co.uk/schemas/11/rpDataTypes_11.xsd
curl -L -O https://radioplayer.co.uk/schemas/11/epgSI_11.xsd
popd
```
Some touchups where made to the files to make them validate where necessary.
### Generating dataclasses
```bash
poetry run xsdata -c .xsdata.xml schemas/
```
### Running tests
```bash
poetry run pytest
```
## Release Management
The CI/CD setup uses semantic commit messages following the [conventional commits standard](https://www.conventionalcommits.org/en/v1.0.0/).
There is a GitHub Action in [.github/workflows/semantic-release.yaml](./.github/workflows/semantic-release.yaml)
that uses [go-semantic-commit](https://go-semantic-release.xyz/) to create new
releases.
The commit message should be structured as follows:
```
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
```
The commit contains the following structural elements, to communicate intent to the consumers of your library:
1. **fix:** a commit of the type `fix` patches gets released with a PATCH version bump
1. **feat:** a commit of the type `feat` gets released as a MINOR version bump
1. **BREAKING CHANGE:** a commit that has a footer `BREAKING CHANGE:` gets released as a MAJOR version bump
1. types other than `fix:` and `feat:` are allowed and don't trigger a release
If a commit does not contain a conventional commit style message you can fix
it during the squash and merge operation on the PR.
Once a commit has landed on the `main` branch a release will be created and automatically published to [pypi](https://pypi.org/)
using the GitHub Action in [.github/workflows/release.yaml](./.github/workflows/release.yaml) which uses [poetry](https://python-poetry.org/)
to publish the package to pypi.
## License
This application is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License as published by the Free
Software Foundation, version 3 of the License.
## Copyright
Copyright (c) 2022 [Radio Bern RaBe](http://www.rabe.ch)
Raw data
{
"_id": null,
"home_page": "https://github.com/radiorabe/python-radioplayer-dataclasses",
"name": "radioplayer-dataclasses",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": null,
"author": "RaBe IT-Reaktion",
"author_email": "it@rabe.ch",
"download_url": "https://files.pythonhosted.org/packages/95/55/f7137a15bf57c9efcff81a73b8da92a3d39bc94751ae81554c62e9429d7a/radioplayer_dataclasses-0.6.0.tar.gz",
"platform": null,
"description": "# Python Radioplayer Dataclasses\n\nClasses for generating [radioplayer](https://radioplayer.co.uk) compatible data. Generated using [xsdata](https://xsdata.readthedocs.io/).\n\n## Installation\n\n```bash\npip install radioplayer-dataclasses\n```\n\n## Usage\n\nThe `radioplayer.dataclasses` module may be used to build radioplayer compatible structures.\nSerializing is done using the `xsdata` library.\n\n```python\n>>> from radioplayer.dataclasses import *\n>>> epg = Epg(lang=\"en\")\n>>> epg\nEpg(programme_groups=[], schedule=[], alternate_source=[], lang='en', system=<SystemType.DAB: 'DAB'>)\n\n>>> from xsdata.formats.dataclass.serializers import XmlSerializer\n>>> from xsdata.formats.dataclass.serializers.config import SerializerConfig\n>>>\n>>> config = SerializerConfig(\n... pretty_print=True,\n... xml_declaration=False,\n... )\n>>> serializer = XmlSerializer(config=config)\n>>> xml = serializer.render(epg, ns_map={None: Epg.Meta.namespace})\n>>> print(xml.strip())\n<epg xmlns=\"http://www.radioplayer.co.uk/schemas/11/epgSchedule\" xml:lang=\"en\" system=\"DAB\"/>\n\n```\n\nAdditional examples are available in the `tests/` directory.\n\n## Development\n\n### Getting Started\n\n```bash\n# setup a dev env\npython -mvenv env\n. env/bin/activate\n\n# install a modern poetry version\npython -mpip install 'poetry>=1.2.0'\n\n# install deps and dev version\npoetry install\n```\n\n### Loading XSD files\n\n```bash\nmkdir schemas\npushd schemas/\ncurl -L -O http://www.w3.org/2001/xml.xsd\ncurl -L -O https://radioplayer.co.uk/schemas/11/epgSchedule_11.xsd\ncurl -L -O https://radioplayer.co.uk/schemas/11/epgDataTypes_11.xsd\ncurl -L -O https://radioplayer.co.uk/schemas/11/rpDataTypes_11.xsd\ncurl -L -O https://radioplayer.co.uk/schemas/11/epgSI_11.xsd\npopd\n```\n\nSome touchups where made to the files to make them validate where necessary.\n\n### Generating dataclasses\n\n```bash\npoetry run xsdata -c .xsdata.xml schemas/\n```\n\n### Running tests\n\n```bash\npoetry run pytest\n```\n\n## Release Management\n\nThe CI/CD setup uses semantic commit messages following the [conventional commits standard](https://www.conventionalcommits.org/en/v1.0.0/).\nThere is a GitHub Action in [.github/workflows/semantic-release.yaml](./.github/workflows/semantic-release.yaml)\nthat uses [go-semantic-commit](https://go-semantic-release.xyz/) to create new\nreleases.\n\nThe commit message should be structured as follows:\n\n```\n<type>[optional scope]: <description>\n\n[optional body]\n\n[optional footer(s)]\n```\n\nThe commit contains the following structural elements, to communicate intent to the consumers of your library:\n\n1. **fix:** a commit of the type `fix` patches gets released with a PATCH version bump\n1. **feat:** a commit of the type `feat` gets released as a MINOR version bump\n1. **BREAKING CHANGE:** a commit that has a footer `BREAKING CHANGE:` gets released as a MAJOR version bump\n1. types other than `fix:` and `feat:` are allowed and don't trigger a release\n\nIf a commit does not contain a conventional commit style message you can fix\nit during the squash and merge operation on the PR.\n\nOnce a commit has landed on the `main` branch a release will be created and automatically published to [pypi](https://pypi.org/)\nusing the GitHub Action in [.github/workflows/release.yaml](./.github/workflows/release.yaml) which uses [poetry](https://python-poetry.org/)\nto publish the package to pypi.\n\n## License\n\nThis application is free software: you can redistribute it and/or modify it under\nthe terms of the GNU Affero General Public License as published by the Free\nSoftware Foundation, version 3 of the License.\n\n## Copyright\n\nCopyright (c) 2022 [Radio Bern RaBe](http://www.rabe.ch)\n",
"bugtrack_url": null,
"license": "AGPL-3",
"summary": "Python dataclasses for radioplayer generated from XSD",
"version": "0.6.0",
"project_urls": {
"Homepage": "https://github.com/radiorabe/python-radioplayer-dataclasses",
"Repository": "https://github.com/radiorabe/python-radioplayer-dataclasses"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5a5ac04c2361bbad6dd6768da8e02dbd554f58a582eb54c22be531fe77b00d73",
"md5": "86352a9cbfe7c47e7b13d33e5c918bec",
"sha256": "78075a91f8b385f53c2493ea5af99628d5aa208a7d2927f4c34dc1fe0c0cb21c"
},
"downloads": -1,
"filename": "radioplayer_dataclasses-0.6.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "86352a9cbfe7c47e7b13d33e5c918bec",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 20560,
"upload_time": "2024-05-08T05:28:03",
"upload_time_iso_8601": "2024-05-08T05:28:03.098402Z",
"url": "https://files.pythonhosted.org/packages/5a/5a/c04c2361bbad6dd6768da8e02dbd554f58a582eb54c22be531fe77b00d73/radioplayer_dataclasses-0.6.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9555f7137a15bf57c9efcff81a73b8da92a3d39bc94751ae81554c62e9429d7a",
"md5": "a01e5da4cb752caae74f559493cad486",
"sha256": "edca5c00a6bd1e9c3f5a28c2e4bfa59dd51981eacac5020b7cc2177ff5231223"
},
"downloads": -1,
"filename": "radioplayer_dataclasses-0.6.0.tar.gz",
"has_sig": false,
"md5_digest": "a01e5da4cb752caae74f559493cad486",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 21422,
"upload_time": "2024-05-08T05:28:05",
"upload_time_iso_8601": "2024-05-08T05:28:05.994848Z",
"url": "https://files.pythonhosted.org/packages/95/55/f7137a15bf57c9efcff81a73b8da92a3d39bc94751ae81554c62e9429d7a/radioplayer_dataclasses-0.6.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-08 05:28:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "radiorabe",
"github_project": "python-radioplayer-dataclasses",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "radioplayer-dataclasses"
}