See Documentation for details.
- Poetry (virtual environment and publish to PyPi, all with one tool)
- black (linting/formatter)
- autoflake (removing unused packages)
- isort (dependency organization)
- mypy (static type checking)
- pytest (including test coverage)
- pre-commit (hooks on commit)
- GitHub Actions for CI/CD
- mkdocs for documentation (with material theme)
Install the latest release:
pip install py-optional
Or you can clone py-optional
and get started locally
# ensure you have Poetry installed
pip install --user poetry
# install all dependencies (including dev)
poetry install
# develop!
import py-optional
# do stuff
Only Python 3.8+ is supported as required by the black, pydantic packages
Note that it is recommended to use API tokens when uploading packages to PyPI.
Once you have created a new token, you can tell Poetry to use it:
https://python-poetry.org/docs/repositories/#configuring-credentials
We do this using GitHub Actions' Workflows and Repository Secrets!
Go to your repo settings and add a PYPI_TOKEN
environment variable:
name: Publish
on:
release:
types:
- created
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
...
...
...
- name: Publish
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
bash scripts/publish.sh
That's it!
When you make a release on GitHub, the publish workflow will run and deploy to PyPi! ๐๐๐
Welcome! ๐๐
Please see the Contributing Guide.