Skip to content
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
4 changes: 2 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# .coveragerc to control coverage.py
[run]
branch = True
source = iranges
# omit = bad_file.py
source = src
omit = tests/*

[paths]
source =
Expand Down
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"
2 changes: 1 addition & 1 deletion .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest

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

- name: Set up Python 3.12
uses: actions/setup-python@v5
Expand Down
110 changes: 68 additions & 42 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,91 @@
name: Publish to PyPI
name: Publish to PyPI and GitHub Pages

on:
push:
tags:
- "*"
tags: "*"

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# macos-13 is an intel runner, higher macos's are apple silicon
# At some point, maybe get this to work on windows-latest
os: [ubuntu-latest, macos-latest]

build-and-test:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: actions/checkout@v7

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

- name: Build wheels
uses: pypa/cibuildwheel@v4.2.0
env:
CIBW_ARCHS_LINUX: x86_64
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10"
CIBW_SKIP: pp*
- name: Install tox
run: python -m pip install tox

- uses: actions/upload-artifact@v4
- name: Test
run: tox -e default

- name: Build Project
run: tox -e build

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
name: python-package-distributions
path: dist/

build_sdist:
name: Build source distribution
build-docs:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

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

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

- name: Build sdist
run: pipx run build --sdist
- name: Build docs
run: tox -e docs

- uses: actions/upload-artifact@v4
- name: Add .nojekyll
run: touch ./docs/_build/html/.nojekyll

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v5
with:
name: cibw-sdist
path: dist/*.tar.gz
path: ./docs/_build/html

upload_pypi:
needs: [build_wheels, build_sdist]
publish-pypi:
name: Publish to PyPI
needs: build-and-test
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/IRanges
permissions:
id-token: write

id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- uses: actions/download-artifact@v4
- name: Download all the dists
uses: actions/download-artifact@v8
with:
pattern: cibw-*
path: dist
merge-multiple: true
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

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
26 changes: 10 additions & 16 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,23 @@ jobs:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
platform:
- ubuntu-latest
# - macos-latest
# - windows-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.platform }}
name: Python ${{ matrix.python }}, ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

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

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

- name: Get latest CMake
uses: lukka/get-cmake@latest
- name: Install tox
run: python -m pip install tox coverage

- name: Run tests
run: >-
pipx run --python '${{ steps.setup-python.outputs.python-path }}'
tox
-- -rFEx --durations 10 --color yes --cov --cov-branch --cov-report=xml # pytest args

Expand All @@ -68,9 +62,9 @@ jobs:
fi

- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@v7
if: ${{ steps.codecov-check.outputs.codecov == 'true' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: ${{ github.repository }}
flags: ${{ matrix.platform }} - py${{ matrix.python }}
15 changes: 12 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.15.6
rev: v0.16.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
# Run the linter.
- id: ruff-check
args: [--fix, --exit-zero]
# Run the formatter.
- id: ruff-format

## If like to embrace black styles even in the docs:
Expand All @@ -51,3 +53,10 @@ repos:
# rev: v2.2.5
# hooks:
# - id: codespell

- repo: https://github.com/PyCQA/bandit
rev: 1.7.9
hooks:
- id: bandit
args: ["-c", "pyproject.toml"]
additional_dependencies: ["bandit[toml]"]
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ myst-nb
# under `install_requires` in `setup.cfg` is also listed here!
# sphinx_rtd_theme
myst-parser[linkify]
sphinx>=3.2.1
sphinx>=9.1.0
sphinx-autodoc-typehints
57 changes: 46 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,63 @@
[build-system]
# AVOID CHANGING REQUIRES: IT WILL BE UPDATED BY PYSCAFFOLD!
requires = ["setuptools>=46.1.0", "setuptools_scm[toml]>=5", "cmake", "pybind11", "numpy"]
requires = [
"setuptools>=46.1.0",
"setuptools_scm[toml]>=5",
"cmake",
"pybind11",
"numpy",
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
# For smarter version schemes and other configuration options,
# check out https://github.com/pypa/setuptools_scm
version_scheme = "no-guess-dev"

[tool.ruff]
line-length = 120
src = ["src"]
# exclude = ["tests"]
extend-ignore = ["F821"]
src = [
"src",
]
exclude = [
"tests",
"docs",
]

[tool.ruff.pydocstyle]
[tool.ruff.lint]
extend-ignore = [
"F821",
]

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.per-file-ignores]
"__init__.py" = [
"E402",
"F401",
]

[tool.ruff.format]
docstring-code-format = true
docstring-code-line-length = 20

[tool.ruff.per-file-ignores]
"__init__.py" = ["E402", "F401"]

[tool.black]
force-exclude = "__init__.py"

[tool.mypy]
strict = true

[tool.pytest.ini_options]
addopts = "--cov --cov-report term-missing"
testpaths = [
"tests",
]

[project.optional-dependencies]
testing = [
"pytest>=9.1.1",
"pytest-cov>=7.1.0",
]


[tool.bandit]
exclude_dirs = ["tests"]
skips = ["B110"]
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def build_cmake(self, ext):
ext_modules=[CMakeExtension("iranges")],
cmdclass={"build_ext": build_ext},
)
except: # noqa
except:
print(
"\n\nAn error occurred while building the project, "
"please ensure you have the most updated version of setuptools, "
Expand Down
Loading
Loading