-
-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify find_python_sources to support modularization of sagelib by native namespace packages (PEP 420) #28925
Comments
comment:1
pushing these forward to 9.2 |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Commit: |
New commits:
|
Author: Matthias Koeppe |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Branch pushed to git repo; I updated commit sha1. New commits:
|
This comment has been minimized.
This comment has been minimized.
comment:18
Next steps: adjust the cleaner, find Cython sources |
comment:155
Thanks. Another comment: |
Reviewer: Kwankyu Lee, ... |
comment:157
Thank you for the update. I have been testing (using) this ticket and and the sequel #33011 for a while. They works well. I checked the code as far as I can (not very far), and it looks good to me. If we don't have further comments on this ticket, then it would better be tested by more developers in the wild by merging this now, so that we can fix problems before the next release. I will wait for your (not Matthias) meta comments, and proceed to "positive review" in a couple of days. |
comment:158
Is this
broken? It doesn't work with (and without) this ticket. |
comment:159
Replying to @kwankyu:
works for me (after |
comment:160
Replying to @dimpase:
I did This is the initial part that goes wrong:
Any clue? I am on Mac. |
Changed reviewer from Kwankyu Lee, ... to Kwankyu Lee, Dima Pasechnik |
comment:161
I start from You'll probably want to move So it's positive review from me. |
comment:162
Replying to @dimpase:
Thanks. But it didn't help. As far as I understand, the doctest failures are expected. The real problem is: $ pkgs/sagemath-categories/.tox/py39/bin/python3.9
Python 3.9.13 (main, May 24 2022, 21:28:31)
[Clang 13.1.6 (clang-1316.0.21.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sage.categories.category import Category
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/kwankyu/GitHub/sage-dev/pkgs/sagemath-categories/.tox/py39/lib/python3.9/site-packages/sage/categories/category.py", line 107, in <module>
from sage.misc.c3_controlled import _cmp_key, _cmp_key_named, C3_sorted_merge
File "sage/misc/c3_controlled.pyx", line 364, in init sage.misc.c3_controlled (build/cythonized/sage/misc/c3_controlled.c:11819)
File "/Users/kwankyu/GitHub/sage-dev/pkgs/sagemath-categories/.tox/py39/lib/python3.9/site-packages/sage/structure/__init__.py", line 2, in <module>
import sage.structure.element
File "sage/structure/element.pyx", line 1, in init sage.structure.element (build/cythonized/sage/structure/element.c:36204)
File "sage/structure/category_object.pyx", line 60, in init sage.structure.category_object (build/cythonized/sage/structure/category_object.c:9982)
ImportError: cannot import name Category Strangely this works Hera:sage-dev$ pkgs/sagemath-categories/.tox/py39/bin/python3.9
Python 3.9.13 (main, May 24 2022, 21:28:31)
[Clang 13.1.6 (clang-1316.0.21.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sage.structure.sage_object import SageObject
>>> from sage.categories.category import Category
>>> Anyway, this is not a problem of this ticket. The situation is the same without this ticket. Hence my positive review to this ticket! |
comment:163
hmm, do you have the current directory, i.e. |
comment:164
Replying to @dimpase:
Yes. But even after removing it from the path, it's the same.
$ pkgs/sagemath-categories/.tox/py39/bin/python3.9
Python 3.9.13 (main, May 24 2022, 21:28:31)
[Clang 13.1.6 (clang-1316.0.21.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python39.zip', '/usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9', '/usr/local/Cellar/python@3.9/3.9.13_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload', '/Users/kwankyu/GitHub/sage-dev/pkgs/sagemath-categories/.tox/py39/lib/python3.9/site-packages'] $ pkgs/sagemath-categories/.tox/python/bin/python
Python 3.10.4 (main, Apr 26 2022, 19:42:59) [Clang 13.1.6 (clang-1316.0.21.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/lib/python310.zip', '/usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/lib/python3.10', '/usr/local/Cellar/python@3.10/3.10.4/Frameworks/Python.framework/Versions/3.10/lib/python3.10/lib-dynload', '/Users/kwankyu/GitHub/sage-dev/pkgs/sagemath-categories/.tox/python/lib/python3.10/site-packages'] |
comment:165
Replying to @dimpase:
sagemath-categories (in contrast to sagemath-standard) does not need |
comment:166
Replying to @kwankyu:
sagemath-categories as of this ticket does not contain src/sage/matrix/matrix_space.py (see Note that the |
comment:167
Replying to @kwankyu:
The Sage library contains many cyclic imports. If one starts at the wrong place in an import cycle, one can run into problems with partially initialized modules. See #33580 (Meta-ticket: make all modules importable without sage.all) |
comment:168
Thanks both for the review! |
comment:169
Replying to @mkoeppe:
Yes, it's there. It would perhaps better be colored red or green... |
Branch pushed to git repo; I updated commit sha1. New commits:
|
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 functionsfind_python_sources
andfind_extra_files
.Per convention in the Sage library, namespace packages are recognized by the presence of
all.py
orall__*.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 theMANIFEST.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:
Follow-up tickets:
__init__.py
files for packages designated to be namespace packagessage_setup: distribution
directives,namespace
andnonamespace
files 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:
f9df1ae
Reviewer: Kwankyu Lee, Dima Pasechnik
Issue created by migration from https://trac.sagemath.org/ticket/28925
The text was updated successfully, but these errors were encountered: