Skip to content

docs: add contribution guidlines for extras#654

Merged
begumcig merged 1 commit intomainfrom
docs/add-how-to-extra-in-contribution-guidlines
May 4, 2026
Merged

docs: add contribution guidlines for extras#654
begumcig merged 1 commit intomainfrom
docs/add-how-to-extra-in-contribution-guidlines

Conversation

@begumcig
Copy link
Copy Markdown
Member

Description

#622 #653

Related Issue

Fixes #(issue number)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactor (no functional change)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

  • I added or updated tests covering my changes
  • Existing tests pass locally (uv run pytest -m "cpu and not slow")

For full setup and testing instructions, see the Contributing Guide.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code, especially for agent-assisted changes
  • I updated the documentation where necessary

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.

Note:

  • Draft PRs or PRs without a clear and detailed overview may be delayed.
  • Please mark your PR as Ready for Review and ensure the sections above are filled out.
  • Contributions that are entirely AI-generated without meaningful human review are discouraged.

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:

  • Initiative window: First Prune starts on March 31.
  • Issue assignment: For your PR to count toward First Prune, the related issue must be assigned to the contributor opening the PR. Issues are labeled with first-prune.
  • Open for review: Please open your PR and mark it ready for review by April 30 (end of April).
  • Review priority: We’ll make our best effort to review quickly any PR that is open and has a review request before April 30.
  • Credits: Each qualifying merged PR earns 30 credits. We’ll be in touch after all qualifying PRs for First Prune have been merged.
  • To get started: Have a look at all models. You’ll need to sign up on the dashboard before you can redeem your credits.

@begumcig begumcig requested a review from gsprochette April 30, 2026 14:45
Copy link
Copy Markdown
Collaborator

@gsprochette gsprochette left a comment

Choose a reason for hiding this comment

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

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**
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

@begumcig begumcig force-pushed the docs/add-how-to-extra-in-contribution-guidlines branch from 20f8c8d to 5cb6bee Compare April 30, 2026 16:25
Copy link
Copy Markdown
Collaborator

@gsprochette gsprochette left a comment

Choose a reason for hiding this comment

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

Perfect, thanks for the changes 🚀

@begumcig begumcig merged commit 67f9940 into main May 4, 2026
8 checks passed
@begumcig begumcig deleted the docs/add-how-to-extra-in-contribution-guidlines branch May 4, 2026 12:52
Copy link
Copy Markdown
Collaborator

@gsprochette gsprochette left a comment

Choose a reason for hiding this comment

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

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"``.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two things here:

  1. 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.
  2. 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.
Copy link
Copy Markdown
Collaborator

@gsprochette gsprochette May 6, 2026

Choose a reason for hiding this comment

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

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 [...]

  1. Define the dependency group [...] -> add something about adding the conflicts
  2. For algorithms, set [...]
  3. Register a matching [...]
  4. Finally, add the extra to the CI (add a clear path and indication of where in the file) [...]

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants