Skip to content
Merged
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
21 changes: 3 additions & 18 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
# .coveragerc to control coverage.py
[run]
branch = True
source = pybiocfilecache
# omit = bad_file.py

[paths]
source =
src/
*/site-packages/
source = src
omit = tests/*

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:
def __repr__
if self\.debug

# Don't complain if tests don't hit defensive assertion code:
if self.debug:
raise AssertionError
raise NotImplementedError

# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
16 changes: 16 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: pre-commit/action@v3.0.1
Comment on lines +10 to +16
104 changes: 70 additions & 34 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,91 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Publish to PyPI
name: Publish to PyPI and GitHub Pages

on:
push:
tags: "*"

jobs:
build:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
permissions:
id-token: write
repository-projects: write
contents: write
pages: write

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.12

- name: Install tox
run: python -m pip install tox

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Test
run: tox -e default

- name: Test with tox
run: |
tox
- name: Build Project
run: tox -e build

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

build-docs:
Comment on lines +9 to +34
name: Build Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install tox
run: python -m pip install tox

- name: Build docs
run: |
tox -e docs
run: tox -e docs

- run: touch ./docs/_build/html/.nojekyll
- name: Add .nojekyll
run: touch ./docs/_build/html/.nojekyll

- name: GH Pages Deployment
uses: JamesIves/github-pages-deploy-action@v4
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v5
with:
branch: gh-pages # The branch the action should deploy to.
folder: ./docs/_build/html
clean: true # Automatically remove deleted files from the deploy branch
path: ./docs/_build/html

- name: Build Project and Publish
run: |
python -m tox -e clean,build
publish-pypi:
Comment on lines +35 to +59
name: Publish to PyPI
needs: build-and-test
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/biocframe
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v8
with:
name: python-package-distributions
path: dist/

# This uses the trusted publisher workflow so no token is required.
- name: Publish to PyPI
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action or reusable workflow Medium

Unpinned 3rd party Action 'Publish to PyPI and GitHub Pages' step
Uses Step
uses 'pypa/gh-action-pypi-publish' with ref 'release/v1', not a pinned commit hash

deploy-pages:
name: Deploy GitHub Pages
needs: build-docs
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
55 changes: 55 additions & 0 deletions .github/workflows/r-interop-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: R and Python Interop Tests

on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
workflow_dispatch:

permissions:
contents: read

concurrency:
group: >-
${{ github.workflow }}-${{ github.ref_type }}-
${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
r-python-roundtrip:
runs-on: ubuntu-latest
name: R (BiocFileCache) <-> Python roundtrip
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[testing]"

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Install R BiocFileCache
run: |
Rscript -e '
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager", repos = "https://cloud.r-project.org")
BiocManager::install("BiocFileCache", ask = FALSE, update = FALSE)
'

- name: Verify R BiocFileCache is available
run: Rscript -e "library(BiocFileCache)"

- name: Run R/Python roundtrip tests
run: pytest tests/test_r_interop.py -v
73 changes: 55 additions & 18 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,70 @@
name: Run tests
name: Test the library

on:
push:
branches: [master]
branches:
- master # for legacy repos
- main
pull_request:
branches: [master]
branches:
- master # for legacy repos
- main
workflow_dispatch: # Allow manually triggering the workflow
schedule:
# Run roughly every 15 days at 00:00 UTC
# (useful to check if updates on dependencies break the package)
- cron: "0 0 1,16 * *"

permissions:
contents: read

concurrency:
group: >-
${{ github.workflow }}-${{ github.ref_type }}-
${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
test:
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

name: Python ${{ matrix.python-version }}
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
platform:
- ubuntu-latest
- macos-latest
# - windows-latest
runs-on: ${{ matrix.platform }}
name: Python ${{ matrix.python }}, ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: Setup Python
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
python-version: ${{ matrix.python }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Install tox
run: python -m pip install tox coverage

- name: Test with tox
run: |
- name: Run tests
run: >-
tox
-- -rFEx --durations 10 --color yes --cov --cov-branch --cov-report=xml # pytest args

- name: Check for codecov token availability
id: codecov-check
shell: bash
run: |
if [ ${{ secrets.CODECOV_TOKEN }} != '' ]; then
echo "codecov=true" >> $GITHUB_OUTPUT;
else
echo "codecov=false" >> $GITHUB_OUTPUT;
fi

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v7
if: ${{ steps.codecov-check.outputs.codecov == 'true' }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: ${{ github.repository }}
flags: ${{ matrix.platform }} - py${{ matrix.python }}
56 changes: 56 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,59 @@ MANIFEST

# remove cache
cache

# Byte-compiled / optimized / DLL files
__pycache__/
*$py.class
# C extensions
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
# PyInstaller
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.cache
nosetests.xml
*.cover
*.py,cover
.hypothesis/
cover/
# Sphinx documentation
docs/_build/
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# mypy, ruff, etc
.mypy_cache/
.ruff_cache/
.pyre/
# Editors
.vscode/
.idea/
*.swp
*.swo
Loading
Loading