-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Migrate to pyproject.toml (#241)
- the old setuptools setup.py is replaced by a pyproject.toml (e.g. for use with uv). - package layout is migrated to the src/ package layout - github workflows for linting and testing are updated - linting and formatting is now done via ruff (instead of flake + isort + black) - readthedocs setup has been adjusted for v2
- Loading branch information
Showing
114 changed files
with
2,474 additions
and
413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,10 @@ on: | |
pull_request: | ||
branches_ignore: [] | ||
|
||
defaults: | ||
run: | ||
shell: bash -el {0} | ||
|
||
jobs: | ||
cancel-previous: | ||
runs-on: ubuntu-latest | ||
|
@@ -20,18 +24,34 @@ jobs: | |
|
||
linting: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: | ||
- "3.12" | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
lfs: true | ||
|
||
- name: Install system dependencies | ||
run: sudo apt-get install -y libbz2-dev liblzma-dev | ||
|
||
- name: Setup environment variables | ||
run: echo "GIT_LFS_SKIP_SMUDGE=1" >> $GITHUB_ENV | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v2 | ||
- name: Setup conda | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
python-version: "3.10" | ||
channels: conda-forge,bioconda,nodefaults | ||
environment-file: 'environment.yaml' | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements/test_black.txt | ||
pip freeze | ||
- name: Set up Python | ||
run: uv python install ${{ matrix.python-version }} | ||
|
||
- name: Install the project | ||
run: uv sync --all-extras --dev | ||
|
||
- name: Run linting tools | ||
run: | | ||
|
@@ -41,51 +61,42 @@ jobs: | |
if: github.event_name == 'pull_request' && failure() | ||
uses: marocchino/[email protected] | ||
with: | ||
message: 'Please format your code with [black](https://black.readthedocs.io): `make black`.' | ||
message: 'Please check your code via `make lint`.' | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
testing: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: | ||
- '3.10' | ||
# - "3.11" # no compatible pysam yet | ||
# - "3.12" # no compatible pysam yet | ||
- "3.12" | ||
needs: linting | ||
steps: | ||
- name: Install Python via conda | ||
uses: s-weigand/setup-conda@v1 | ||
with: | ||
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 | ||
|
||
- name: Install mamba | ||
run: conda install -y mamba | ||
- name: Install system dependencies | ||
run: sudo apt-get install -y libbz2-dev liblzma-dev | ||
|
||
- name: Prepare environment.yaml file | ||
run: > | ||
cp environment.yaml /tmp/environment.yaml && sed -i -e | ||
's/- python/- python=${{ matrix.python-version }}/' | ||
/tmp/environment.yaml | ||
- name: Setup environment variables | ||
run: echo "GIT_LFS_SKIP_SMUDGE=1" >> $GITHUB_ENV | ||
|
||
- name: Update environment using mamba | ||
run: mamba env update --name root --file /tmp/environment.yaml | ||
- name: Setup conda | ||
uses: conda-incubator/setup-miniconda@v3 | ||
with: | ||
channels: conda-forge,bioconda,nodefaults | ||
environment-file: 'environment.yaml' | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Save time by installing packages via mamba. | ||
run: mamba install -y pysam | ||
- name: Set up Python | ||
run: uv python install ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements/test_black.txt | ||
pip freeze | ||
- name: Install the project | ||
run: uv sync --all-extras --dev | ||
|
||
- name: Run tests | ||
run: pytest | ||
run: uv run pytest | ||
|
||
- uses: codecov/codecov-action@v3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# .readthedocs.yaml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
# Required | ||
version: 2 | ||
|
||
# Set the version of Python and other tools you might need | ||
build: | ||
os: ubuntu-22.04 | ||
jobs: | ||
post_create_environment: | ||
- pip install uv | ||
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv pip install --upgrade pip setuptools | ||
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv pip install --upgrade sphinx readthedocs-sphinx-ext | ||
post_install: | ||
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv sync --all-extras --group docs | ||
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv pip install '.[all]' | ||
build: | ||
html: | ||
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH uv run sphinx-build --fail-on-warning --show-traceback --keep-going -D language=de docs_manual $READTHEDOCS_OUTPUT/html | ||
|
||
## Build documentation in the docs/ directory with Sphinx | ||
#sphinx: | ||
# configuration: docs_manual/conf.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,18 @@ | ||
.PHONY: all | ||
all: black | ||
all: lint format | ||
|
||
.PHONY: black | ||
black: | ||
black -l 100 . | ||
.PHONY: format | ||
format: | ||
uv run ruff format . | ||
|
||
.PHONY: black-check | ||
black-check: | ||
black -l 100 --check . | ||
|
||
.PHONY: isort | ||
isort: | ||
isort --force-sort-within-sections --profile=black . | ||
|
||
.PHONY: isort-check | ||
isort-check: | ||
isort --force-sort-within-sections --profile=black --check . | ||
|
||
.PHONY: flake8 | ||
flake8: | ||
flake8 | ||
|
||
# .PHONY: mypy | ||
# mypy: export MYPYPATH=stubs | ||
# mypy: | ||
# mypy clinvar_this clinvar_api tests | ||
.PHONY: format-check | ||
format-check: | ||
uv run ruff format --check . | ||
|
||
.PHONY: lint | ||
lint: flake8 isort-check black-check | ||
# lint: flake8 isort-check black-check mypy | ||
lint: | ||
uv run ruff check | ||
|
||
.PHONY: pytest | ||
pytest: | ||
pytest . | ||
uv run pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ Tooling for connecting GitLab, pipelines, and SODAR at CUBI. | |
Prerequisites when using conda: | ||
|
||
```bash | ||
$ conda create -n cubi-tk python=3.10 | ||
$ conda env create -n cubi-tk -f environment.yaml | ||
$ conda activate cubi-tk | ||
``` | ||
|
||
|
@@ -21,15 +21,18 @@ Clone CUBI-TK and install. | |
```bash | ||
$ git clone [email protected]:bihealth/cubi-tk.git | ||
$ cd cubi-tk | ||
$ pip install -e . | ||
$ uv sync | ||
$ uv pip install -e . | ||
# or, if you need snappy kickoff: | ||
#$ GIT_LFS_SKIP_SMUDGE=1 uv pip install -e '.[snappy]' | ||
``` | ||
|
||
## Building the Manual | ||
|
||
```bash | ||
$ pip install -r requirements/develop.txt | ||
$ uv sync --all-extras --group docs | ||
$ cd docs_manual | ||
$ make clean html | ||
$ uv run make clean html | ||
$ ls _build/html/index.html | ||
``` | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
- defaults | ||
- nodefaults | ||
|
||
name: cubi-tk | ||
|
||
dependencies: | ||
- python | ||
- python >=3.9 | ||
- pip | ||
- uv >=0.5 | ||
- hashdeep | ||
- pysam >=0.22 | ||
- vcfpy >=0.13.8 | ||
- gcc_linux-64 >=13,<14 | ||
- zlib ~=1.3.0 |
Oops, something went wrong.