Skip to content
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

Replace use of module_list and OptionalExtension by extending find_python_sources #29701

Closed
mkoeppe opened this issue May 17, 2020 · 87 comments
Closed

Comments

@mkoeppe
Copy link
Member

mkoeppe commented May 17, 2020

We add two new features to find_python_sources: finding Cython extensions, and filtering by "distributions".

We remove the use of module_list, finding Cython extensions instead in the source tree. (This is prepared by #29706 and follow-up tickets by moving Extension options to directives in the source files.)

We remove OptionalExtensions as follows. We map installed packages to "distributions" (for example, tdlib -> sage-tdlib) and then filter by distribution.

Follow-up tickets:

CC: @kiwifb @isuruf @videlec @dcoudert @dimpase @kliem @vbraun

Component: refactoring

Author: Matthias Koeppe

Branch/Commit: 55c3fbc

Reviewer: Jonathan Kliem

Issue created by migration from https://trac.sagemath.org/ticket/29701

@mkoeppe mkoeppe added this to the sage-9.2 milestone May 17, 2020
@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title Replace use of OptionalExtension by namespace packages Meta-ticket: Replace use of OptionalExtension by namespace packages May 17, 2020
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Member Author

mkoeppe commented Jun 3, 2020

Dependencies: #29411, #29702, #29706, #29720, #29721, #29785, #29786, #29790, #29791, #28925

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title Meta-ticket: Replace use of OptionalExtension by namespace packages Replace use of module_list and OptionalExtension by extending find_python_sources Jun 3, 2020
@mkoeppe
Copy link
Member Author

mkoeppe commented Jun 3, 2020

@mkoeppe
Copy link
Member Author

mkoeppe commented Jun 3, 2020

Commit: 891d12a

@mkoeppe
Copy link
Member Author

mkoeppe commented Jun 3, 2020

Last 10 new commits:

4365e5dMerge branch 't/29790/move_extension_options_from_src_module_list_py_to__distutils___directives_in_the_individual_files__part_5__sage_graphs_' into t/29705/META-modularize-sagelib
9dc7022Merge branch 't/29706/move_extension_options_from_src_module_list_py_to__distutils___directives_in_the_individual_files' into t/29791/move_extension_options_from_src_module_list_py_to__distutils___directives_in_the_individual_files__part_6__last_
f78b06dsrc/module_list.py: Move options for Extensions in sage.libs to distutils directives
1b0e29dsrc/module_list.py: Move options for Extensions in sage.matrix to distutils directives
6421e2csrc/module_list.py: Move remaining options for Extensions in sage.libs, sage.rings to distutils directives
b3d3d2fMerge branch 't/29791/move_extension_options_from_src_module_list_py_to__distutils___directives_in_the_individual_files__part_6__last_' into t/29705/META-modularize-sagelib
2821934Fix sage_setup directives: Use distribution, not package
9052db4Merge branch 't/29720/move_extension_options_from_src_module_list_py_to__distutils___directives_in_the_individual_files__part_2___optionalextensions_' into t/29705/META-modularize-sagelib
ff710eesrc/sage_setup/optional_extension.py (is_package_installed_and_updated): Factor out from OptionalExtension
891d12asrc/setup.py: Remove use of module_list.py; filter by distributions

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Member Author

mkoeppe commented Jun 3, 2020

Changed dependencies from #29411, #29702, #29706, #29720, #29721, #29785, #29786, #29790, #29791, #28925 to #29411, #29702, #29706, #29720, #29721, #29785, #29786, #29790, #29791

@mkoeppe
Copy link
Member Author

mkoeppe commented Jun 3, 2020

Changed dependencies from #29411, #29702, #29706, #29720, #29721, #29785, #29786, #29790, #29791 to #29702 (#29411), #29706, #29720, #29721, #29785, #29786, #29790, #29791

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 3, 2020

Changed commit from 891d12a to ec7e9c5

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 3, 2020

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

0295c8fsrc/module_list.py: Move options for Extensions in sage.graphs.graph_decompositions to distutils directives
b582789src/sage_setup/find.py: Filter by directive 'sage_setup: distribution = PKG', find Cython modules
63c64d5Merge branches 't/29720/move_extension_options_from_src_module_list_py_to__distutils___directives_in_the_individual_files__part_2___optionalextensions_', 't/29721/spkg_configure_m4_for_coxeter3', 't/29785/move_extension_options_from_src_module_list_py_to__distutils___directives_in_the_individual_files__part_3__get_rid_of_uname_specific_', 't/29786/move_extension_options_from_src_module_list_py_to__distutils___directives_in_the_individual_files__part_4__sage_rings_', 't/29790/move_extension_options_from_src_module_list_py_to__distutils___directives_in_the_individual_files__part_5__sage_graphs_' and 't/29791/move_extension_options_from_src_module_list_py_to__distutils___directives_in_the_individual_files__part_6__last_' into t/29701/replace_use_of_module_list_optionalextension
ae70c81src/sage_setup/optional_extension.py (is_package_installed_and_updated): Factor out from OptionalExtension
ec7e9c5src/setup.py: Remove use of module_list.py; filter by distributions

@mkoeppe
Copy link
Member Author

mkoeppe commented Jun 3, 2020

comment:15

No longer on top of #28925, so no namespace package are involved any more for this ticket.

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Member Author

mkoeppe commented Jun 3, 2020

Author: Matthias Koeppe

@mkoeppe

This comment has been minimized.

@dimpase
Copy link
Member

dimpase commented Aug 4, 2020

comment:63

Replying to @mkoeppe:

#30260 is broken. It is confused about whether it wants sage.graphs.distance_regular or sage.graphs.generators.distance_regular

it used to be broken, but IMHO it's fixed by #30240 comment:32

@kiwifb
Copy link
Member

kiwifb commented Aug 4, 2020

comment:64

Replying to @dimpase:

Replying to @mkoeppe:

#30260 is broken. It is confused about whether it wants sage.graphs.distance_regular or sage.graphs.generators.distance_regular

it used to be broken, but IMHO it's fixed by #30240 comment:32

Unfortunately Volker merged before that.

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 4, 2020

comment:65

#30240 does not even have #30260 as a dependency...

@Ivo-Maffei
Copy link
Mannequin

Ivo-Maffei mannequin commented Aug 5, 2020

comment:66

Replying to @mkoeppe:

#30240 does not even have #30260 as a dependency...

Should it? #30260 is a later ticket and it depends on #30240, but #30240 doesn't rely on #30260.
I apologise for the confusion but when #30240 went from "positive review" to "needs work" and I forgot to update #30260.

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 5, 2020

comment:67

Replying to @Ivo-Maffei:

Replying to @mkoeppe:

#30240 does not even have #30260 as a dependency...

Should it? #30260 is a later ticket and it depends on #30240, but #30240 doesn't rely on #30260.
I apologise for the confusion but when #30240 went from "positive review" to "needs work" and I forgot to update #30260.

That's alright -- thanks for the fast reaction and fix!

@vbraun
Copy link
Member

vbraun commented Aug 8, 2020

comment:68
sage -t --long --warn-long 42.4 --random-seed=0 src/sage_setup/find.py
**********************************************************************
File "src/sage_setup/find.py", line 215, in sage_setup.find.find_extra_files
Failed example:
    extras["sage/ext/interpreters"]
Expected:
    ['.../src/sage/ext/interpreters/wrapper_cdf.pxd', ...wrapper_cdf.h...]
Got:
    ['/home/release/Sage/src/sage/ext/interpreters/wrapper_cc.pxd',
     '/home/release/Sage/src/sage/ext/interpreters/wrapper_cc.pyx',
     '/home/release/Sage/src/sage/ext/interpreters/wrapper_cdf.pxd',
     '/home/release/Sage/src/sage/ext/interpreters/wrapper_cdf.pyx',
     '/home/release/Sage/src/sage/ext/interpreters/wrapper_el.pxd',
     '/home/release/Sage/src/sage/ext/interpreters/wrapper_el.pyx',
     '/home/release/Sage/src/sage/ext/interpreters/wrapper_py.pxd',
     '/home/release/Sage/src/sage/ext/interpreters/wrapper_py.pyx',
     '/home/release/Sage/src/sage/ext/interpreters/wrapper_rdf.pxd',
     '/home/release/Sage/src/sage/ext/interpreters/wrapper_rdf.pyx',
     '/home/release/Sage/src/sage/ext/interpreters/wrapper_rr.pxd',
     '/home/release/Sage/src/sage/ext/interpreters/wrapper_rr.pyx']
**********************************************************************
1 item had failures:
   1 of   7 in sage_setup.find.find_extra_files
    [36 tests, 1 failure, 0.27 s]
----------------------------------------------------------------------
sage -t --long --warn-long 42.4 --random-seed=0 src/sage_setup/find.py  # 1 doctest failed
----------------------------------------------------------------------

@vbraun
Copy link
Member

vbraun commented Aug 8, 2020

comment:69

Might have been from #29950

@mkoeppe
Copy link
Member Author

mkoeppe commented Aug 8, 2020

comment:70

Yes, it's #29950 that broke it.

@vbraun
Copy link
Member

vbraun commented Aug 10, 2020

@vbraun vbraun closed this as completed in 2c85de4 Aug 10, 2020
tornaria added a commit to tornaria/sage that referenced this issue Feb 11, 2024
The implementation of sage.misc.package_dir.read_distributions uses the
function `Cython.Utils.open_source_file()` to open a file instead of
`io.open()`. This function was introduced in sagemath#29701 (b582789).

The only difference between `open_source_file()` and `io.open()` is that
the former will open the file as binary to check the encoding. But all
our files should be utf-8 so we don't need this trick.
tornaria added a commit to tornaria/sage that referenced this issue Feb 11, 2024
The implementation of sage.misc.package_dir.read_distributions uses the
function `Cython.Utils.open_source_file()` to open a file instead of
`io.open()`. This function was introduced in sagemath#29701 (b582789).

The only difference between `open_source_file()` and `io.open()` is that
the former will open the file as binary to check the encoding. But all
our files should be utf-8 so we don't need this trick.
vbraun pushed a commit to vbraun/sage that referenced this issue Feb 11, 2024
…dist

The implementation of sage.misc.package_dir.read_distributions uses the
function `Cython.Utils.open_source_file()` to open a file instead of
`io.open()`. This function was introduced in sagemath#29701 (b582789).

The only difference between `open_source_file()` and `io.open()` is that
the former will open the file as binary to check the encoding. But all
our files should be utf-8 so we don't need this trick.

In case I’m mistaken and there is a reason this trick is really
necessary (@mkoeppe?) it seems better to include a version of
open_source_file(), for two main reasons: (a) we don’t pull the whole of
Cython just for a trivial function; (b) changes in Cython don’t affect
sagemath (this is not a documented function of Cython, afaict)

### 📝 Checklist

- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.

URL: sagemath#37290
Reported by: Gonzalo Tornaría
Reviewer(s): Gonzalo Tornaría, Matthias Köppe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants