diff --git a/.github/workflows/conventional-prs.yml b/.github/workflows/conventional-prs.yml deleted file mode 100644 index 2a5b86f..0000000 --- a/.github/workflows/conventional-prs.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: PR -on: - pull_request_target: - types: - - opened - - reopened - - edited - - synchronize - -jobs: - title-format: - runs-on: ubuntu-latest - steps: - - uses: amannn/action-semantic-pull-request@v3.4.0 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - validateSingleCommit: true \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index a272261..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Tests - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - tests: - runs-on: ubuntu-latest - strategy: - max-parallel: 5 - - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.11 - uses: actions/setup-python@v2 - with: - python-version: 3.11 - - name: Add conda to system path - run: | - # $CONDA is an environment variable pointing to the root of the miniconda directory - echo $CONDA/bin >> $GITHUB_PATH - - name: Install dependencies - run: | - conda install -c conda-forge mamba - # - name: Lint with flake8 - # run: | - # mamba install flake8 - # # stop the build if there are Python syntax errors or undefined names - # flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - # flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Setup snakemake and workflow dependencies - run: | - mamba install -c conda-forge -c bioconda pytest snakemake singularity snakefmt - pip install . - - name: Lint with snakemake and snakefmt - run: | - snakemake --lint - snakefmt workflow - - name: Integration dry-run test - run: | - snakemake -np - - diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..9303d03 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,35 @@ +--- +name: Lint and test workflow +on: + push: + branches: ['*', '!push-action/*'] + pull_request: + branches: ['*', '!push-action/*'] +jobs: + quality: + name: Lint code + if: github.event.pull_request.merged == false + runs-on: ubuntu-latest + steps: + - name: Setup Python environment + uses: khanlab/actions/.github/actions/action-setup_task-installPyProject@v0.3.6 + with: + python-version: '3.11' + - name: snakemake lint + run: poetry run snakemake --lint + - name: snakefmt + run: poetry run snakefmt --check workflow + test: + runs-on: ubuntu-latest + needs: [quality] + strategy: + matrix: + python-version: ['3.11'] + steps: + - name: Setup Python environments + uses: khanlab/actions/.github/actions/action-setup_task-installPyProject@v0.3.6 + with: + python-version: ${{ matrix.python-version }} + install-library: true + - name: Integration dry-run test + run: poetry run snakemake -np diff --git a/poetry.lock b/poetry.lock index 35dd11a..6a9d7f3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -88,6 +88,51 @@ files = [ {file = "bids_validator-1.14.0-py3-none-any.whl", hash = "sha256:bab89f97a8d833235562cf0f3ac981bfca71acf2793a6c12a8af631c29ee0b8f"}, ] +[[package]] +name = "black" +version = "24.3.0" +description = "The uncompromising code formatter." +category = "dev" +optional = false +python-versions = ">=3.8" +files = [ + {file = "black-24.3.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:7d5e026f8da0322b5662fa7a8e752b3fa2dac1c1cbc213c3d7ff9bdd0ab12395"}, + {file = "black-24.3.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9f50ea1132e2189d8dff0115ab75b65590a3e97de1e143795adb4ce317934995"}, + {file = "black-24.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2af80566f43c85f5797365077fb64a393861a3730bd110971ab7a0c94e873e7"}, + {file = "black-24.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:4be5bb28e090456adfc1255e03967fb67ca846a03be7aadf6249096100ee32d0"}, + {file = "black-24.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4f1373a7808a8f135b774039f61d59e4be7eb56b2513d3d2f02a8b9365b8a8a9"}, + {file = "black-24.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:aadf7a02d947936ee418777e0247ea114f78aff0d0959461057cae8a04f20597"}, + {file = "black-24.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65c02e4ea2ae09d16314d30912a58ada9a5c4fdfedf9512d23326128ac08ac3d"}, + {file = "black-24.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:bf21b7b230718a5f08bd32d5e4f1db7fc8788345c8aea1d155fc17852b3410f5"}, + {file = "black-24.3.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:2818cf72dfd5d289e48f37ccfa08b460bf469e67fb7c4abb07edc2e9f16fb63f"}, + {file = "black-24.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:4acf672def7eb1725f41f38bf6bf425c8237248bb0804faa3965c036f7672d11"}, + {file = "black-24.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c7ed6668cbbfcd231fa0dc1b137d3e40c04c7f786e626b405c62bcd5db5857e4"}, + {file = "black-24.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:56f52cfbd3dabe2798d76dbdd299faa046a901041faf2cf33288bc4e6dae57b5"}, + {file = "black-24.3.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:79dcf34b33e38ed1b17434693763301d7ccbd1c5860674a8f871bd15139e7837"}, + {file = "black-24.3.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:e19cb1c6365fd6dc38a6eae2dcb691d7d83935c10215aef8e6c38edee3f77abd"}, + {file = "black-24.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:65b76c275e4c1c5ce6e9870911384bff5ca31ab63d19c76811cb1fb162678213"}, + {file = "black-24.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:b5991d523eee14756f3c8d5df5231550ae8993e2286b8014e2fdea7156ed0959"}, + {file = "black-24.3.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:c45f8dff244b3c431b36e3224b6be4a127c6aca780853574c00faf99258041eb"}, + {file = "black-24.3.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:6905238a754ceb7788a73f02b45637d820b2f5478b20fec82ea865e4f5d4d9f7"}, + {file = "black-24.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d7de8d330763c66663661a1ffd432274a2f92f07feeddd89ffd085b5744f85e7"}, + {file = "black-24.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:7bb041dca0d784697af4646d3b62ba4a6b028276ae878e53f6b4f74ddd6db99f"}, + {file = "black-24.3.0-py3-none-any.whl", hash = "sha256:41622020d7120e01d377f74249e677039d20e6344ff5851de8a10f11f513bf93"}, + {file = "black-24.3.0.tar.gz", hash = "sha256:a0c9c4a0771afc6919578cec71ce82a3e31e054904e7197deacbc9382671c41f"}, +] + +[package.dependencies] +click = ">=8.0.0" +mypy-extensions = ">=0.4.3" +packaging = ">=22.0" +pathspec = ">=0.9.0" +platformdirs = ">=2" + +[package.extras] +colorama = ["colorama (>=0.4.3)"] +d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"] +jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] +uvloop = ["uvloop (>=0.15.2)"] + [[package]] name = "boutiques" version = "0.5.26" @@ -820,6 +865,18 @@ files = [ {file = "more_itertools-10.2.0-py3-none-any.whl", hash = "sha256:686b06abe565edfab151cb8fd385a05651e1fdf8f0a14191e4439283421f8684"}, ] +[[package]] +name = "mypy-extensions" +version = "1.0.0" +description = "Type system extensions for programs checked with the mypy type checker." +category = "dev" +optional = false +python-versions = ">=3.5" +files = [ + {file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"}, + {file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"}, +] + [[package]] name = "nbformat" version = "5.9.2" @@ -985,7 +1042,7 @@ files = [ ] [package.dependencies] -numpy = {version = ">=1.26.0,<2", markers = "python_version >= \"3.12\""} +numpy = {version = ">=1.23.2,<2", markers = "python_version == \"3.11\""} python-dateutil = ">=2.8.2" pytz = ">=2020.1" tzdata = ">=2022.7" @@ -1921,7 +1978,6 @@ jinja2-time = ">=0.2.0" lazy-loader = ">=0.3" more-itertools = ">=8" numpy = {version = ">=1.23.2", markers = "python_version >= \"3.11\""} -pandas = {version = ">=2.1.1", markers = "python_version >= \"3.12\""} pvandyken-deprecated = "0.0.4" pybids = ">=0.16.0,<0.17" requests = ">=2.31.0" @@ -1933,6 +1989,23 @@ snakemake = [ ] typing-extensions = ">=3.10.0" +[[package]] +name = "snakefmt" +version = "0.10.0" +description = "The uncompromising Snakemake code formatter" +category = "dev" +optional = false +python-versions = ">=3.8.1,<4.0.0" +files = [ + {file = "snakefmt-0.10.0-py3-none-any.whl", hash = "sha256:23f73bcddb61d978af8b06fd148131c4599390bd7ea8ddaa8d62ab98bdec4f11"}, + {file = "snakefmt-0.10.0.tar.gz", hash = "sha256:53eae69fc81425e2192684eba76171bd648b05dcba93c9d5f45746d3fadb8617"}, +] + +[package.dependencies] +black = ">=24.1.1,<25.0.0" +click = ">=8.0.0,<9.0.0" +toml = ">=0.10.2,<0.11.0" + [[package]] name = "snakemake" version = "7.32.4" @@ -2120,6 +2193,18 @@ files = [ [package.extras] dev = ["aiohttp (>=3.8)", "codecov (>=2.1)", "flake8 (>=4.0)", "pytest (>=7.0)", "pytest-asyncio (>=0.16)", "pytest-cov (>=3.0)"] +[[package]] +name = "toml" +version = "0.10.2" +description = "Python Library for Tom's Obvious, Minimal Language" +category = "dev" +optional = false +python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" +files = [ + {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, + {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, +] + [[package]] name = "toposort" version = "1.10" @@ -2313,5 +2398,5 @@ pyyaml = ">=6.0,<7.0" [metadata] lock-version = "2.0" -python-versions = ">=3.11,<3.13" -content-hash = "889978799b554379e798abdfa76cb71f9ba18ed2002e698890f85dc74ebf239d" +python-versions = ">=3.11,<3.12" +content-hash = "788c23de2284f43514676c3ddec433aad3a9d41f8ed5e14082b832f3452d2ccc" diff --git a/pyproject.toml b/pyproject.toml index 6dd47b7..7e9a78b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,11 +7,14 @@ readme = "README.md" packages = [] [tool.poetry.dependencies] -python = ">=3.11,<3.13" +python = ">=3.11,<3.12" snakemake = "<8.0.0" pulp = "2.7.0" snakebids = "0.11.0" +[tool.poetry.group.dev.dependencies] +snakefmt = "^0.10.0" + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" diff --git a/workflow/rules/common.smk b/workflow/rules/common.smk index 7f2184d..0fccfe3 100644 --- a/workflow/rules/common.smk +++ b/workflow/rules/common.smk @@ -18,9 +18,9 @@ def get_all_targets(): subject=datasets.loc[i, "subject"], sample=datasets.loc[i, "sample"], acq=datasets.loc[i, "acq"], - extension="ome.zarr.zip" - if config["ome_zarr"]["use_zipstore"] - else "ome.zarr", + extension=( + "ome.zarr.zip" if config["ome_zarr"]["use_zipstore"] else "ome.zarr" + ), ) ) targets.extend(