docs: add contribution guidlines for extras#654
Conversation
gsprochette
left a comment
There was a problem hiding this comment.
I think the description here is still incomplete because it's missing the "how to add a new extra" part, and a "where to add an error to state that the extra should be installed to run this algorithm" part
|
|
||
| uv run pytest -m "cpu and not slow" | ||
|
|
||
| **Adding tests that need optional extras** |
There was a problem hiding this comment.
I both agree with this, but this is not really for adding whatever test that requires an already defined extra, it's really for adding a new extra, correct?
I think this could be completed into a How and when to add a new extra section that explains
- how and when to create an extra in the pyproject.toml
- where to add an error in the algorithm to state that the extra should be installed
- how to mark the test and add the extra to the CI
20f8c8d to
5cb6bee
Compare
gsprochette
left a comment
There was a problem hiding this comment.
Perfect, thanks for the changes 🚀
gsprochette
left a comment
There was a problem hiding this comment.
Seeing the iterations in the current PRs that have to go through the process, I left 2 comments to make the process description clearer
| Add a new extra when a feature or algorithm needs dependencies that should not be installed for every |pruna| user, for example because they are heavy, platform-specific, or only needed for one backend. | ||
| Define the dependency group in ``pyproject.toml`` under ``[project.optional-dependencies]``. | ||
| For algorithms, set ``required_install`` on the algorithm class, for example ``required_install = "uv pip install 'pruna[my-extra]'"``; this is used in the import error shown when the extra is missing. | ||
| Finally, register a matching ``requires_<extra>`` marker in ``tests/conftest.py``, mark tests that need the extra, and add the extra to the CI matrix with its install option and marker filter, for example ``extras: "--extra my-extra"`` and ``mark_filter: "requires_my_extra"``. |
There was a problem hiding this comment.
Two things here:
- Can the second half of the sentence "add the extra to the CI matrix [...]" be a new sentence on an other line? It feels like something independent.
- Can you give the clear path to the CI? It's not super clear right now
|
|
||
| **How and when to add a new optional extra** | ||
|
|
||
| Add a new extra when a feature or algorithm needs dependencies that should not be installed for every |pruna| user, for example because they are heavy, platform-specific, or only needed for one backend. |
There was a problem hiding this comment.
The lines after this one are an enumeration, can you add numbers so that we can refer to them easily in PR comments? It should look like:
Add a new extra when [...]
- Define the dependency group [...] -> add something about adding the conflicts
- For algorithms, set [...]
- Register a matching [...]
- Finally, add the extra to the CI (add a clear path and indication of where in the file) [...]
Description
#622 #653
Related Issue
Fixes #(issue number)
Type of Change
Testing
uv run pytest -m "cpu and not slow")For full setup and testing instructions, see the Contributing Guide.
Checklist
Thanks for contributing to Pruna! We're excited to review your work.
New to contributing? Check out our Contributing Guide for everything you need to get started.
First Prune (1-year OSS anniversary)
First Prune marks one year of Pruna’s open-source work. During the initiative window, qualifying merged contributions count toward First Prune. You can earn credits for our performance models via our API.
If you’d like your contribution to count toward First Prune, here’s how it works: