Python Radioplayer Dataclasses
Classes for generating radioplayer compatible data. Generated using xsdata.
Installation
pip install radioplayer-dataclasses
Usage
The radioplayer.dataclasses module may be used to build radioplayer compatible structures.
Serializing is done using the xsdata library.
>>> 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
# 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
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
poetry run xsdata -c .xsdata.xml schemas/
Running tests
poetry run pytest
Release Management
The CI/CD setup uses semantic commit messages following the conventional commits standard. There is a GitHub Action in .github/workflows/semantic-release.yaml that uses go-semantic-commit 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:
- fix: a commit of the type
fixpatches gets released with a PATCH version bump - feat: a commit of the type
featgets released as a MINOR version bump - BREAKING CHANGE: a commit that has a footer
BREAKING CHANGE:gets released as a MAJOR version bump - types other than
fix:andfeat: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
using the GitHub Action in .github/workflows/release.yaml which uses poetry
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
Release files for radioplayer-dataclasses 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| radioplayer_dataclasses-0.6.0.tar.gz | 21.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| radioplayer_dataclasses-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size:42.0 kB
Release files / radioplayer_dataclasses-0.6.0.tar.gz
| Download URL | radioplayer_dataclasses-0.6.0.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
edca5c00a6bd1e9c3f5a28c2e4bfa59dd51981eacac5020b7cc2177ff5231223
|
|
BLAKE2b-256 checksum How to use checksums |
9555f7137a15bf57c9efcff81a73b8da92a3d39bc94751ae81554c62e9429d7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-1018-azure
|
Release files / radioplayer_dataclasses-0.6.0-py3-none-any.whl
| Download URL | radioplayer_dataclasses-0.6.0-py3-none-any.whl |
|---|---|
| Size | 20.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78075a91f8b385f53c2493ea5af99628d5aa208a7d2927f4c34dc1fe0c0cb21c
|
|
BLAKE2b-256 checksum How to use checksums |
5a5ac04c2361bbad6dd6768da8e02dbd554f58a582eb54c22be531fe77b00d73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-1018-azure
|