Test the next Python¶
To evolve and remain relevant, incompatible changes must happen in Python. The problem is how to migrate existing code to the “next” Python with these incompatible changes.
Deprecation warnings¶
DeprecationWarning and PendingDeprecationWarning warnings are hidden by
default, to not bother users. Developers can use -Wd
(-Wdefault
)
command line option on Python which displays these warnings.
What’s New in Python 3.9: You should check for DeprecationWarning in your code section.
Top 5000 PyPI packages¶
Download sdist and code search¶
- download_pypi_top.py
- search_pypi_top.py:
- Run the search in parallel on all CPUs
- Ignore C files generated by Cython
- Ignore file extensions (programs, archives, HTML, etc.)
JSON¶
You can download a list of top 5000 PyPI packages in JSON format from hugovk site.
INADA-san’s script to download sdist packages from the JSON file: download_sdist.py.
Note that this script doesn’t download packages without sdist (e.g. only universal wheel). It is because INADA-san has searched Python/C API. The pain of the removal can be reduced by fixing most of top 4000 packages.
HPy project¶
top4000-pypi-packages: Dump of Python/C API usage in the top 4000 Python packages. Created in June 2021.
You can use GitHub search in this repository to search for a code pattern.
Searching deprecated API usage¶
Sourcegraph¶
GitHub code search is not powerful enough and there is a lot of noise. (e.g. many people copy CPython source code). On the other hand, Sourcegraph only searches from major repositories, and has powerful filtering. Example: search PyEval_ReleaseLock.
Fedora COPR¶
Test Rawhide (future Fedora 33) with Python 3.9 as the “system Python”: https://copr.fedorainfracloud.org/coprs/g/python/python3.9/
pythonci project¶
Docker images¶
Barry Warsaw maintains CI Images for Python. Example: .gitlab-ci.yml of flufl.lock.