Added pypi package de-autobahn from autogeneration as extra dependency #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Used native namespace package for deutschland. This needed some refactoring of the imports since there is no init.py in the top level anymore (which imported all the subpackages, I think this is a bad idea for a growing package anyways) --> https://packaging.python.org/guides/packaging-namespace-packages/
Also put everything in a src folder and I swtiched from setup.py to pyproject.toml, because otherwise I could not make the namespace work (https://docs.pytest.org/en/latest/explanation/goodpractices.html).
The extra package which is called de-autobahn (since only autobahn was already taken) is here:
https://pypi.org/project/de-autobahn/
So if you install the deutschland package and you want to use the autobahn api you can use:
pip install deutschland[autobahn] which will give you the additional installed package which you can import "from deutschland import autobahn" as if it would be part of the regular package
In poetry this would look like:
poetry add deutschland -E autobahn
which should give an entry in the pyproject.toml like this:
deutschland = {version = "^1.0.4",extras=["autobahn"]}
If we want to switch to having it installed by default, we would just to remove the extra section from pyproject.toml and remove the option=true parameters.
If you want to test it:
python -c "from deutschland.autobahn.apis import DefaultApi;print(DefaultApi().list_autobahnen()['roads'][:4])"
should work as well as
poetry run python -c "from deutschland.verena import Verena"
which means the namespace packaging seems to work.
If you want to isntall the package from local source with autobahn support, you should be able to use:
pip install .[autobahn]