Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove conda #294

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/actions/dependencies/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: PDM & Dependencies
description: Install PDM and dependencies
runs:
using: composite
steps:
- uses: ./.github/actions/pdm

- name: Install dependencies
shell: bash
# --only-keep flag in case the environment is restored from a stale cache.
run: |
pdm sync -d --only-keep
11 changes: 11 additions & 0 deletions .github/actions/pdm/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: PDM
description: Install PDM
runs:
using: composite
steps:
- name: Set up PDM
uses: pdm-project/setup-pdm@v4
with:
python-version: "3.9"
# Cache all dependencies installed from pdm.lock
cache: true
21 changes: 6 additions & 15 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,18 @@ jobs:
os: [ubuntu-latest]
steps:
- uses: actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: setup.py
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install .[all]
- uses: ./.github/actions/dependencies
- name: Pack test recipe
run: |
pack -r cellpack/tests/recipes/v2/test_spheres.json -c cellpack/tests/packing-configs/test_config.json
pdm run pack -r cellpack/tests/recipes/v2/test_spheres.json -c cellpack/tests/packing-configs/test_config.json
- name: Modify JSON with PR sub_directory path
run: |
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
mv cellpack/tests/analysis-configs/PR_analysis_config_temp.json cellpack/tests/analysis-configs/PR_analysis_config.json
- name: Run analysis code
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
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
- name: Upload results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: results
path: cellpack/tests/outputs/test_spheres/
Expand All @@ -59,10 +50,10 @@ jobs:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
- name: Copy files to results bucket
run: aws s3 cp ./results s3://cellpack-results/${{ github.ref_name }}/ --recursive --acl public-read
- uses: iterative/setup-cml@v1
- uses: iterative/setup-cml@v2
- name: Update comment for dependabot
if: ${{ github.actor == 'dependabot[bot]' }}
env:
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,7 @@ jobs:
- uses: actions/[email protected]
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: "pip"
cache-dependency-path: setup.py
- name: Install Dependencies
run: |
pip install --upgrade pip
pip install .[dev]
- uses: ./.github/actions/dependencies
- name: Generate Docs
run: |
make gen-docs
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/cache-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# The purpose of this workflow is to get more cache hits when other workflows build dependencies.
# Github actions do not share caches between branches, except that all branches can pull results
# from the default (main) branch. Therefore, this workflow runs on the main branch to keep the
# latest dependencies cached for other branches to use.
# Branches that change the dependencies will still get cache misses.
name: Build and cache dependencies on main

on:
push:
branches:
- main

jobs:
dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/dependencies
44 changes: 7 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,10 @@ jobs:

steps:
- uses: actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: setup.py
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install .[all]
- uses: ./.github/actions/dependencies
- name: Test with pytest
run: |
pytest --cov cellpack/tests/
pdm run pytest --cov cellpack/tests/
- name: Upload codecov
uses: codecov/codecov-action@v4

Expand All @@ -52,22 +43,13 @@ jobs:
if: ${{ !contains(github.event.head_commit.message, 'Bump version') }}
steps:
- uses: actions/[email protected]
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: "pip"
cache-dependency-path: setup.py
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install .[test]
- uses: ./.github/actions/dependencies
- name: Lint with flake8
run: |
flake8 cellpack --count --verbose --show-source --statistics --ignore=E501,E277,W503,E203
pdm run flake8 cellpack --count --verbose --show-source --statistics --ignore=E501,E277,W503,E203
- name: Check with black
run: |
black --check cellpack
pdm run black --check cellpack

publish:
if: success() && startsWith(github.ref, 'refs/tags/')
Expand All @@ -81,19 +63,7 @@ jobs:

steps:
- uses: actions/[email protected]
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: "pip"
cache-dependency-path: setup.py
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Build Package
run: |
python setup.py sdist bdist_wheel
- uses: ./.github/actions/dependencies
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
run: pdm publish

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: cleanup
name: Cleanup AWS S3 Bucket

on:
pull_request:
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/cleanup-firebase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,10 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- uses: actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[all]
- uses: ./.github/actions/dependencies
- name: Cleanup Firebase Metadata
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
FIREBASE_EMAIL: ${{ secrets.FIREBASE_EMAIL }}
run: |
python cellpack/bin/cleanup_tasks.py
pdm run python cellpack/bin/cleanup_tasks.py
105 changes: 105 additions & 0 deletions .github/workflows/make-requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Make requirements files

on:
workflow_dispatch:
push:
branches:
- main
paths:
- "pdm.lock"

jobs:
make-requirements:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/pdm

- name: Generate requirements.txt
shell: bash
run: |
case "${{ matrix.os }}" in
"ubuntu-latest")
export PLATFORM="linux"
;;
"macOS-latest")
export PLATFORM="macos"
;;
"windows-latest")
export PLATFORM="windows"
;;
esac

rm -rf requirements/*
mkdir -p requirements/$PLATFORM
pdm requirements requirements/$PLATFORM/requirements.txt

- name: Get platform variable
id: platform
shell: bash
run: |
case "${{ matrix.os }}" in
"ubuntu-latest")
echo "::set-output name=platform::linux"
;;
"macOS-latest")
echo "::set-output name=platform::macos"
;;
"windows-latest")
echo "::set-output name=platform::windows"
;;
esac

- name: Upload requirements files
uses: actions/upload-artifact@v4
with:
name: ${{ steps.platform.outputs.platform }}-requirements
path: requirements/${{ steps.platform.outputs.platform }}

open-PR:
needs: [make-requirements]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download linux requirements files
uses: actions/download-artifact@v4
with:
name: linux-requirements
path: requirements/linux

- name: Download windows requirements files
uses: actions/download-artifact@v4
with:
name: windows-requirements
path: requirements/windows

- name: Download macOS requirements files
uses: actions/download-artifact@v4
with:
name: macos-requirements
path: requirements/macos

- name: Clean-up CRLF
shell: bash
run: find requirements -type f -exec sed -i 's/\r//g' {} \;

- name: Get timestamp
id: timestamp
run: echo "::set-output name=timestamp::$(date +'%Y-%m-%d_%H-%M')"

- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
base: main
title: admin/requirements-update_${{ steps.timestamp.outputs.timestamp }}
body: Updating requirements.txt.

Due to some [challenges](https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs),
with getting this PR to trigger the tests, please manually close and re-open this PR.
branch: admin/requirements-update_${{ steps.timestamp.outputs.timestamp }}
commit-message: Updating requirements.txt after change to `pdm.lock` was pushed to `main`
delete-branch: true
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ target/
.ipynb_checkpoints
*.ipynb

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

Expand Down Expand Up @@ -122,4 +119,7 @@ data/
**/converted/*

# credentials
.creds
.creds

# pdm files
.pdm-python
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ Ready to contribute? Here's how to set up `cellpack` for local development.
git clone [email protected]:{your_name_here}/cellpack.git
```

3. Install the project in editable mode. (It is also recommended to work in a virtualenv or anaconda environment):
3. Install the project in editable mode by following installation instructions [here](docs/INSTALL.md). (It is also recommended to work in a virtual environment):

```bash
cd cellpack/
pip install -r requirements/linux/requirements.txt
pip install -e .[dev]
```

Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ clean: ## clean all build, python, and testing files
rm -fr build/
rm -fr dist/
rm -fr .eggs/
rm -fr .tox/
rm -fr .coverage
rm -fr coverage.xml
rm -fr htmlcov/
rm -fr .pytest_cache
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +
find . -name '*.py.bak' -exec rm -f {} +
rm -fr .tox/
rm -fr .coverage
rm -fr coverage.xml
rm -fr htmlcov/
rm -fr .pytest_cache

build: ## run tox / run tests and lint
tox
Expand Down
Loading
Loading