-
Notifications
You must be signed in to change notification settings - Fork 45
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
SPEC 13: Recommended targets and naming conventions #324
base: main
Are you sure you want to change the base?
Conversation
cc @Carreau |
spec-0013/index.md
Outdated
|
||
### Examples | ||
|
||
pyproj.toml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spec-0013/index.md
Outdated
|
||
### Examples | ||
|
||
pyproj.toml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??
pyproj.toml | |
pyproject.toml |
spec-0013/index.md
Outdated
|
||
## Description | ||
|
||
For consistency and decreased cognitive load across the ecosystem, this SPEC recommends naming conventions around various project aspects--such as project structure, repository layout, folder names, task runner and `pyproject.toml` targets name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also add some defaults for declaring optional dependencies: all
, test
, and docs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test
-> tests
? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
never mind, should have read all the comments below before commenting, as this was already mentioned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dev
would also be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test --> tests, bike shedding, but I'm 👎 on this. As it's test-dependencies in my view while the other recommendation is about a directory that contains the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just hard to remember that "s" is for testing dir (pytest tests/
) but no "s" for install (pip install .[test]
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
astropy does it this way since forever 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not too fond of [dev]
, this makes people think it's okay to install all your development dependencies into a single environment, which is not true. Also not fond of [all]
, same sort of reason. I've seen [all]
used well for projects that have several optional dependencies and then provide an [all]
, but it's not useful to add things like [test]
dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also limited the discussion to test[s]
and doc[s]
and did not discuss other target to now grow the spec too much.
We can extend to other naming conventions later.
FYI, almost every package I work on (regardless of whether I set it up) uses |
Quick numbers on a somewhat older copy of PyPI indicates
The reverse is true for |
Co-authored-by: M Bussonnier <bussonniermatthias@gmail.com>
Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>
I mean we had a vote here 😅 We will discuss this once more here with everyone. |
I think we were roughly aware that |
I think you should have a very good reason to go against a 3x more popular choice. It's much harder to suggest the opposite of what everyone does and hope people change than it is to encourage a self-adopted standard. Maybe matching the folder name is good enough reason, but folder names are not the same things as extras, so not sure. |
💯 |
It takes less time for people to change things than writing a comment to argue honestly. |
We can also punt for now on I personally can live with extra and folders being different as long as there is some consistency across projects. |
This is not remotely helpful or realistic. All CI files, most cibuildwheel configs, task runners, etc. all have to change. Then CI has to run. If everything passes, then it has to be merged and released. Then all third party packaging that uses these may also have to change. This is for every package - I maintain over 40. How is minimizing this saying "less time for people to change things" at all remotely considerate of other people's time? Aren't SPECs supposed to be community consensus? Aren't they supposed to be discussed? |
Sorry for the joke there. I see it can have been read in a different way and here we had quite some fun making this draft. Anyway, I was only saying that besides very active people like you, this would not be that difficult for most people who barely have a single repo to handle. Also as with all the specs there is endorsement vs adoption. |
Okay, it rubbed me the wrong way. You have to remember this is also being proposed as a rule for repo-review, which is not just a suggestion in a document! PS: To be clear, I'm not against the idea, and don't really care other than wanting there to be some sort of standard - If something does become standard, then automatically picking up on it if defined can simply some tooling, for example. |
The repo-review one is just me finding this spec as an excuse to try to understand the code of repo-review. I think it makes sens is this gets adopted to be added to repo-review (and reflected in packaging guide), but the submission to repo-review was not a global decision. |
I agree on that, but I think that's why it's important make sure the SPEC has the correct recommendation. Once it's in the SPEC, it would eventually come to sp-repo-review. |
I pushed some modifications to clarify that we punt for now on |
FYI, Only a "preference" for a |
https://packaging.python.org/en/latest/specifications/core-metadata/#provides-extra-multiple-use
I think it's okay to recommend a specific naming convention but historically my view is this: https://discuss.python.org/t/providing-a-way-to-specify-how-to-run-tests-and-docs/15016/49 Basically, I am very wary of standardization for environment manager configuration. As long as we don't start advocating for extra stuff then it seems relatively innocuous to me 🙂 |
Wow, I didn't realize "test" and "doc" were already reserved as the testing and docs extras. Especially since "docs" is 3x more popular. Thanks! I recommend we follow Python's standards then for extras, at least for |
I've opened pypa/hatch#1553 to suggest hatch pick up on the |
- Folders containing tests be names `tests`. | ||
- Targets related to documentations be named `docs` (and not `doc`). For example | ||
`spin docs`, `make docs`, `tox -s docs`. | ||
- That the documentation `extra` optional dependency be named `docs` (and not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to think that adding a recommendation for all
and dev
are non-controversial, too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly recommend no recommendation on [dev]
. Having an "all in one" environment makes the environment hard to solve, sometimes impossible to solve. Solvers are very sensitive to the number of dependencies in an environment. There was a time when you couldn't install black
and tensorflow
in the same environment due to dependency conflicts. I've seen solvers choke for minutes1 trying to solve updates on massive "all-in-one" environments. And you never need to install your code formatter, or pre-commit, etc. in the same environment as your package, they are stand-alone tools!
And [all]
sometimes means all true optional dependencies, not testing and development dependencies. Like validate-pyproject[all]
.
uv
is currently working on a solution for project-level "pipx"-like installs. And there is an effort to make dependency groups a standard in PEP 735. How about avoiding any extra recommendation until PEP 735 is accepted or rejected, and we look into seeing if there's interest in changing the official [doc]
extra recommendation to [docs]
?
Footnotes
-
On average. The record I've seen was 25 hours. ↩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, no strong preference for [dev]
, but definitely having a true, user facing dependencies into [all]
, so it should have no testing or documentation ones in there.
I didn't know what the SPEC was about, and found the term "target" quite confusing; would "Recommended naming conventions" capture the whole scope well enough? |
My recommendation: Avoid mentioning extras for now. I don't think a SPEC should make a recommendation in direct opposition to the official guidelines lightly, so we can open a discussion about Long term, having the recommendations on extras is good, but let's not hastily add something that contracts a 7+ year old official guideline. The most important thing it to have a standard, so tools can automatically optimize if you follow it. I'd replace the word "target" everywhere with "task", as it's referring to task runner's unit of work, which I think "task" conveys in a tool-agnostic way. Nox calls them sessions. And I think "Recommended naming conventions" is a better SPEC name, too. |
|
||
- Targets related to testing be named `tests` (and not `test`). For example | ||
`spin tests`, `python dev.py tests`, `nox -s tests`. | ||
- Folders containing tests be names `tests`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Folders containing tests be names `tests`. | |
- Folders containing tests be named `tests`. |
From a cursory survey in the Scientific Python ecosystem, we discover some | ||
frustration from contributors and maintainer when moving from one project to | ||
another and believe that consistency will make it both easier for existing | ||
maintainer to contribute to project as well a decrease the confusion of new | ||
developers when contributing or creating new projects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"cursory" means hasty and without attention to detail, but suggests that it wasn't done well. Readers might not think it's appropriate to base a SPEC on a "cursory" survey. "Informal" is also true but may carry less of a negative connotation.
Isn't scientific python used in the lower case sense here?
From a cursory survey in the Scientific Python ecosystem, we discover some | |
frustration from contributors and maintainer when moving from one project to | |
another and believe that consistency will make it both easier for existing | |
maintainer to contribute to project as well a decrease the confusion of new | |
developers when contributing or creating new projects. | |
From an informal of scientific Python developers, we discover some | |
frustration from contributors and maintainers when moving from one project to | |
another. We believe that consistency will make it both easier for existing | |
maintainers to contribute to projects as well as decrease the confusion of new | |
developers when creating or contributing to projects. |
Or consider "creating new projects or contributing to existing ones". (I found it easy to misread "contributing or creating new".)
There seem to be a strong consensus with preference for `docs` in favor of | ||
`docs`, and a preference for `tests` in favor of `test`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seem to be a strong consensus with preference for `docs` in favor of | |
`docs`, and a preference for `tests` in favor of `test`. | |
There seem to be a strong consensus with preference for `docs` over | |
`doc`, and a preference for `tests` over `test`. |
"preference for tests" means that "tests" is preferred, but "in favor of test" means that "test" is preferred, so it was not clear to me which was preferred.
For the tie being we will not pronounce ourselves on the optional extra | ||
`extra` dependency for `pyproject.toml`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the tie being we will not pronounce ourselves on the optional extra | |
`extra` dependency for `pyproject.toml`. | |
For the time being, we will not specify a name of the optional extra | |
`extra` dependency for `pyproject.toml`. |
And I'd suggest moving this to the end. It might be OK to precede this section with one about "Scope", but as-is, it looks like this is just one example of something that was not decided.
- Targets related to testing be named `tests` (and not `test`). For example | ||
`spin tests`, `python dev.py tests`, `nox -s tests`. | ||
- Folders containing tests be names `tests`. | ||
- Targets related to documentations be named `docs` (and not `doc`). For example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Targets related to documentations be named `docs` (and not `doc`). For example | |
- Targets related to documentation be named `docs` (and not `doc`). For example |
(It was mentioned during the discussion that we say "docs" even though "documentation" is the full word.)
doc), so that docs dependencies can be installed with `pip install .[docs]` | ||
- Use lowercase. | ||
|
||
It is appropriate to have the singular aliases to ease transition, but the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might mention what the aliases are for. Probably not aliases for folders?
Topic raised during the summit.
Discussion: https://discuss.scientific-python.org/t/spec-13-recommended-targets-and-naming-conventions/1226