Publishing to either test or production PyPI requires an account setup in the appropriate environment. For test, register here. For prod, register here. For ease-of-use, you can create a file, $HOME/.pypirc
, that will automatically apply the credentials when publishing. You just need to generate an API token on the appropriate PyPI domain and format your .pypirc
file as follows:
[pypi]
username = __token__
password = <the token value, including the 'pypi-' prefix>
[testpypi]
username = __token__
password = <the token value, including the 'pypi-' prefix>
- Install the needed dependencies for packaging and publishing distribution archives:
pip install elinkapi[development]
- Make your desired changes within the project
- Update the version number within the
pyproject.toml
file - Execute
python3 -m build
: this will generate 2 distribution archives that will be uploaded to pypi - Execute
twine upload --repository testpypi dist/*
: this will publish your packages to the test pypi index
- Install the package, but don't grab the dependencies (pip will attempt to grab everything from the test server, which we do not want):
pip install --index-url https://test.pypi.org/simple/ --no-deps elinkapi
- Now install the other dependencies:
pip install elinkapi
- Or install them separately:
pip install requests pydantic urllib3==1.26.6
from elinkapi import Elink
allows instantiation of an API instance to use:
from elinkapi import Elink
api = Eink(token='your-token')
- The pydantic classes can be fetched using
from elinkapi import Record, Organization
- Exceptions thrown may be accessed using
from elinkapi import exceptions
then reference each asexcept exceptions.BadRequestException as e:
- Install the needed dependencies for packaging and publishing distribution archives
pip install elinkapi[development]
- Make your desired changes within the project
- Update the version number within the
pyproject.toml
file - Execute
python3 -m build
: this will generate 2 distribution archives that will be uploaded to pypi - Execute
twine upload dist/*
: this will publish your packages to the test pypi index
- Install the package:
pip install elinkapi
from elinkapi import Elink
allows instantiation of an API instance to use:
from elinkapi import Elink
api = Elink(token='your-token')
- The pydantic classes can be fetched using
from elinkapi import Record, Organization
- Exceptions thrown may be accessed using
from elinkapi import exceptions
then reference each asexcept exceptions.BadRequestException as e: