There are commit hooks for Black and Flake8.
The commit hooks are handled using pre-commit.
To install the hooks for this project run:
pre-commit install
To test the hooks run:
pre-commit run --all-files
This command can also be used to run the hooks manually.
- Generate Python bindings for the schema using FlatBuffers'
flatc
executable - Add the generated bindings to the project
- Add unit-tests (see existing tests for an example)
- Update
fbschemas.__init__.py
to include the new serialiser and deserialiser - Check whether the serialised data produced by the new code can be verified in C++
- There is a helper program in the FlatBufferVerification repository
- Don't worry if it fails verification - it seems to be an inherent FlatBuffers issue
Tox allows the unit tests to be run against multiple versions of Python. See the tox.ini file for which versions are supported. From the top directory:
tox
First, uninstall any existing versions of the Python streaming data types package:
pip uninstall ess-streaming-data-types
Then, from the python-streaming-data-types root directory, run the following command:
pip install --user -e ./
- A PyPi account
- A TestPyPi account (this is separate to the PyPi account)
- Permission to push to the ess-streaming-data-types project on TestPyPi and PyPi
- Installed all requirements in
requirements-dev.txt
First update the version number in streaming_data_types/init.py and push the update to the repository.
Uninstall streaming_data_types if you have previously installed it from PyPi:
pip uninstall ess_streaming_data_types
Delete any old builds you may have (IMPORTANT!):
rm -rf build dist
Build it locally:
python setup.py sdist bdist_wheel
Check dist files:
twine check dist/*
Push to test.pypi.org for testing:
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
The new module can then be installed from test.pypi.org like so:
pip uninstall ess-streaming-data-types # Remove old version if present
pip install -i https://test.pypi.org/simple/ ess-streaming-data-types
Unfortunately, flatbuffers is not on test.pypi.org so the following error may occur:
ERROR: Could not find a version that satisfies the requirement flatbuffers
The workaround is to install flatbuffers manually first using pip install flatbuffers
and then rerun the previous command.
Test the module using the existing test-suite (from project root):
rm -rf streaming_data_types # Rename the local source directory
pytest # The tests will be run against the pip installed module
git reset --hard origin/main # Put everything back to before
After testing installing from test.pypi.org works, push to PyPI:
twine upload dist/*
Finally, create a tag on the GitHub repository with the appropriate name, e.g. v0.7.0
.