Skip to content

Commit f9ac37f

Browse files
authored
Merge branch 'PolusAI:master' into polus-apply-flatfield-plugin-branch
2 parents 3b5ad59 + 089cf7b commit f9ac37f

File tree

202 files changed

+6375
-3442
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+6375
-3442
lines changed

.github/workflows/package-release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
- name: Python | Setup
6565
uses: actions/setup-python@v5
6666
with:
67-
python-version: '3.9'
67+
python-version: '3.12'
6868
- name: Python | Install bump2version
6969
run: |
7070
python -m pip install --upgrade pip
@@ -132,7 +132,7 @@ jobs:
132132
- name: Python | Setup
133133
uses: actions/setup-python@v5
134134
with:
135-
python-version: '3.9'
135+
python-version: '3.12'
136136
- name: Python | Install bump2version
137137
run: |
138138
python -m pip install --upgrade pip

.github/workflows/package-tests.yml

Lines changed: 60 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,9 @@ name: Package tests
22

33
on:
44
pull_request:
5-
branches:
6-
- main
7-
- master
8-
- dev
5+
branches: [main, master, dev]
96
push:
10-
branches-ignore:
11-
- main
12-
- master
13-
- dev
7+
branches-ignore: [main, master, dev]
148
workflow_call:
159

1610
permissions:
@@ -33,26 +27,30 @@ jobs:
3327
matrix: ${{ fromJson(needs.package-filter.outputs.matrix) }}
3428
runs-on: ubuntu-latest
3529
steps:
36-
- name: Checkout
37-
uses: actions/checkout@v4
38-
- name: Set up Python
39-
uses: actions/setup-python@v5
30+
- uses: actions/checkout@v4
4031
with:
41-
python-version: '3.9'
42-
- name: Install Poetry
43-
uses: abatilo/actions-poetry@v2
44-
- name: Install pre-commit
45-
run: |
46-
pip install pre-commit
47-
- name: Run pre-commit hooks and check for changes
32+
fetch-depth: 0
33+
34+
- uses: actions/setup-python@v5
35+
with:
36+
python-version: '3.12'
37+
38+
- uses: astral-sh/setup-uv@v4
39+
40+
- name: Install and run pre-commit
4841
run: |
4942
cd "${{ matrix.package_dir }}"
43+
uv sync --all-extras
44+
uv run pre-commit run \
45+
--from-ref ${{ github.event.pull_request.base.sha || github.event.before }} \
46+
--to-ref ${{ github.event.pull_request.head.sha || github.sha }}
5047
51-
poetry run pre-commit run --files ./**/**
52-
if [[ $(git status --porcelain) ]]
53-
then
54-
echo "::error::pre-commit hooks failed for ${{ matrix.package_name }}" && exit 1
55-
fi
48+
- name: Show dirty files (if pre-commit failed)
49+
if: failure()
50+
run: |
51+
cd "${{ matrix.package_dir }}"
52+
git status --porcelain
53+
git diff
5654
5755
docker:
5856
name: Docker | Build ${{ matrix.package_name }}
@@ -63,92 +61,70 @@ jobs:
6361
matrix: ${{ fromJson(needs.package-filter.outputs.matrix) }}
6462
runs-on: ubuntu-latest
6563
steps:
66-
- name: Checkout
67-
uses: actions/checkout@v4
68-
- name: Check if Dockerfile exists
69-
id: check_dockerfile
64+
- uses: actions/checkout@v4
65+
66+
- uses: docker/setup-buildx-action@v3
67+
68+
- name: Docker | Build Image
7069
run: |
71-
if [ -f "${{ matrix.package_dir }}/Dockerfile" ]; then
72-
echo "Dockerfile exists"
73-
echo "dockerfile_exists=true" >> $GITHUB_ENV
74-
else
75-
echo "Dockerfile does not exist"
76-
echo "dockerfile_exists=false" >> $GITHUB_ENV
70+
if [ ! -f "${{ matrix.package_dir }}/Dockerfile" ]; then
71+
echo "No Dockerfile found, skipping"
72+
exit 0
7773
fi
78-
- name: Docker | Tag
79-
id: docker_tag
80-
if: env.dockerfile_exists == 'true'
81-
run: |
8274
version=$(cat ${{ matrix.package_dir }}/VERSION)
8375
tag=polusai/${{ matrix.package_name }}:${version}
84-
echo "tag will be ${tag}"
85-
echo "tag=${tag}" >> $GITHUB_OUTPUT
86-
- name: Docker | Setup Buildx
87-
uses: docker/setup-buildx-action@v3
88-
- name: Docker | Check if Image exists
89-
if: env.dockerfile_exists == 'true'
90-
run: |
91-
tag=${{ steps.docker_tag.outputs.tag }}
9276
docker pull ${tag} > /dev/null \
93-
&& $(echo "::error::${tag} already exists on DockerHub" && exit 1) \
94-
|| echo "success"
95-
- name: Docker | Build Image
96-
if: env.dockerfile_exists == 'true'
97-
run: |
77+
&& (echo "::error::${tag} already exists on DockerHub" && exit 1) \
78+
|| echo "Image does not exist, safe to build"
9879
cp .gitignore ${{ matrix.package_dir }}/.dockerignore
9980
cd "${{ matrix.package_dir }}"
10081
if [ -f "build-docker.sh" ]; then
10182
bash build-docker.sh
10283
else
103-
docker build . -t ${{ steps.docker_tag.outputs.tag }}
84+
docker build . -t ${tag}
10485
fi
105-
bash build-docker.sh
106-
# docker buildx build --platform linux/amd64,linux/arm64 -t ${tag} --push .
10786
10887
tests:
10988
name: Test | ${{ matrix.package_name }}
11089
needs: package-filter
90+
timeout-minutes: 30
11191
if: ${{ needs.package-filter.outputs.num_packages > 0 }}
11292
strategy:
11393
fail-fast: false
11494
matrix: ${{ fromJson(needs.package-filter.outputs.matrix) }}
11595
runs-on: ubuntu-latest
11696
steps:
117-
- name: Checkout
118-
uses: actions/checkout@v4
97+
- uses: actions/checkout@v4
11998
with:
12099
lfs: true
121-
- name: Set up Python
122-
uses: actions/setup-python@v5
100+
101+
- uses: actions/setup-python@v5
123102
with:
124-
python-version: '3.9'
125-
- name: Install Conda
103+
python-version: '3.12'
104+
105+
- name: Run tests with conda
106+
if: ${{ hashFiles(format('{0}/environment.yml', matrix.package_dir)) != '' }}
126107
uses: conda-incubator/setup-miniconda@v2
108+
127109
- name: Run tests with conda
110+
if: ${{ hashFiles(format('{0}/environment.yml', matrix.package_dir)) != '' }}
111+
shell: bash -l {0}
128112
run: |
129-
package_dir=${{ matrix.package_dir }}
130-
cd $package_dir
131-
if [ -f "environment.yml" ]; then
132-
conda init bash
133-
source ~/.bashrc
134-
conda env create -f environment.yml
135-
conda activate project_env
136-
pip install -e ".[all]"
137-
conda install pytest
138-
python -X faulthandler -m pytest -v -p no:faulthandler
139-
echo "conda_installed=true" >> $GITHUB_ENV
140-
else
141-
echo "conda_installed=false" >> $GITHUB_ENV
142-
fi
143-
- name: Install Poetry
144-
uses: abatilo/actions-poetry@v2
145-
- name: Run tests with poetry
146-
if: env.conda_installed == 'false'
147-
run: |
148-
poetry config virtualenvs.create false
113+
cd ${{ matrix.package_dir }}
114+
conda env create -f environment.yml
115+
conda activate project_env
116+
pip install -e ".[all]"
117+
conda install pytest -y
118+
python -X faulthandler -m pytest -v -p no:faulthandler
149119
150-
package_dir=${{ matrix.package_dir }}
151-
cd $package_dir
120+
- name: Run tests with uv
121+
if: ${{ hashFiles(format('{0}/environment.yml', matrix.package_dir)) == '' }}
122+
uses: astral-sh/setup-uv@v4
152123

153-
poetry install
154-
python -X faulthandler -m pytest -v -p no:faulthandler
124+
- name: Run tests with uv
125+
if: ${{ hashFiles(format('{0}/environment.yml', matrix.package_dir)) == '' }}
126+
run: |
127+
cd ${{ matrix.package_dir }}
128+
uv sync --all-extras || uv pip install -e ".[all]"
129+
uv pip install pytest
130+
uv run python -X faulthandler -m pytest -v -p no:faulthandler

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ ipython_config.py
104104
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
105105
poetry.lock
106106

107+
# uv
108+
uv.lock
109+
107110
# pdm
108111
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
109112
#pdm.lock
@@ -168,6 +171,11 @@ cython_debug/
168171
# test data directory
169172
data
170173

174+
# local manifests
175+
src/polus/plugins/_plugins/manifests/*
176+
# allow python scripts insied manifests dir
177+
!src/polus/plugins/_plugins/manifests/*.py
178+
uv.lock
171179

172180
#macOS
173181
*.DS_Store

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ repos:
3333
rev: "23.3.0"
3434
hooks:
3535
- id: black
36-
language_version: python3.9
36+
language_version: python3.12
3737
exclude: |
3838
(?x)(
3939
^src\/polus\/plugins\/_plugins\/models\/pydanticv1\/\w*Schema.py$|

formats/file-renaming-tool/.bumpversion.cfg

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.2.4
2+
current_version = 0.2.5-dev0
33
commit = True
44
tag = False
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<dev>\d+))?
@@ -22,6 +22,12 @@ replace = version = "{new_version}"
2222

2323
[bumpversion:file:plugin.json]
2424

25+
[bumpversion:file:FileRenaming.cwl]
26+
27+
[bumpversion:file:ict.yaml]
28+
2529
[bumpversion:file:VERSION]
2630

31+
[bumpversion:file:README.md]
32+
2733
[bumpversion:file:src/polus/images/formats/file_renaming/__init__.py]

formats/file-renaming-tool/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,13 @@
22
### Added
33
- Pytests to test this plugin
44
- Added a support for recursively searching for files within a directory and its subdirectories of specified pattern by passing value either raw or map for `mapDirectory` input argument.
5+
6+
## [0.2.4-dev2] - 2024-12-17
7+
### Added
8+
- Integrated filepattern in this tool
9+
- Modified the sorting dictionary letters key with respect to length
10+
11+
## [0.2.5-dev0] - 2026-03-04
12+
### Added
13+
- Updated dependencies and base container image
14+
- refactored code

formats/file-renaming-tool/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
FROM polusai/bfio:2.3.6
1+
FROM polusai/bfio:2.5.0
22

33
# environment variables defined in polusai/bfio
44
ENV EXEC_DIR="/opt/executables"
55
ENV POLUS_IMG_EXT=".ome.tif"
66
ENV POLUS_TAB_EXT=".csv"
77
ENV POLUS_LOG="INFO"
8+
ENV NUM_THREADS=8
89

910
# Work directory defined in the base container
1011
WORKDIR ${EXEC_DIR}

0 commit comments

Comments
 (0)