-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Split test
dependencies into dev
and test
dependencies.
#12341
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
Conversation
@@ -92,9 +92,13 @@ lint = [ | |||
"tomli", # for mypy (Python<=3.10) | |||
"pytest>=6.0", | |||
] | |||
dev = [ |
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.
Maybe add a comment, that this extra is intended for use by users of sphinx.util.testing
Thanks @picnixz, perhaps also there should be a try/except for the imports in sphinx.util.testing, that adds a message for users to use sphinx[dev] |
I don't really like that. Instead, I should add some documentation for that. Otherwise, everytime a new dependency is added, a new import-guard should be added and it's an anti-pattern IMO. This also answers your first suggestion about adding a comment, and thus I'll improve the docs when I have more time. |
No, this is not an anti-pattern, and yes you should add it for every optional dependency; documentation will likely not help anyone that actually encounters this issue. Literally the first package I looked for examples of handling extra dependencies, does exactly as I suggested: https://github.com/pandas-dev/pandas/blob/9110f7cdac46c69212512635a7fdc99963540c30/pandas/compat/_optional.py#L107 I you still believe it is an anti-pattern then please provide evidence to support this |
Well, in your example, they are doing the other way around, namely they are updating their pyproject after updating the versions. But in our case, we are centralizing everything at the level of pyproject.toml. I would understand if we were to actually check dependencies at the code level but here we are leaving this task to package managers instead. As such I still believe it's not how we should do with our current dependency system. In general, when you have dependencies like that, either the guard or the requirements files should be automatically generated from some specifications (it's like having a Now, it is more common to have Finally, using |
I still feel this misses the point a little though 😅
But setting that aside... So I feel But look I won't hold this up, as there is not exactly practice (if only we had the wonderful features of rust 😉 https://doc.rust-lang.org/cargo/reference/features.html) |
I'm always open to suggestions so I don't mind the debate!
Actually, the original issue was because they were testing a
It's probably something that has to do with the terminology in general. Since I'm coming from C/C++,
The main reason about not having a comment was more because I really don't expect people to get into the pyproject.toml file (and thus the comment wouldn't even be read). I expect those that have issues to first go to our website to see the installation instructions. As for whether As for the features by rust, I'd say... it's another way to make plugins without having million of repositories outside your main source code, which in C++ usually translates into |
😄 👍
maybe just me, but I always read the
Well thats another discussion, the main way to do this in rust is: https://doc.rust-lang.org/cargo/reference/workspaces.html (see e.g. my use in https://github.com/markdown-it-rust/markdown-it-plugins.rs/tree/main/crates and https://github.com/sphinx-extensions2/sphinx-rust) I would love to have this in Python, and feel it could be a really good fit for sphinx. I've tried it out personally https://github.com/chrisjsewell/pymonorepo, but its difficult with current python/pypa standards. I think main stream adoption may hopefully come when rye matures: https://rye-up.com/guide/workspaces/ |
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 still suggest changing the name from dev, but won't block it for this
When (and if) PEP 735 is accepted, we can probably simplify the deduplication of packages. It would at least be cleaner that way.
This does not resolve #12339 because we still need to change the
pyproject
andtox.ini
ofsphinxcontrib-*
packages so that they usesphinx[dev]
and not justsphinx
.