Gentoo Python Guide¶
- Author:
Michał Górny
- License:
- Preface
- Python interpreters
- Choosing between Python eclasses
- Common basics
- python-any-r1 — build-time dependency
- python-single-r1 — single-impl packages
- python-r1 — multi-impl packages
- distutils-r1 — standard Python build systems
- The PEP 517 and legacy modes
- Basic use (PEP 517 mode)
- Source archives
- Dependencies
- python-single-r1 variant
- PEP 517 build systems
- setuptools_scm (flit_scm, hatch-vcs, pdm-backend) and snapshots
- Packages installing extensions (C, Rust…)
- Packages using Cython
- Parallel build race conditions
- Sub-phase functions
- Passing arguments to setup.py
- Calling custom setup.py commands
- Enabling tests
- Building documentation via Sphinx
- Packages with optional Python build system usage
- Packages with Rust extensions (using Cargo)
- Installing packages without a PEP 517 build backend
- Tests in Python packages
- Why is running tests important?
- Using distutils_enable_tests
- Choosing the correct test runner
- Import-checking packages with no working tests
- Undesirable test dependencies
- Missing test files in PyPI packages
- ImportErrors for C extensions
- Checklist for dealing with test failures
- Skipping problematic tests
- Tests requiring Internet access
- Tests aborting (due to assertions)
- Installing extra dependencies in test environment (PEP 517 mode)
- distutils-r1 legacy concepts
- pypi — helper eclass for PyPI archives
- Common helper functions
- Advanced dependencies
- pytest recipes
- Skipping tests based on markers
- Skipping tests based on paths/names
- Avoiding the dependency on pytest-runner
- Disabling plugin autoloading
- Using pytest-xdist to run tests in parallel
- Dealing with flaky tests
- Using pytest-timeout to prevent deadlocks (hangs)
- Avoiding dependencies on other pytest plugins
- TypeError: _make_test_flaky() got an unexpected keyword argument ‘reruns’
- ImportPathMismatchError
- Failures due to missing files in temporary directories
- fixture ‘…’ not found
- Warnings and
pytest.raises()
- Advanced concepts
- Expert python-r1 usage
- Integration with build systems written in Python
- Porting tips
- Migration guides
- QA checks and warnings
- Python package maintenance
- Package name policy
- Support for Python 2
- Which implementations to test new packages for?
- Adding new Python implementations to existing packages
- Which packages can be (co-)maintained by the Python project?
- Porting packages to a new EAPI
- Monitoring new package versions
- Stabilization recommendations
- Routine checks on installed Python packages
- Maintenance of Python implementations