Skip to content
Closed
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
64 changes: 32 additions & 32 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bookworm",
"customizations": {
"codespaces": {
"openFiles": [
"README.md",
"streamlit_app.py"
]
},
"vscode": {
"settings": {},
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
]
}
},
"updateContentCommand": "[ -f packages.txt ] && sudo apt update && sudo apt upgrade -y && sudo xargs apt install -y <packages.txt; [ -f requirements.txt ] && pip3 install --user -r requirements.txt; pip3 install --user streamlit; echo '✅ Packages installed and Requirements met'",
"postAttachCommand": {
"server": "streamlit run streamlit_app.py --server.enableCORS false --server.enableXsrfProtection false"
},
"portsAttributes": {
"8501": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [
8501
]
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bookworm",
"customizations": {
"codespaces": {
"openFiles": [
"README.md",
"streamlit_app.py"
]
},
"vscode": {
"settings": {},
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
]
}
},
"updateContentCommand": "[ -f packages.txt ] && sudo apt update && sudo apt upgrade -y && sudo xargs apt install -y <packages.txt; [ -f requirements.txt ] && pip3 install --user -r requirements.txt; pip3 install --user streamlit; echo '✅ Packages installed and Requirements met'",
"postAttachCommand": {
"server": "streamlit run streamlit_app.py --server.enableCORS false --server.enableXsrfProtection false"
},
"portsAttributes": {
"8501": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [
8501
]
}
44 changes: 44 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# VCS
.git
.gitignore
.github/

# Python cache/bytecode
__pycache__/
*.py[cod]
*$py.class

# Build/packaging artifacts
build/
dist/
*.egg-info/
.eggs/

# Test and coverage artifacts
.pytest_cache/
.coverage
coverage.xml
htmlcov/
.mypy_cache/
.ruff_cache/

# Virtual environments
.venv/
venv/
env/

# Local editor/tooling
.vscode/
.idea/
.DS_Store

# Local data and outputs
tmp/
out/
results/
results_cache/
*.zip

# Optional: keep large or generated content out of image context
Data/
fibermorph/test_data/
2 changes: 2 additions & 0 deletions .github/workflows/conventional-prs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: PR

on:
pull_request_target:
types:
Expand All @@ -12,5 +13,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v3.4.0
continue-on-error: true # advisory in fork; lasisilab enforces this on the upstream PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148 changes: 74 additions & 74 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
name: Release

# release on push version tag, e.g. v0.3.2
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:

permissions:
contents: write
id-token: write

env:
PYTHON_VERSION: 3.11

jobs:
build:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/fibermorph/
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install Poetry
run: python -m pip install --upgrade pip poetry

- name: Install build tools
run: python -m pip install build twine

- name: Check if tag matches the package version
run: |
PKG_VERSION=$(poetry version -s)
TAG=${GITHUB_REF#refs/tags/}
if [[ "v$PKG_VERSION" != "$TAG" ]]; then
echo "Error: Tag ($TAG) does not match the package version (v$PKG_VERSION)."
exit 1
fi

- name: Build sdist and universal wheel
run: python -m build --sdist --wheel --outdir dist

- uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
artifacts: "dist/*"
allowUpdates: true
updateOnlyUnreleased: false

- name: Check if version already exists on PyPI
id: pypi_check
run: |
PKG_VERSION=$(poetry version -s)
PKG_NAME=$(poetry version | awk '{print $1}')
if curl -sSf https://pypi.org/pypi/$PKG_NAME/json | grep -q "\"$PKG_VERSION\""; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Version $PKG_VERSION already exists on PyPI. Will skip publish."
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Version $PKG_VERSION does not exist on PyPI. Will publish."
fi

- name: Publish to PyPI via Trusted Publishing
if: steps.pypi_check.outputs.exists == 'false'
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
skip-existing: true
name: Release
# release on push version tag, e.g. v0.3.2
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
permissions:
contents: write
id-token: write
env:
PYTHON_VERSION: 3.11
jobs:
build:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/fibermorph/
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Poetry
run: python -m pip install --upgrade pip poetry
- name: Install build tools
run: python -m pip install build twine
- name: Check if tag matches the package version
run: |
PKG_VERSION=$(poetry version -s)
TAG=${GITHUB_REF#refs/tags/}
if [[ "v$PKG_VERSION" != "$TAG" ]]; then
echo "Error: Tag ($TAG) does not match the package version (v$PKG_VERSION)."
exit 1
fi
- name: Build sdist and universal wheel
run: python -m build --sdist --wheel --outdir dist
- uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
artifacts: "dist/*"
allowUpdates: true
updateOnlyUnreleased: false
- name: Check if version already exists on PyPI
id: pypi_check
run: |
PKG_VERSION=$(poetry version -s)
PKG_NAME=$(poetry version | awk '{print $1}')
if curl -sSf https://pypi.org/pypi/$PKG_NAME/json | grep -q "\"$PKG_VERSION\""; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Version $PKG_VERSION already exists on PyPI. Will skip publish."
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Version $PKG_VERSION does not exist on PyPI. Will publish."
fi
- name: Publish to PyPI via Trusted Publishing
if: steps.pypi_check.outputs.exists == 'false'
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
skip-existing: true
37 changes: 20 additions & 17 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test

on:
push:
branches: [ main, master ]
branches: [ main, master, "feature/**" ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
Expand All @@ -23,28 +23,31 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install system dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6

- name: Cache Poetry dependencies
- name: Cache pip
uses: actions/cache@v4
with:
path: |
~/.cache/pypoetry
.venv
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-poetry-${{ matrix.python-version }}-
${{ runner.os }}-pip-${{ matrix.python-version }}-

- name: Install dependencies
run: poetry install
- name: Install package and test dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[gui]"
pip install pytest pytest-cov

- name: Run tests with coverage
run: poetry run pytest --cov=fibermorph --cov-report=xml --cov-report=term
run: pytest --cov=fibermorph --cov-report=xml --cov-report=term

- name: Upload coverage reports
uses: codecov/codecov-action@v4
Expand All @@ -53,4 +56,4 @@ jobs:
file: ./coverage.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
continue-on-error: true
continue-on-error: true
Loading
Loading