Skip to content

Include dev dependencies in pyproject.toml and update docs on requirements#1317

Merged
larsoner merged 7 commits intosphinx-gallery:masterfrom
AlexSzatmary:fix-requirements.txt
Jun 3, 2024
Merged

Include dev dependencies in pyproject.toml and update docs on requirements#1317
larsoner merged 7 commits intosphinx-gallery:masterfrom
AlexSzatmary:fix-requirements.txt

Conversation

@AlexSzatmary
Copy link
Copy Markdown
Contributor

sphinx-gallery migrated to pyproject.toml (see #1267) but this migration was not fully implemented. In particular, requirements.txt was removed but it is still referenced in several files. The developer install instructions were not updated (#1316) but this PR should resolve that issue. Also, the quickstart in README.rst says, "Sphinx-Gallery will not manage its dependencies" but with dependencies listed in pyproject.toml, pip now takes care of that.

I moved the contents of dev-requirements.txt into pyproject.toml and updated docs on how to install for contributors.

I also noticed a lot of "Package would be ignored" warnings. I resolved that by setting namespaces = true in pyproject.toml, which resolves that warning and is the default. I diffed the trees for the installed sphinx-gallery with and without that change; there was no difference.

AlexSzatmary and others added 3 commits June 2, 2024 14:54
…ments

Note that `namespaces = true` is now set in pyproject.toml, which resolves "Package would be ignored" warnings
Copy link
Copy Markdown
Contributor

@larsoner larsoner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tweaked a comment to reflect the new behavior, making for merge when green, thanks @AlexSzatmary

@larsoner
Copy link
Copy Markdown
Contributor

larsoner commented Jun 2, 2024

Oh CIs are unhappy, looks like there are still some references to dev-requirements. Maybe git grep can help here

@AlexSzatmary
Copy link
Copy Markdown
Contributor Author

@larsoner Thanks for the speedy review! I see that CI needed dev-requirements.txt . I will look into telling CI to install using the dev option.

@larsoner
Copy link
Copy Markdown
Contributor

larsoner commented Jun 2, 2024

Okay let me know whenever you need me to approve CIs. GH is going to ask on every commit you push as a new contributor 😬

@AlexSzatmary
Copy link
Copy Markdown
Contributor Author

I looked at.github/install.sh . There are a lot of possible combinations of installed dependencies. Do they still work as intended since the migration to pyproject.toml? It seems pip would install dependencies even for cases where that is not intended, such as minimal. It would be nice if there were at least comments explaining all of the variants.

@larsoner
Copy link
Copy Markdown
Contributor

larsoner commented Jun 2, 2024

Yeah it is not super well documented. Want me to try pushing a commit?

In short I would try changing any instance of dev-requirements.txt install to later pip install .[dev] or so, and otherwise leave the existing combinations alone.

@AlexSzatmary
Copy link
Copy Markdown
Contributor Author

@larsoner feel free to try that.

Alternatively, I think that,

PIP_DEPENDENCIES=`python -c 'import tomllib; data = tomllib.load(open("pyproject.toml", "rb")); print(" ".join(data["project"]["optional-dependencies"]["dev"]))'``

is the most one-for-one comparable to the -r requirements-dev.txt.

You would know better than I would which is the better approach.

@AlexSzatmary
Copy link
Copy Markdown
Contributor Author

I'm also not sure if it's better to include --no-build-isolation in
python -m pip install --editable --no-build-isolation ".[dev]"

@larsoner larsoner enabled auto-merge (squash) June 3, 2024 04:04
@larsoner larsoner merged commit b255469 into sphinx-gallery:master Jun 3, 2024
@larsoner
Copy link
Copy Markdown
Contributor

larsoner commented Jun 3, 2024

Thanks @AlexSzatmary ! I went with the minimalist approach in 4178d84 of just replacing the -r with equivalent [...] in the eventual install line. That way we can leave refactoring for later. Though I think in principle we maybe had all those variants for a reason at some point, so probably not worth it for now!

@AlexSzatmary
Copy link
Copy Markdown
Contributor Author

Awesome, thanks @larsoner !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants