Skip to content

Commit 22053fb

Browse files
authored
Remove conda (#294)
* Update README.md * Remove setup.py and setup.cfg * Add configuration files for pdm * Update .gitignore * Add requirements files * Update installation instructions to remove conda * Update README.md * Rename cleanup workflow for clarity * Update installation instructions in CONTRIBUTING.md * Refactor tox.ini: Update env_list and groups * Add PDM and Dependencies actions Update build-docs workflow Add cache-dependencies workflow Update cleanup-firebase workflow Update ci workflow Update analyze workflow Update analyze workflow * Update pyproject.toml dependencies and add pdm lock file * Update requirements files * Update dependency installation script * Activate environment after installing dependencies * Run workflows through pdm * Remove venv activation specific to linux * Update cml setup version * Update black version * Formatting changes * * Add command "clean" to pyproject.toml * Update makefile to move cleanup * Specify base python in tox.ini * Refactor tox.ini to add 'test' and 'lint' groups * Add Flake8 configuration to pyproject.toml for linting * Update dependencies and migrate from tox.ini to pyproject.toml * Update version bump command in CONTRIBUTING.md to use bumpver * bump version 1.0.8 -> 1.1.0 * Update flake8 ignore rules in CI workflow * bump version 1.1.0 -> 1.1.1 * Update docutils version and adjust Python requirements in lock files * Update version format to include 'v' prefix in __init__.py and pyproject.toml * Bump version to v1.1.1 This version includes performance improvements, bug fixes, and installation updates
1 parent ecb33a2 commit 22053fb

28 files changed

+4059
-294
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: PDM & Dependencies
2+
description: Install PDM and dependencies
3+
runs:
4+
using: composite
5+
steps:
6+
- uses: ./.github/actions/pdm
7+
8+
- name: Install dependencies
9+
shell: bash
10+
# --only-keep flag in case the environment is restored from a stale cache.
11+
run: |
12+
pdm sync -d --only-keep

.github/actions/pdm/action.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: PDM
2+
description: Install PDM
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Set up PDM
7+
uses: pdm-project/setup-pdm@v4
8+
with:
9+
python-version: "3.9"
10+
# Cache all dependencies installed from pdm.lock
11+
cache: true

.github/workflows/analyze.yml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,18 @@ jobs:
1616
os: [ubuntu-latest]
1717
steps:
1818
- uses: actions/[email protected]
19-
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v5
21-
with:
22-
python-version: ${{ matrix.python-version }}
23-
cache: "pip"
24-
cache-dependency-path: setup.py
25-
- name: Install Dependencies
26-
run: |
27-
python -m pip install --upgrade pip
28-
pip install .[all]
19+
- uses: ./.github/actions/dependencies
2920
- name: Pack test recipe
3021
run: |
31-
pack -r cellpack/tests/recipes/v2/test_spheres.json -c cellpack/tests/packing-configs/test_config.json
22+
pdm run pack -r cellpack/tests/recipes/v2/test_spheres.json -c cellpack/tests/packing-configs/test_config.json
3223
- name: Modify JSON with PR sub_directory path
3324
run: |
3425
jq --arg branch_name "${{ github.ref_name }}" '.create_report.output_image_location |= "https://cellpack-results.s3.us-west-2.amazonaws.com/\($branch_name)/spheresSST/figures"' cellpack/tests/analysis-configs/PR_analysis_config.json > cellpack/tests/analysis-configs/PR_analysis_config_temp.json
3526
mv cellpack/tests/analysis-configs/PR_analysis_config_temp.json cellpack/tests/analysis-configs/PR_analysis_config.json
3627
- name: Run analysis code
37-
run: analyze -r cellpack/tests/recipes/v2/test_spheres.json -a cellpack/tests/analysis-configs/PR_analysis_config.json -p cellpack/tests/outputs/test_spheres/spheresSST
28+
run: pdm run analyze -r cellpack/tests/recipes/v2/test_spheres.json -a cellpack/tests/analysis-configs/PR_analysis_config.json -p cellpack/tests/outputs/test_spheres/spheresSST
3829
- name: Upload results
39-
uses: actions/upload-artifact@v3
30+
uses: actions/upload-artifact@v4
4031
with:
4132
name: results
4233
path: cellpack/tests/outputs/test_spheres/
@@ -59,10 +50,10 @@ jobs:
5950
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
6051
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
6152
aws-region: us-west-2
62-
- uses: actions/download-artifact@v3
53+
- uses: actions/download-artifact@v4
6354
- name: Copy files to results bucket
6455
run: aws s3 cp ./results s3://cellpack-results/${{ github.ref_name }}/ --recursive --acl public-read
65-
- uses: iterative/setup-cml@v1
56+
- uses: iterative/setup-cml@v2
6657
- name: Update comment for dependabot
6758
if: ${{ github.actor == 'dependabot[bot]' }}
6859
env:

.github/workflows/build-docs.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,7 @@ jobs:
1313
- uses: actions/[email protected]
1414
with:
1515
persist-credentials: false
16-
- name: Set up Python
17-
uses: actions/setup-python@v5
18-
with:
19-
python-version: 3.9
20-
cache: "pip"
21-
cache-dependency-path: setup.py
22-
- name: Install Dependencies
23-
run: |
24-
pip install --upgrade pip
25-
pip install .[dev]
16+
- uses: ./.github/actions/dependencies
2617
- name: Generate Docs
2718
run: |
2819
make gen-docs
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# The purpose of this workflow is to get more cache hits when other workflows build dependencies.
2+
# Github actions do not share caches between branches, except that all branches can pull results
3+
# from the default (main) branch. Therefore, this workflow runs on the main branch to keep the
4+
# latest dependencies cached for other branches to use.
5+
# Branches that change the dependencies will still get cache misses.
6+
name: Build and cache dependencies on main
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
13+
jobs:
14+
dependencies:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: ./.github/actions/dependencies

.github/workflows/ci.yml

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,10 @@ jobs:
3131

3232
steps:
3333
- uses: actions/[email protected]
34-
- name: Set up Python ${{ matrix.python-version }}
35-
uses: actions/setup-python@v5
36-
with:
37-
python-version: ${{ matrix.python-version }}
38-
cache: "pip"
39-
cache-dependency-path: setup.py
40-
- name: Install Dependencies
41-
run: |
42-
python -m pip install --upgrade pip
43-
pip install .[all]
34+
- uses: ./.github/actions/dependencies
4435
- name: Test with pytest
4536
run: |
46-
pytest --cov cellpack/tests/
37+
pdm run pytest --cov cellpack/tests/
4738
- name: Upload codecov
4839
uses: codecov/codecov-action@v4
4940

@@ -52,22 +43,13 @@ jobs:
5243
if: ${{ !contains(github.event.head_commit.message, 'Bump version') }}
5344
steps:
5445
- uses: actions/[email protected]
55-
- name: Set up Python
56-
uses: actions/setup-python@v5
57-
with:
58-
python-version: 3.9
59-
cache: "pip"
60-
cache-dependency-path: setup.py
61-
- name: Install Dependencies
62-
run: |
63-
python -m pip install --upgrade pip
64-
pip install .[test]
46+
- uses: ./.github/actions/dependencies
6547
- name: Lint with flake8
6648
run: |
67-
flake8 cellpack --count --verbose --show-source --statistics --ignore=E501,E277,W503,E203
49+
pdm run flake8 cellpack --count --verbose --show-source --statistics --ignore=E203,E277,E402,E501,E721,W291,W503
6850
- name: Check with black
6951
run: |
70-
black --check cellpack
52+
pdm run black --check cellpack
7153
7254
publish:
7355
if: success() && startsWith(github.ref, 'refs/tags/')
@@ -81,19 +63,7 @@ jobs:
8163

8264
steps:
8365
- uses: actions/[email protected]
84-
- name: Set up Python
85-
uses: actions/setup-python@v5
86-
with:
87-
python-version: 3.9
88-
cache: "pip"
89-
cache-dependency-path: setup.py
90-
- name: Install Dependencies
91-
run: |
92-
python -m pip install --upgrade pip
93-
pip install setuptools wheel
94-
- name: Build Package
95-
run: |
96-
python setup.py sdist bdist_wheel
66+
- uses: ./.github/actions/dependencies
9767
- name: Publish to PyPI
98-
uses: pypa/gh-action-pypi-publish@release/v1
68+
run: pdm publish
9969

.github/workflows/cleanup.yml renamed to .github/workflows/cleanup-aws.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: cleanup
1+
name: Cleanup AWS S3 Bucket
22

33
on:
44
pull_request:

.github/workflows/cleanup-firebase.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,10 @@ jobs:
1313
os: [ubuntu-latest, windows-latest, macOS-latest]
1414
steps:
1515
- uses: actions/[email protected]
16-
- name: Set up Python ${{ matrix.python-version }}
17-
uses: actions/setup-python@v5
18-
with:
19-
python-version: ${{ matrix.python-version }}
20-
- name: Install dependencies
21-
run: |
22-
python -m pip install --upgrade pip
23-
pip install .[all]
16+
- uses: ./.github/actions/dependencies
2417
- name: Cleanup Firebase Metadata
2518
env:
2619
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
2720
FIREBASE_EMAIL: ${{ secrets.FIREBASE_EMAIL }}
2821
run: |
29-
python cellpack/bin/cleanup_tasks.py
22+
pdm run python cellpack/bin/cleanup_tasks.py
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Make requirements files
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- "pdm.lock"
10+
11+
jobs:
12+
make-requirements:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-latest, macOS-latest, windows-latest]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: ./.github/actions/pdm
21+
22+
- name: Generate requirements.txt
23+
shell: bash
24+
run: |
25+
case "${{ matrix.os }}" in
26+
"ubuntu-latest")
27+
export PLATFORM="linux"
28+
;;
29+
"macOS-latest")
30+
export PLATFORM="macos"
31+
;;
32+
"windows-latest")
33+
export PLATFORM="windows"
34+
;;
35+
esac
36+
37+
rm -rf requirements/*
38+
mkdir -p requirements/$PLATFORM
39+
pdm requirements requirements/$PLATFORM/requirements.txt
40+
41+
- name: Get platform variable
42+
id: platform
43+
shell: bash
44+
run: |
45+
case "${{ matrix.os }}" in
46+
"ubuntu-latest")
47+
echo "::set-output name=platform::linux"
48+
;;
49+
"macOS-latest")
50+
echo "::set-output name=platform::macos"
51+
;;
52+
"windows-latest")
53+
echo "::set-output name=platform::windows"
54+
;;
55+
esac
56+
57+
- name: Upload requirements files
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: ${{ steps.platform.outputs.platform }}-requirements
61+
path: requirements/${{ steps.platform.outputs.platform }}
62+
63+
open-PR:
64+
needs: [make-requirements]
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v4
68+
- name: Download linux requirements files
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: linux-requirements
72+
path: requirements/linux
73+
74+
- name: Download windows requirements files
75+
uses: actions/download-artifact@v4
76+
with:
77+
name: windows-requirements
78+
path: requirements/windows
79+
80+
- name: Download macOS requirements files
81+
uses: actions/download-artifact@v4
82+
with:
83+
name: macos-requirements
84+
path: requirements/macos
85+
86+
- name: Clean-up CRLF
87+
shell: bash
88+
run: find requirements -type f -exec sed -i 's/\r//g' {} \;
89+
90+
- name: Get timestamp
91+
id: timestamp
92+
run: echo "::set-output name=timestamp::$(date +'%Y-%m-%d_%H-%M')"
93+
94+
- name: Create Pull Request
95+
uses: peter-evans/create-pull-request@v5
96+
with:
97+
base: main
98+
title: admin/requirements-update_${{ steps.timestamp.outputs.timestamp }}
99+
body: Updating requirements.txt.
100+
101+
Due to some [challenges](https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs),
102+
with getting this PR to trigger the tests, please manually close and re-open this PR.
103+
branch: admin/requirements-update_${{ steps.timestamp.outputs.timestamp }}
104+
commit-message: Updating requirements.txt after change to `pdm.lock` was pushed to `main`
105+
delete-branch: true

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ target/
7474
.ipynb_checkpoints
7575
*.ipynb
7676

77-
# pyenv
78-
.python-version
79-
8077
# celery beat schedule file
8178
celerybeat-schedule
8279

@@ -122,4 +119,7 @@ data/
122119
**/converted/*
123120

124121
# credentials
125-
.creds
122+
.creds
123+
124+
# pdm files
125+
.pdm-python

0 commit comments

Comments
 (0)