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

Prepare sage.doctest for namespace packages #33033

Closed
mkoeppe opened this issue Dec 16, 2021 · 30 comments
Closed

Prepare sage.doctest for namespace packages #33033

mkoeppe opened this issue Dec 16, 2021 · 30 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Dec 16, 2021

The Sage doctester decides whether a Python file is part of a package based on the presence of __init__.py files. This is no longer appropriate because PEP 420 implicit namespace packages do not have __init__.py files; see #32501.

We implement a new function sage.misc.package_dir.is_package_or_sage_namespace_package_dir, which we will also use in #28925.

This change also removes a runtime dependency of the doctester on Cython, see #33029.

CC: @tobiasdiez @kwankyu @kiwifb @antonio-rojas @seblabbe

Component: doctest framework

Author: Matthias Koeppe

Branch/Commit: 5adae47

Reviewer: Tobias Diez, Kwankyu Lee

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

@mkoeppe mkoeppe added this to the sage-9.5 milestone Dec 16, 2021
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 16, 2021

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 16, 2021

Commit: ab23a14

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 16, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

ab23a14src/sage/doctest/sources.py: Use is_package_or_sage_namespace_package_dir

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 16, 2021

Author: Matthias Koeppe

@mkoeppe

This comment has been minimized.

@tobiasdiez
Copy link
Contributor

comment:6

A few nitpicks from my side, otherwise looks good (codewise, didn't try it locally).

The explicit bool in sagemath/sagetrac-mirror@develop...u/mkoeppe/prepare_sage_doctest_for_namespace_packages#diff-944be831a2285f89611252d94988abde763acd41fd84353c5b46c01df443dc82L680-L683 can probably be removed (at least according to the comment that had been there).

sage: d = os.path.dirname(sage.cpython.file); d

For readability, I would propose to use dir or directory instead of the single-letter variable name.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 16, 2021

Changed commit from ab23a14 to d8aa37c

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 16, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

0f05856src/sage/doctest/sources.py: Remove unnecessary conversion to bool
d8aa37csrc/sage/misc/namespace_package.py: In doctests, use 'directory' instead of the single-letter variable name

@tobiasdiez
Copy link
Contributor

comment:8

Thanks, the changes look good to me!

@tobiasdiez
Copy link
Contributor

Reviewer: Tobias Diez, ...

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 16, 2021

Changed commit from d8aa37c to 19e93f0

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 16, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

19e93f0is_package_or_sage_namespace_package_dir: Make directories with __init__.pxd package directories

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 17, 2021

comment:12

Turns out that this module is not the best place for the new function because the function will need to be packaged in the distribution sagemath-environment.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 17, 2021

Branch pushed to git repo; I updated commit sha1. New commits:

5808f3dsrc/sage/misc/package_dir.py: New file for is_package_or_sage_namespace_package_dir

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 17, 2021

Changed commit from 19e93f0 to 5808f3d

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 21, 2021

comment:15

Ready for review

@mkoeppe mkoeppe removed this from the sage-9.5 milestone Dec 27, 2021
@mkoeppe mkoeppe added this to the sage-9.6 milestone Dec 27, 2021
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 23, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

3939af7Merge tag '9.5.rc3' into t/33033/prepare_sage_doctest_for_namespace_packages

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 23, 2022

Changed commit from 5808f3d to 3939af7

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 1, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

cf40d61Merge tag '9.5' into t/33033/prepare_sage_doctest_for_namespace_packages

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 1, 2022

Changed commit from 3939af7 to cf40d61

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 6, 2022

Changed commit from cf40d61 to 5adae47

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Feb 6, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

5adae47src/sage/misc/package_dir.py: Fix pycodestyle warning

@kwankyu
Copy link
Collaborator

kwankyu commented Feb 8, 2022

comment:21

LGTM.

@kwankyu
Copy link
Collaborator

kwankyu commented Feb 8, 2022

Changed reviewer from Tobias Diez, ... to Tobias Diez, Kwankyu Lee

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 8, 2022

comment:22

Thank you!

@vbraun
Copy link
Member

vbraun commented Feb 13, 2022

Changed branch from u/mkoeppe/prepare_sage_doctest_for_namespace_packages to 5adae47

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

4 participants