Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ python scripts/run_with_env.py python -m ruff format
python scripts/run_with_env.py python -m ruff check --fix

# Pylint
python scripts/run_with_env.py python -m pylint sigima \
--disable=duplicate-code,fixme,too-many-arguments, \
too-many-branches,too-many-instance-attributes
python scripts/run_with_env.py python -m pylint sigima
```

### Translations
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v7
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
42 changes: 37 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
options:
- 'all'
- 'build'
- 'quality'
- 'build_latest'
default: 'all'
schedule:
Expand All @@ -28,7 +29,7 @@ on:

jobs:
build:
if: ${{ (github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'release') || (github.event_name == 'workflow_dispatch' && (github.event.inputs.job_to_run == 'all' || github.event.inputs.job_to_run == 'build')) }}
if: ${{ (github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'release' || github.event_name == 'workflow_call') || (github.event_name == 'workflow_dispatch' && (github.event.inputs.job_to_run == 'all' || github.event.inputs.job_to_run == 'build')) }}

env:
DISPLAY: ':99.0'
Expand All @@ -40,9 +41,9 @@ jobs:
python-version: ["3.9", "3.13"]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down Expand Up @@ -87,17 +88,48 @@ jobs:
- name: Test with pytest
run: pytest -v --tb=long

quality:
name: Quality (visualization and Pylint)
if: ${{ (github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'release' || github.event_name == 'workflow_call') || (github.event_name == 'workflow_dispatch' && (github.event.inputs.job_to_run == 'all' || github.event.inputs.job_to_run == 'quality')) }}
env:
DISPLAY: ':99.0'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v7
- name: Set up Python 3.13
uses: actions/setup-python@v7
with:
python-version: "3.13"
- name: Install quality dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 \
libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils
/sbin/start-stop-daemon --start --quiet \
--pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background \
--exec /usr/bin/Xvfb -- :99 -screen 0 1920x1200x24 -ac +extension GLX
python -m pip install --upgrade pip
python -m pip install -e ".[dev,test,qt]" matplotlib
- name: Verify PlotPy backend
run: python -c "import plotpy; print(f'PlotPy loaded from {plotpy.__file__}')"
- name: Test visualization backends
run: python -m pytest -o addopts="--import-mode=importlib" sigima/tests/viz -vv
- name: Lint with Pylint
run: python -m pylint sigima

build_latest:
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && (github.event.inputs.job_to_run == 'all' || github.event.inputs.job_to_run == 'build_latest')) }}
env:
DISPLAY: ':99.0'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Set up Python 3.13
uses: actions/setup-python@v5
uses: actions/setup-python@v7
with:
python-version: "3.13"

Expand Down
17 changes: 15 additions & 2 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@
max-line-length=88

[TYPECHECK]
ignored-modules=qtpy.QtWidgets,qtpy.QtCore,qtpy.QtGui,cv2,plotpy._scaler,skimage.restoration,skimage.feature
# NumPy's floating-point limits are populated dynamically.
ignored-classes=finfo
ignored-modules=qtpy.QtWidgets,qtpy.QtCore,qtpy.QtGui,cv2,plotpy._scaler,scipy.special,skimage.draw,skimage.restoration,skimage.feature

[MESSAGES CONTROL]
disable=wrong-import-order
# Ruff owns import ordering. The remaining exclusions reflect accepted complexity in
# numerical algorithms, compatibility layers, and parallel object APIs.
disable=duplicate-code,
fixme,
too-many-arguments,
too-many-branches,
too-many-instance-attributes,
too-many-lines,
too-many-locals,
too-many-public-methods,
too-many-statements,
wrong-import-order

[DESIGN]
max-args=10 # default: 5
Expand Down
9 changes: 0 additions & 9 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,6 @@
"-m",
"pylint",
"sigima",
"--disable=duplicate-code",
"--disable=fixme",
"--disable=too-many-arguments",
"--disable=too-many-branches",
"--disable=too-many-instance-attributes",
"--disable=too-many-lines",
"--disable=too-many-locals",
"--disable=too-many-public-methods",
"--disable=too-many-statements",
],
"options": {
"cwd": "${workspaceFolder}",
Expand Down
61 changes: 52 additions & 9 deletions doc/contributing/gitworkflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,36 @@ This naming convention improves clarity by clearly separating
documentation efforts from code-related development (features, fixes, etc.).


Commit Message Convention
-------------------------

New commits and pull request titles should follow the `Conventional Commits
<https://www.conventionalcommits.org/>`_ format::

<type>[optional scope]: <description>

Use the type that best describes the change:

- ``feat`` for a new capability;
- ``fix`` for a bug fix;
- ``test`` for test-only changes;
- ``docs`` for documentation;
- ``ci`` for continuous-integration configuration;
- ``refactor`` for a behavior-preserving code change;
- ``chore`` for maintenance work not covered above.

For example::

fix(roi): preserve inverse ROI rendering
test(viz): cover PlotPy ROI coordinates
ci: add Pylint quality gate

Merge commits and annotated release tags are exceptions: keep their explicit Git
messages, such as ``Merge branch 'feature/feature_name'`` and
``Release version 1.2.0``. Do not rewrite published history solely to change old
messages.


Workflow for New Features
-------------------------

Expand All @@ -95,7 +125,7 @@ Workflow for New Features
.. code-block:: sh

git checkout develop
git checkout -b develop/feature_name
git checkout -b feature/feature_name

2. Develop the feature and commit changes.

Expand All @@ -104,13 +134,13 @@ Workflow for New Features
.. code-block:: sh

git checkout develop
git merge --no-ff develop/feature_name
git merge --no-ff feature/feature_name

4. Delete the feature branch:

.. code-block:: sh

git branch -d develop/feature_name
git branch -d feature/feature_name

.. warning::

Expand Down Expand Up @@ -170,13 +200,13 @@ For current maintenance release (target: ``release``):

.. warning::

Do not create a ``fix/xxx`` branch from a ``develop/feature_name`` branch.
Do not create a ``fix/xxx`` branch from a ``feature/feature_name`` branch.
Always branch from ``develop`` or ``release`` to ensure fixes are correctly propagated.

.. code-block:: sh

# Incorrect:
git checkout develop/feature_name
git checkout feature/feature_name
git checkout -b fix/wrong_branch

.. code-block:: sh
Expand Down Expand Up @@ -264,14 +294,27 @@ When ready to release a new minor or major version (e.g., 1.1.0, 2.0.0):
git tag -a v1.1.0 -m "Release version 1.1.0"
git push origin main --tags

3. Delete the old ``release`` branch (if exists):
3. Fast-forward ``develop`` to the released ``main`` commit:

.. code-block:: sh

git checkout develop
git merge --ff-only main
git push origin develop

This makes the release merge commit, its conflict resolutions, and the tag
reachable from ``develop`` without creating a redundant merge commit. If the
fast-forward fails, stop and reconcile ``main`` and ``develop`` through a
reviewed merge; never rebase or force-push either shared branch.

4. Delete the old ``release`` branch (if exists):

.. code-block:: sh

git branch -d release
git push origin --delete release

4. Create a new ``release`` branch from ``main`` when the first patch for 1.1.1 is needed:
5. Create a new ``release`` branch from ``main`` when the first patch for 1.1.1 is needed:

.. code-block:: sh

Expand All @@ -286,8 +329,8 @@ Best Practices

.. code-block:: sh

git checkout develop/feature_name
git rebase develop
git checkout feature/feature_name
git rebase develop

- Avoid long-lived branches to minimize merge conflicts.

Expand Down
23 changes: 14 additions & 9 deletions doc/contributing/guidelines.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ We follow the `PEP 8 <https://www.python.org/dev/peps/pep-0008/>`_ coding style.

In particular, we are especially strict about the following guidelines:

- Limit all lines to a maximum of 79 characters.
- Limit all lines to a maximum of 88 characters.
- Respect the naming conventions (classes, functions, variables, etc.).
- Use specific exceptions instead of the generic :class:`Exception`.

Expand All @@ -23,26 +23,31 @@ ruff
^^^^

If you are using `Visual Studio Code <https://code.visualstudio.com/>`_,
the project settings will automatically format your code with `ruff` on save
(you may also run the task "Run Ruff" to run `ruff` on the project).
the project settings will automatically format your code with `ruff` on save.
You may also run the Ruff tasks on the project.

To run `ruff`, run the following command::
To format and check the code with `ruff`, run the following commands from the
repository root::

ruff check
python scripts/run_with_env.py python -m ruff format
python scripts/run_with_env.py python -m ruff check

pylint
^^^^^^

To run `pylint`, run the following command::
To run `pylint`, run the following command from the repository root::

pylint sigima
python scripts/run_with_env.py python -m pylint sigima

If you are using `Visual Studio Code <https://code.visualstudio.com/>`_
on Windows, you may run the task "Run Pylint" to run `pylint` on the project.
on Windows, you may run the "Pylint" task on the project. The enabled checks
and accepted exclusions are defined in the repository's ``.pylintrc`` file.

.. note::

A `pylint` rating greater than 9/10 is required to merge a pull request.
The Ruff and Pylint checks must both exit successfully before a pull request
may be merged. Pylint's numeric rating is informative only: the merge gate is
based on the absence of diagnostics from the enabled checks.

Specific coding guidelines
--------------------------
Expand Down
46 changes: 44 additions & 2 deletions doc/locale/fr/LC_MESSAGES/contributing/gitworkflow.po
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,42 @@ msgstr "``doc/user-guide``"
msgid "This naming convention improves clarity by clearly separating documentation efforts from code-related development (features, fixes, etc.)."
msgstr "Cette convention de nommage améliore la clarté en séparant clairement les efforts de documentation du développement lié au code (fonctionnalités, corrections, etc.)."

msgid "Commit Message Convention"
msgstr "Convention des messages de commit"

msgid "New commits and pull request titles should follow the `Conventional Commits <https://www.conventionalcommits.org/>`_ format::"
msgstr "Les nouveaux commits et les titres de demandes d'extraction doivent suivre le format `Conventional Commits <https://www.conventionalcommits.org/>`_::"

msgid "Use the type that best describes the change:"
msgstr "Utiliser le type qui décrit le mieux la modification :"

msgid "``feat`` for a new capability;"
msgstr "``feat`` pour une nouvelle fonctionnalité ;"

msgid "``fix`` for a bug fix;"
msgstr "``fix`` pour une correction d'anomalie ;"

msgid "``test`` for test-only changes;"
msgstr "``test`` pour des modifications concernant uniquement les tests ;"

msgid "``docs`` for documentation;"
msgstr "``docs`` pour la documentation ;"

msgid "``ci`` for continuous-integration configuration;"
msgstr "``ci`` pour la configuration de l'intégration continue ;"

msgid "``refactor`` for a behavior-preserving code change;"
msgstr "``refactor`` pour une modification de code qui préserve le comportement ;"

msgid "``chore`` for maintenance work not covered above."
msgstr "``chore`` pour les travaux de maintenance non couverts ci-dessus."

msgid "For example::"
msgstr "Par exemple::"

msgid "Merge commits and annotated release tags are exceptions: keep their explicit Git messages, such as ``Merge branch 'feature/feature_name'`` and ``Release version 1.2.0``. Do not rewrite published history solely to change old messages."
msgstr "Les commits de fusion et les tags de version annotés font exception : conserver leurs messages Git explicites, tels que ``Merge branch 'feature/feature_name'`` et ``Release version 1.2.0``. Ne pas réécrire l'historique publié uniquement pour modifier d'anciens messages."

msgid "Workflow for New Features"
msgstr "Workflow pour les nouvelles fonctionnalités"

Expand Down Expand Up @@ -159,8 +195,8 @@ msgstr "Créer une branche de correction d'anomalie à partir de ``release`` :"
msgid "Merge the fix branch back into ``release``:"
msgstr "Fusionner la branche de correction de nouveau dans ``release`` :"

msgid "Do not create a ``fix/xxx`` branch from a ``develop/feature_name`` branch. Always branch from ``develop`` or ``release`` to ensure fixes are correctly propagated."
msgstr "Ne pas créer une branche ``fix/xxx`` à partir d'une branche ``develop/feature_name``. Toujours créer une branche à partir de ``develop`` ou ``release`` pour garantir que les corrections sont correctement propagées."
msgid "Do not create a ``fix/xxx`` branch from a ``feature/feature_name`` branch. Always branch from ``develop`` or ``release`` to ensure fixes are correctly propagated."
msgstr "Ne pas créer une branche ``fix/xxx`` à partir d'une branche ``feature/feature_name``. Toujours créer une branche à partir de ``develop`` ou ``release`` pour garantir que les corrections sont correctement propagées."

msgid "Workflow for Critical Hotfixes"
msgstr "Workflow pour les correctifs urgents"
Expand Down Expand Up @@ -207,6 +243,12 @@ msgstr "Lorsque vous êtes prêt à publier une nouvelle version mineure ou maje
msgid "Merge ``develop`` into ``main``:"
msgstr "Fusionner ``develop`` dans ``main`` :"

msgid "Fast-forward ``develop`` to the released ``main`` commit:"
msgstr "Avancer ``develop`` en fast-forward jusqu'au commit publié de ``main`` :"

msgid "This makes the release merge commit, its conflict resolutions, and the tag reachable from ``develop`` without creating a redundant merge commit. If the fast-forward fails, stop and reconcile ``main`` and ``develop`` through a reviewed merge; never rebase or force-push either shared branch."
msgstr "Cette opération rend le commit de fusion de la version, ses résolutions de conflits et le tag accessibles depuis ``develop`` sans créer de commit de fusion redondant. Si le fast-forward échoue, arrêter l'opération et réconcilier ``main`` et ``develop`` au moyen d'une fusion revue ; ne jamais rebaser ni forcer la publication de l'une de ces branches partagées."

msgid "Delete the old ``release`` branch (if exists):"
msgstr "Supprimer l'ancienne branche ``release`` (si elle existe) :"

Expand Down
Loading