Pylint, formatter, pytest, ci, github workflows
ruff check file.py
mypy file.py
In Python 3.9 and later, built-in collection type objects support indexing & annotations. These can be imported from collection.abc
types defined in typing are needed if you need to support Python 3.8 and earlier. dynamically typed functions are those without a function type annotation.
In case we want hook to be disble use the flag '--no-verify'
git commit -m 'test message' --no-verify
for eaxample when we commit directly to main branch and skip the hook with id - id: no-commit-to-branch arg ["--branch=main"]
git commit -m 'added pre-commit workflow' --no-verify
python setup.py build sdist
- Build dependencis are listed in pyproject.toml
- Package dendencies can come from requirements.txt and can be put with install_requires in setup.py.
python -m build --sdist --wheel ./Above command creates source distribution and wheel. - The editable installation works with setup.py that automaticlly handles pyproject.toml and manages the
build dependecies.
pip install -e . - setup.cfg carries all the config for setup.py. check its syntax and documenatation at setuptools
building only with pyproject.toml python -m build --sdist --wheel ./
[tool.setuptools.package-data] mypkg = ["*.json"]
/bin/bash run.sh release:test
additional_dependencies:
- pyproject-flake8
- create a publish.yaml
- read about contexts.
- variables, expression and secrets can be found in the above docs.
-By default, the package installer is looking in TestPyPI for all dependencies, including setuptools, which might not be available on TestPyPI. You can direct pip to use the main PyPI as an additional source for packages that aren't available on TestPyPI by modifying the install command as follows:
pip install --extra-index-url https://pypi.org/simple your-package-nam
for example below code checks push event into main branch
if: github.event_name == 'push' && github.ref == 'refs/head/main'
they add metadata to the dependency tree pipenv piptools poetry