Developper guide#

Installation#

Create environment#

We recommend using conda

conda create -n ptrms python=3.12
conda activate ptrms

Install CiGas PTR-MS#

  1. Clone repository

    git clone git@gitlab.in2p3.fr:ipsl/sirta/ptr-ms/cigas-ptr-ms.git
    cd cigas-ptr-ms
    
  2. Install dependencies

    pip install .[dev,docs]
    
  3. Install pre-commits

    pre-commit install
    pre-commit install --hook-type commit-msg
    

Configuraing vscode#

Recommended extensions:

  • python

  • Mypy Type Checker

  • ruff

Commits#

Use the conventional commits format for your commit message. The documentation is availabe here.

Quality checks#

Ruff#

If you use vscode, you can use the ruff extension. The problems detected by ruff will be displayed.

Pre-commit#

Each time you commit, pre-commit will run the checks defined in .pre-commit-config.yaml. The pre-commit may change the files you are trying to commit. If it does, you will need to add the changes before you are able to commit.

Mypy#

The project is configure to use mypy to check types.

Running tests#

pytest

Development process#

  1. Create a new branch

    git switch -c feature/my_feature
    
  2. Write code

  3. Write tests

  4. Run the tests

  5. Update the documentation

  6. Commit changes

  7. Push branch

  8. Create a merge request of your branch to main

Documentation#

The documentation use sphinx with Myst parser. To view the documentation locally, run:

cd docs
sphinx-autobuild source build

Create a relase#

  1. On the main branch

  2. Make sure the tests pass

  3. Make sure your environment is clean

  4. Generate changelog

    generate-changelog
    
  5. Apply pre-commit to make format of the changelog compliant

    pre-commit run --all
    
  6. Bump the version

    bump-my-version bump [major|minor|patch]
    
  7. Push the changes

    git push origin main
    git push --tags