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
Refactor environment config variables to path #30855
Comments
comment:2
Note that in |
comment:3
Thanks for the pointer to Or are you proposing to replace/encapsulate all variables in |
comment:4
Replying to @tobiasdiez:
Yes, I would not consider it an improvement to put another, intermediate abstraction inside |
comment:5
Replying to @tobiasdiez:
Well, encapsulating these variables is the direction in which the code added to |
comment:6
Replying to @mkoeppe:
I think you misunderstood my intention a bit. I didn't add another layer of abstraction, I just changed the interface to the same information. Instead of yielding a string path, it returns now a proper
ok, but adding such an abstraction for the ellCurve data directory can be done later (and wasn't my intention). |
comment:7
The patch is adding file system inspection to |
comment:8
I agree, it's less uniform because of the special handling of paths. To make things clear, can we agree that the following is the desired behavior for paths like the ellCurve data directory?
I see the following two approaches: |
comment:9
Replying to @tobiasdiez:
That's different and more complex than the current behavior. Do you need this? Then please clarify the ticket description - it's not just refactoring. |
comment:10
I don't really need this, but thought it might be helpful / desired. If you don't think it's needed, then I can easily remove this extra logic again. |
comment:12
If you need a new behavior for configuration of "package names" (not sure what you mean by that), please open a ticket for it. In general, I recommend to keep tickets that implement new features or change behavior separate from tickets that refactor existing code. |
comment:13
What I meant was that in #30706 the added method Anyway, is the filepath handling described above in #30855 comment:8 desired or not? I don't really the need this additional logic, but it was easy to implement so I went for it while refactoring. I can easily revert it, just please let me know. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
This comment has been minimized.
This comment has been minimized.
Branch pushed to git repo; I updated commit sha1. New commits:
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:23
I have a hard time seeing how |
This comment has been minimized.
This comment has been minimized.
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:26
|
comment:27
For example this one here:
This would better be rewritten using an |
comment:28
Also, as changes like this one indicate:
The change of the type of the variables is not backwards-compatible (although in some contexts you can use path like a string). So there is a danger of breaking user code. |
comment:29
I agree, that some of the code can be further refactored and e.g. moved to the feature module. However, this only changes the location of code such as What do you propose to do about the backward-compatibility? What are sage's conventions concerning breaking changes (especially concerning relatively internal things like sage.env)? |
comment:30
It's really very simple: |
comment:31
There are over 400 usages of these path variables in sage.env (conservative estimate based on searching for |
comment:32
Replying to @tobiasdiez:
We use the deprecation mechanism if we have to make incompatible changes. Hard to do use deprecation here - which is another reason why this old interface ( |
comment:34
Why are you so much against the idea of improving For deprecation, that's possible using a wrapper around |
comment:35
Replying to @tobiasdiez:
See comment 4. Adding complexity there is not an improvement.
It already does what it seems you are trying to introduce in |
comment:36
Replying to @tobiasdiez:
For example, all places using |
comment:37
And how are the features supposed to locate files in |
comment:38
Replying to @tobiasdiez:
That's not how this works. A proposed change needs to be sufficiently motivated - what problem is the ticket trying to solve? In particular, convincing motivation is necessary when breaking changes to the interface are proposed or the complexity of the code is increased by the change.
|
comment:39
Replying to @mkoeppe:
The idea was to provide basic existence and consistency checks that would apply to all path-based env variables. Since this is apparently not desired, let's close this ticket to not spent more time discussing this. |
Reviewer: Matthias Koeppe |
Changed author from Tobias Diez to none |
Currently,
sage.env
contains a huge list of variables that can be set via env vars orsage_conf
. These are simple string variables. However, in most cases these variables actually have a different type, e.g. they point to files or are booleans. This ticket proposes to convert these stringl variables into the proper class (e.g.Path
orbool
).Since now all paths in
sage.env
arepathlib.Path
s, some other files had to be changed since they still assumed to be str. I tried to make the changes as minimal as possible, leaving a deeper refactoring to follow-up tickets.CC: @mkoeppe
Component: interfaces: optional
Branch/Commit: public/refactoring/envVars @
7a32e55
Reviewer: Matthias Koeppe
Issue created by migration from https://trac.sagemath.org/ticket/30855
The text was updated successfully, but these errors were encountered: