Skip to content

Commit

Permalink
fix: switch from setup.py to pyproject toml (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
tedil authored Jul 1, 2024
1 parent ebf2d24 commit 91b1e38
Show file tree
Hide file tree
Showing 236 changed files with 596 additions and 864 deletions.
15 changes: 6 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- name: Install dependencies
run: |
pip install -r requirements/test.txt
pip install -e ".[dev]"
pip freeze
- name: Run linting tools
Expand All @@ -52,17 +52,16 @@ jobs:
sphinx-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: |
pip install -r requirements/base.txt -r requirements/test.txt
pip install -e .
pip install -e ".[docs]"
pip freeze
- name: Build documentation
Expand All @@ -76,8 +75,6 @@ jobs:
matrix:
python-version:
- "3.12"
# - "3.11" # no compatible pysam yet
# - "3.12" # no compatible pysam yet
needs: linting
steps:
- name: Install Python via conda
Expand All @@ -86,7 +83,7 @@ jobs:
python-version: ${{ matrix.python-version }}
conda-channels: defaults,bioconda,conda-forge
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 2
Expand All @@ -107,7 +104,7 @@ jobs:
bcftools version
- name: Install some more dependencies via pip
# Workaround - see https://github.com/pytest-dev/pytest/issues/10420#issuecomment-1290697849
run: pip install -r requirements/test.txt; pip install --ignore-installed py
run: pip install ".[test]"; pip install --ignore-installed py
- name: Run tests
run: pytest
env:
Expand Down
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ repos:
- id: ruff
args: [ --fix ]
- id: ruff-format
- repo: https://github.com/snakemake/snakefmt
rev: v0.8.5 # https://github.com/snakemake/snakefmt/releases
hooks:
- id: snakefmt
25 changes: 6 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,19 @@ cd snappy-pipeline

# WARNING- make sure that you are in your conda base environment

# Create conda environment "snappy_env" with the minimal requirements:
mamba env create --file environment.yml
# Create conda environment "snappy_env" with all requirements:
mamba env create --file environment.yml -n snappy_env
conda activate snappy_env

# Add testing & development requirements:
pip install -r requirements/test.txt
pip install -r requirements/dev.txt

# Optionally add "pytest-pdb" missing from anaconda
pip install pytest-pdb

# Install snappy in snappy_env environment
pip install -e .
pip install -e ".[all]"
```

**Note:** To create the environment under another name, replace the commands for the environment creation & activation of the correct environment by:

```
mamba env create --file environment.yml --name <other_environment_name>
conda activate <other_environment_name>
```

The dependency group `all` includes all optional dependencies, i.e. `test` (for running tests with `pytest`), `dev` (for formatting, linting, pre-commit hooks) and `docs` (for building the documentation with `sphinx`).
If you only want to install the core dependencies, you can omit the `[all]` part, or choose any combination of the other groups.

See [user installation](docs/quickstart.rst) if you just want to use the pipeline.

See [developer installation)[docs/installation.rst) for getting started with working on the pipeline code and also building the documentation.
See [developer installation](docs/installation.rst) for getting started with working on the pipeline code and also building the documentation.

## Using GATK3

Expand Down
14 changes: 8 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'snappy-pipeline'
project = "snappy-pipeline"
copyright = "2015-2024, CUBI, Berlin Institute of Health"
author = 'CUBI, Berlin Institute of Health'
author = "CUBI, Berlin Institute of Health"

# Get the project root dir, which is the parent dir of this
import os, sys

cwd = os.getcwd()
project_root = os.path.dirname(cwd)

Expand All @@ -21,6 +22,7 @@
sys.path.insert(0, project_root)

import snappy_pipeline

# The short X.Y version.
version = snappy_pipeline.__version__
# The full version, including alpha/beta/rc tags.
Expand All @@ -35,8 +37,8 @@
"sphinx_mdinclude",
]

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', "step/DEFAULT_CONFIG_*.rst"]
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "step/DEFAULT_CONFIG_*.rst"]
source_suffix = ".rst"
master_doc = "index"

Expand Down Expand Up @@ -73,8 +75,8 @@

# html_theme = 'alabaster'
pygments_style = "sphinx"
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]
# Output file base name for HTML help builder.
htmlhelp_basename = "snappy_pipelinedoc"
html_last_updated_fmt = "%b %d, %Y"
Expand Down
29 changes: 21 additions & 8 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,34 +37,47 @@ You can of course clone the code anywhere you like.
$ cd ~/Development/pipeline_dev
$ git clone [email protected]:bihealth/snappy-pipeline.git
$ cd snappy_pipeline
$ pip install -e .
$ pip install -r requirements/dev.txt
$ conda env create -n snappy_dev --file environment.yaml
$ conda activate snappy_dev
$ pip install -e ".[all]"
It's also a good idea to install some packages required for testing through conda:
Installing pre-commit-hooks
===========================
To make it easier to follow the coding style, we use `pre-commit <https://pre-commit.com>`_ hooks.
These hooks will run the style checks before you commit your changes and will automatically fix some issues.

First, install the pre-commit package (if not already installed, part of the optional dependency group ``dev``):

.. code-block:: shell
$ conda install pre-commit # or pip install pre-commit
Then, install the pre-commit hooks:

.. code-block:: shell
$ conda env update --name root --file environment.yaml
$ pre-commit install
(If you do not do this, please make sure that you have git-lfs in your PATH through other means)
The next time you commit changes, the pre-commit hooks will run automatically.

Running the Tests
=================

To run the tests, you need to add the packages in ``requirements/test.txt``.
To run the tests, simply invoke ``pytest`` (part of the optional dependency group ``test``):

.. code-block:: shell
$ cd ~/Development/pipeline_dev
$ py.test
$ pytest
Running the Style Checks
========================

.. code-block:: shell
$ cd ~/Development/pipeline_dev
$ flake8
$ make lint
Developer Documentation
=======================
Expand Down
10 changes: 6 additions & 4 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ dependencies:
- pytest-mock ~=3.14.0
- pytest-subprocess ~=1.5.0
- pyfakefs ~=5.5.0
- ruff ~=0.4.8
- snakefmt ~=0.8.0
- pytest-sugar ~=0.9.6
- coveralls ~=4.0.1
# formatting, linting, dev
- ruff ~=0.4.8
- snakefmt ~=0.8.5
- pre-commit ~=3.7.1
# docs
- sphinx ~=7.3.7
- sphinx_rtd_theme ~=2.0.0
- sphinx-mdinclude ~=0.6.0

# misc packages
- pytest-sugar ~=0.9.6


- pip:
Expand Down
Loading

0 comments on commit 91b1e38

Please sign in to comment.