Skip to content

Lint and format notebooks, notebook dependency group and NLP notebook outputs - #812

Merged
milton-minervino merged 5 commits into
MAIF:developfrom
milton-minervino:feature/ruff-tutorials
Oct 27, 2026
Merged

milton-minervino merged 5 commits into
MAIF:developfrom
milton-minervino:feature/ruff-tutorials

Conversation

@milton-minervino

Copy link
Copy Markdown
Collaborator

The tutorials appear in the documentation, so they now follow the same ruff rules as the package.

Changes

  • Ruff on tutorials: tutorial/ and notebooks are no longer excluded from ruff, in CI or in the pre-commit hooks. The docstring, import-position and assert rules are ignored for tutorials.
  • Ruff fixes: ruff's automatic fixes and formatting are applied to the notebooks (import sorting, whitespace, unused imports). Only code cell sources change; saved outputs are kept. A few findings were fixed by hand.
  • New notebook group: a notebook dependency group with ipykernel, included in dev-all. An exact uv sync removed the Jupyter kernel because no group declared it. To run the tutorials: uv sync --group notebook, plus --extra dependencies if needed (for example report, nlp).
  • NLP overview notebook: the install cell now shows pip install "shapash[nlp]" for users and the uv command for contributors, and the notebook is committed with its outputs.
  • CONTRIBUTING.md: documents the notebook group.

The tutorials are rendered in the documentation, so they now follow the
same ruff rules as the package, in CI and in the pre-commit hooks.

- Stop excluding tutorial/ and notebooks from ruff; ignore docstring,
  import-position and assert rules in tutorials.
- Run the ruff pre-commit hooks on notebooks.
- Apply ruff's fixes (import sorting, trailing whitespace, unused and
  repeated imports) and formatting. Only code cell sources change; saved
  outputs are kept.
- Fix the remaining findings by hand: display each attribute in the NLP
  overview instead of only the last one, drop a redundant IPython
  display import, and clear a list instead of rebinding it as a global.
An exact `uv sync` removed the Jupyter kernel from the environment, since
no group declared it. Add a `notebook` group (included in `dev-all`) and
document it in CONTRIBUTING.md and the NLP overview notebook, whose install
cell now shows the PyPI command for users.
@milton-minervino milton-minervino added the documentation Improvements or additions to documentation label Oct 23, 2026
@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.08%. Comparing base (e8ac024) to head (a04ec97).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #812      +/-   ##
===========================================
- Coverage    86.09%   86.08%   -0.01%     
===========================================
  Files          115      115              
  Lines        11825    11825              
  Branches      2158     2158              
===========================================
- Hits         10181    10180       -1     
- Misses        1008     1009       +1     
  Partials       636      636              

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@milton-minervino
milton-minervino merged commit 2f70bef into MAIF:develop Oct 27, 2026
9 checks passed
@milton-minervino
milton-minervino deleted the feature/ruff-tutorials branch October 27, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants