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.features.Executable: Add method absolute_filename #31292

Closed
mkoeppe opened this issue Jan 25, 2021 · 53 comments
Closed

sage.features.Executable: Add method absolute_filename #31292

mkoeppe opened this issue Jan 25, 2021 · 53 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Jan 25, 2021

We refactor Executable and StaticFile through a base class FileFeature.

The method absolute_filename replaces StaticFile.absolute_path and is now also available for Executable. (This is for #33440/#31296/#30818.)

The renaming from StaticFile.absolute_path to absolute_filename (with deprecation) is preparation for reclaiming the name absolute_path for a method that returns a Path instead of a str.

We also add some type annotations.

Follow-up: #31296

CC: @tobiasdiez @fchapoton @seblabbe @orlitzky @kiwifb @antonio-rojas @tornaria

Component: refactoring

Author: Matthias Koeppe

Branch/Commit: e9568e9

Reviewer: Tobias Diez

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

@mkoeppe mkoeppe added this to the sage-9.3 milestone Jan 25, 2021
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 13, 2021

comment:1

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

@mkoeppe mkoeppe modified the milestones: sage-9.3, sage-9.4 Feb 13, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Jul 19, 2021
@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 14, 2021
@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title sage.features.StaticFile: Use pathlib, add type annotations sage.features.StaticFile, Executable: Use pathlib, add type annotations Mar 1, 2022
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 1, 2022

Author: Matthias Koeppe

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 1, 2022

Replying to @mkoeppe:

In particular, we change StaticFile.absolute_path to return a Path.

Actually this would lead to errors like

File "src/sage/databases/cremona.py", line 1552, in sage.databases.cremona.LargeCremonaDatabase.degphi
Failed example:
    c = CremonaDatabase()
Exception raised:
...
      File "/Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/local/var/lib/sage/venv-python3.9/lib/python3.9/site-packages/sage/databases/sql_db.py", line 1066, in __init__
        elif (filename[-3:] != '.db'):
    TypeError: 'PosixPath' object is not subscriptable

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 1, 2022

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 1, 2022

Commit: 32ce831

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 1, 2022

New commits:

32ce831sage.features.Executable.absolute_path: New

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title sage.features.StaticFile, Executable: Use pathlib, add type annotations sage.features.Executable: Add method absolute_path Mar 1, 2022
@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 1, 2022

Changed commit from 32ce831 to 88860d3

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 1, 2022

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

88860d3sage.features.Executable.absolute_path: If SAGE_LOCAL != SAGE_VENV, search first in SAGE_VENV/bin, SAGE_LOCAL/bin, then PATH

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 1, 2022

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

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 1, 2022

Changed commit from 88860d3 to 32ce831

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 2, 2022

Changed commit from 32ce831 to 8bb7e3a

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 2, 2022

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

8bb7e3asrc/sage/features/__init__.py: Relax doctest

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 4, 2022

Changed commit from 57531d0 to 66b8125

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 4, 2022

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

66b8125sage.features.FileFeature: Add doc

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 4, 2022

comment:38

Replying to @tobiasdiez:

Please replace this by a meaningful doctest that actually shows how to use the class.

Done now

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 4, 2022

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

d631a03src/sage/features/__init__.py: Fix docstring markup

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 4, 2022

Changed commit from 66b8125 to d631a03

@tobiasdiez
Copy link
Contributor

comment:40

Thanks for the follow-up!

One last comment, otherwise it looks good to me:
The docs for absolute_filename in FileFeature now still refers to "executable", which should be replaced by "feature".

@tobiasdiez
Copy link
Contributor

comment:41

By the way, do the inheriting classes (Executable and StaticFile) really need to provide docstrings? Sphinx should copy them from the base class or not?

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 5, 2022

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

e9568e9FileFeature.absolute_filename: Fix docstring

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 5, 2022

Changed commit from d631a03 to e9568e9

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 5, 2022

comment:43

Replying to @tobiasdiez:

By the way, do the inheriting classes (Executable and StaticFile) really need to provide docstrings?

Yes, per our style guide.

@tobiasdiez
Copy link
Contributor

comment:45

Replying to @mkoeppe:

Replying to @tobiasdiez:

By the way, do the inheriting classes (Executable and StaticFile) really need to provide docstrings?

Yes, per our style guide.

What is the reason behind this requirement/convention?

@tobiasdiez
Copy link
Contributor

Reviewer: Tobias Diez

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 6, 2022

comment:47

Thanks for reviewing!

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Mar 6, 2022

comment:48

Replying to @tobiasdiez:

What is the reason behind this requirement/convention?

It was already there when I started Sage dev. It's a bit annoying at times and leads to a lot of copy+paste, but it does force people to write doctests. And having the policy scales better than renegotiating the style with every new developer.

@vbraun
Copy link
Member

vbraun commented Mar 9, 2022

@vbraun vbraun closed this as completed in 20577cc Mar 9, 2022
mkoeppe added a commit to mkoeppe/sage that referenced this issue Jun 8, 2024
vbraun pushed a commit to vbraun/sage that referenced this issue Jun 10, 2024
…`sage.features`: Remove deprecated methods

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
- Fixes sagemath#35255

Removes methods deprecated in:
- sagemath#31292 (2022)
- sagemath#33114 (2022)
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#37312
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee
vbraun pushed a commit to vbraun/sage that referenced this issue Jun 16, 2024
…`sage.features`: Remove deprecated methods

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
- Fixes sagemath#35255

Removes methods deprecated in:
- sagemath#31292 (2022)
- sagemath#33114 (2022)
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#37312
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee
vbraun pushed a commit to vbraun/sage that referenced this issue Jun 16, 2024
…`sage.features`: Remove deprecated methods

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
- Fixes sagemath#35255

Removes methods deprecated in:
- sagemath#31292 (2022)
- sagemath#33114 (2022)
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#37312
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee
vbraun pushed a commit to vbraun/sage that referenced this issue Jun 17, 2024
…`sage.features`: Remove deprecated methods

    
<!-- ^^^^^
Please provide a concise, informative and self-explanatory title.
Don't put issue numbers in there, do this in the PR body below.
For example, instead of "Fixes sagemath#1234" use "Introduce new method to
calculate 1+1"
-->
<!-- Describe your changes here in detail -->

<!-- Why is this change required? What problem does it solve? -->
<!-- If this PR resolves an open issue, please link to it here. For
example "Fixes sagemath#12345". -->
- Fixes sagemath#35255

Removes methods deprecated in:
- sagemath#31292 (2022)
- sagemath#33114 (2022)
<!-- If your change requires a documentation PR, please link it
appropriately. -->

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->
<!-- If your change requires a documentation PR, please link it
appropriately -->
<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
<!-- Feel free to remove irrelevant items. -->

- [x] The title is concise, informative, and self-explanatory.
- [ ] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation accordingly.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on
- sagemath#12345: short description why this is a dependency
- sagemath#34567: ...
-->

<!-- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
    
URL: sagemath#37312
Reported by: Matthias Köppe
Reviewer(s): Kwankyu Lee
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