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

"sage -startuptime" should accept file names too #30452

Closed
mkoeppe opened this issue Aug 27, 2020 · 20 comments
Closed

"sage -startuptime" should accept file names too #30452

mkoeppe opened this issue Aug 27, 2020 · 20 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Aug 27, 2020

(from #30410)

This is so that all of the tox environments (#30410, #30408) can be run on files and directories.

Example:

$ ./sage -startuptime src/sage/tensor/ src/sage/geometry/polyhedron/base.py

CC: @dimpase @tobiasdiez @fchapoton @jhpalmieri @tscrim @vbraun

Component: doctest framework

Author: Matthias Koeppe

Branch/Commit: 306c390

Reviewer: John Palmieri

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

@mkoeppe mkoeppe added this to the sage-9.2 milestone Aug 27, 2020
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 29, 2020

@mkoeppe

This comment has been minimized.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 29, 2020

Author: Matthias Koeppe

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 29, 2020

New commits:

06c4b55src/bin/sage-startuptime.py: Accept file/directory names too

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Aug 29, 2020

Commit: 06c4b55

@mkoeppe

This comment has been minimized.

@jhpalmieri
Copy link
Member

comment:5

It's certainly true that ./sage --startuptime src/sage/homology/simplicial_set.py raises an error without this branch and doesn't raise an error with it, but with this branch it produces no output. What is it supposed to do?

By the way, it makes me a little uncomfortable to use the same loop variable twice like this:

for module_arg in cmdline_args:
    ...
    for module_arg in matching_modules:
        ...

@jhpalmieri
Copy link
Member

comment:6

On the other hand, ./sage -startuptime src/sage/geometry/polyhedron/base.py does produce output. I'm confused.

@jhpalmieri
Copy link
Member

comment:7

I would also recommend an explicit import os statement. I'm not sure why the script works without it. Edit: I guess it's being imported from sage.all, but it would be better to make it explicit at the top.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 1, 2020

comment:8

Without this ticket ./sage --startuptime sage.homology.simplicial_set gives

[]
Traceback (most recent call last):
  File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-algebraic-2018-spring/src/bin/sage-startuptime.py", line 148, in <module>
    raise ValueError('"' + module_arg + '" does not uniquely determine Sage module.')
ValueError: "sage.homology.simplicial_set" does not uniquely determine Sage module.

Before working on this ticket, I had never used these scripts. I don't really know whether the above is expected, or a result of undetected bitrot over the years.

I think that it only works for modules that are loaded when sage.all is loaded.

@jhpalmieri
Copy link
Member

comment:9

Is it worth printing a message if the file or module is not loaded when sage.all is loaded, rather than being completely silent?

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 1, 2020

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

25e1c5fsrc/bin/sage-startuptime.py: import os
4256c9fsrc/bin/sage-startuptime.py: Both with file and module argument, warn if there is no matching module; non-uniqueness is not an error

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 1, 2020

Changed commit from 06c4b55 to 4256c9f

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 1, 2020

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

306c390src/bin/sage-startuptime.py: Use different variable in nested loop

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Sep 1, 2020

Changed commit from 4256c9f to 306c390

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 1, 2020

comment:12

How about this version?

@jhpalmieri
Copy link
Member

Reviewer: John Palmieri

@jhpalmieri
Copy link
Member

comment:13

Great, thank you for the changes.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Sep 1, 2020

comment:14

Thanks!

@vbraun
Copy link
Member

vbraun commented Sep 6, 2020

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

3 participants