Python
FreeBSD supports multiple, concurrently installable Python versions and environments for Python users and developers to work with. Every Python available in the FreeBSD ports tree can be built for any (and multiple) Python version using the FLAVORS and DEFAULT_VERSIONS framework mechanisms.
Binary packages available from the official FreeBSD Package repositories are built using a DEFAULT_VERSION of Python, which evolves over time.
Our Python Team works closely with upstream, aiming to resolve issues with an upstream-first approach and stays close-to-upstream with respect to documentation, guidance and recommendations.
FreeBSD is officially supported by, and provides multiple FreeBSD continuous integration workers for the Python project to ensure future versions of FreeBSD are supported, and so bugs and regressions are identified and resolved prior to release.
Contents
Contact
#freebsd-python IRC channel (Libera Chat)
Goals
∞ - Ongoing
Update and clean up setuptools
Resolve Open Python Issues
Fullfill the Python Port Wishlist
Improve Python Ports Policy
↻ - In Progress
3.12 as default version: PR 285957
☐ - Open
- ☐ Productivity: Tool to create Python port from a Python (PyPI) sdist (and its setup.py file, etc)
- ☐ Add a stage to Python framework to find and strip shared libraries in a consistent manner
- Right now, either each port does it itself, or not at all (BLANKET)
- Once done, remove blocks from ports that do this themselves
☐ Don't package (plist) or install .pyc and .pyo files. Details: /CompiledPackages
- ☐ Integrate lang/pypy into ports framework (knobs etc)
Mk/Uses/python.mk: add support for PyPy historical patch review
- ☐ Python version agnostic DOCSDIR and EXAMPLESDIR; they currently need to be overridden manually - may conflict with the PYTHON_CONCURRENT_INSTALL efforts
- ☐ create guideline for which ports python@ will accept to maintain. In particular, address 'leaf ports' and 'non-infrastructure'
☑ - Done
☑ Python ports framework complies with all relevant PEP's
☑ PEP-394: The "python" Command on Unix-Like Systems
☑ PEP-449: Removal of the PyPI Mirror Auto Discovery and Naming Scheme - r400105
☑ PEP-3147: PYC Repository Directories (we use different site-packages/ and support concurrent installation (which creates distinct directories)
☑ PEP-517: A build-system independent format for source trees - /PEP-517
Other Interesting Things
PEP-446 -- Make newly created file descriptors non-inheritable (Python 3.4, FreeBSD *_CLOEXEC Support)
Supercedes PEP-433
PEP-427 -- The Wheel Binary Package Format 1.0
Tooling Challenges
The upstream Python packaging team has expressed interest in understanding the challenges faced by OS packagers with Python packaging tools. This information will be used to inform ongoing improvements and developments. Please document your experiences below:
StageDir with setuptools-based (easy_install) modules -- Doesnt support --destdir or equivalent
Steps to switch the Python default version
- A successful exp-run is mandatory
- Set the new default version in
- bsd.ports.default.mk
- PYTHON3_DEFAULT
- Uses/python.mk
- _PYTHON_VERSIONS (retain order of preferred versions)
- _PYTHON_PORTBRANCH
- bsd.ports.default.mk
- Bump the PORTREVISION of following ports
- devel/py-setuptools
- lang/cython
- math/py-numpy
- Add UPDATING instructions
Legend:
pyMM, pythonMM, pythonM.M or MM = Old Python version, e.g. py37, python37, python3.7 or 37 pyNN, pythonNN, pythonN.N or NN = New Python version, e.g. py38, python38, python3.8 or 38
Current instructions are:
The default version of python3 and python was switched to N.N. For ports users wanting to keep version M.M as default, add DEFAULT_VERSIONS+= python=M.M python3=M.M to make.conf Following procedures may ease the upgrade: # sh # for i in $(pkg query -g %n 'pyMM-*'); do pkg set -yn ${i}:pyNN-${i#pyMM-}; done # pkg upgrade For portmaster users: # sh # portmaster -o lang/pythonNN pythonMM # REINSTALL="$(pkg info -qo "*pyMM*")" # pkg delete -f "*pyMM*" # portmaster $REINSTALL # REBUILD=$(pkg query "%n:%dn" | grep py3 | grep -v pyNN | cut -d : -f 1 | sort -u) # portmaster $REBUILD # REBUILD2=$(pkg list | grep python-MM | xargs pkg which | awk '{print $6}' | sort -u) # portmaster $REBUILD2Please note that the instructions from above for portmaster are not perfect for more complex scenarios of installed ports (see TODO below).
TODO for the instructions in UPDATING
Following parts should be added with the next Python switchover:
Refine instructions for Portmaster
With more complex scenarios of installed ports the upgrade might not go smoothly. There have been reported issues if following ports were installed:
- databases/tdb
- devel/gobject-introspection
- devel/meson
- devel/tevent
There are improved instructions that still needs to be tested thoroughly:
Improved UPDATING instructions for Portmaster
Add clean up instructions
The following is a draft based on a suggestion from ThierryThomas (thierry) to improve the user experience.
Final steps (for pre-built packages & portmaster): If no longer required, Python M.M can be removed via "pkg remove pythonMM" and the directory /usr/local/lib/pythonM.M can then be deleted afterwards, if not empty.
Python Team
You! Come and say hi!
BabakFarrokhi (farrokhi@)
CharlieLi (vishwin@)
DaniloBaio (dbaio@)
FukangChen (loader@)
KaiKnoblich (kai@)
LiWenHsu (lwhsu@)
MuhammadMoinurRahman (bofh@)
NicolaVitale (nivit@)
PoChuanHsieh (sunpoet@)
RuslanMakhmatkhanov (rm@)
SofianBrabez (sbz@)
StevenKreuzer (skreuzer@)
WenHeping (wen@)
| /CompiledPackages /PEP-517 /PortsPolicy /PortsWishlist /PyPy /setuptools |