This ticket prepares the modularization of sagelib into separate distributions (pip-installable packages) by adding support for native namespace packages (PEP 420) to sagelib's build system.
Ordinary packages (directories of modules) can be turned into namespace packages by removing the empty __init__.py file.
Then several distribution package can share the same namespace.
Because our source discovery mechanism in sagelib's build system (setup.py + sage_setup) distinguishes package directories from other directories containing data files by the presence of the __init__.py file, the present ticket makes several adjustments to the build system - in particular to the functions find_python_sources and find_extra_files.
Per convention in the Sage library, namespace packages are recognized by the presence of all.py or all__*.py files (#33033).
In this ticket, we apply it to turn sagemath-objects and sagemath-categories (from #29865) into namespace packages,
in which __init__.py are removed from the MANIFEST.in files.
Because the actual files are not removed from the source tree, the normal build of the Sage distribution is not affected.
To test these two distributions:
./bootstrap && ./sage -sh -c '(cd pkgs/sagemath-objects && SAGE_NUM_THREADS=16 tox -r -v -v -v -e py39)'
./bootstrap && ./sage -sh -c '(cd pkgs/sagemath-categories && SAGE_NUM_THREADS=16 tox -r -v -v -v -e py39)'
Follow-up tickets:
See also:
Depends on #33803
CC: @isuruf @embray @jdemeyer @dimpase @dcoudert @videlec @vbraun @tobiasdiez @kiwifb
Component: build
Keywords: sd111
Author: Matthias Koeppe
Branch/Commit: f9df1ae
Reviewer: Kwankyu Lee, Dima Pasechnik
Issue created by migration from https://trac.sagemath.org/ticket/28925
This ticket prepares the modularization of sagelib into separate distributions (pip-installable packages) by adding support for native namespace packages (PEP 420) to sagelib's build system.
Ordinary packages (directories of modules) can be turned into namespace packages by removing the empty
__init__.pyfile.Then several distribution package can share the same namespace.
Because our source discovery mechanism in sagelib's build system (
setup.py+sage_setup) distinguishes package directories from other directories containing data files by the presence of the__init__.pyfile, the present ticket makes several adjustments to the build system - in particular to the functionsfind_python_sourcesandfind_extra_files.Per convention in the Sage library, namespace packages are recognized by the presence of
all.pyorall__*.pyfiles (#33033).In this ticket, we apply it to turn sagemath-objects and sagemath-categories (from #29865) into namespace packages,
in which
__init__.pyare removed from theMANIFEST.infiles.Because the actual files are not removed from the source tree, the normal build of the Sage distribution is not affected.
To test these two distributions:
Follow-up tickets:
__init__.pyfiles for packages designated to be namespace packagessage_setup: distributiondirectives,namespaceandnonamespacefiles indicate an inconsistent structure such as when it was forgotten to remove__init__.py.See also:
src/setup.py: Disentangle cleaning of stale installed files in build directory and in install directoryDepends on #33803
CC: @isuruf @embray @jdemeyer @dimpase @dcoudert @videlec @vbraun @tobiasdiez @kiwifb
Component: build
Keywords: sd111
Author: Matthias Koeppe
Branch/Commit:
f9df1aeReviewer: Kwankyu Lee, Dima Pasechnik
Issue created by migration from https://trac.sagemath.org/ticket/28925