Skip to content

Commit

Permalink
Merge pull request #14 from Deltares/pyproject
Browse files Browse the repository at this point in the history
Move ruff and pixi toml into pyproject
  • Loading branch information
Huite authored Jul 11, 2024
2 parents 30139d5 + 38f7893 commit 5e9df68
Show file tree
Hide file tree
Showing 8 changed files with 11,515 additions and 9,703 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
48 changes: 30 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,61 @@ on:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
- name: Run pre-commit
uses: pre-commit/action@v2.0.3

uses: pre-commit/action@v3.0.1
test:
runs-on: ubuntu-latest
name: ${{ matrix.pixi-environment }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.10"
os:
- ubuntu-latest
- macOS-latest
- windows-latest
pixi-environment:
- py312
- py311
- py310
steps:
- name: Check out repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0.3.0
- name: Setup older Python versions
run: pixi add python=${{ matrix.python-version }}
uses: prefix-dev/setup-pixi@v0.8.1
with:
manifest-path: pyproject.toml
- name: Run Tests
run: pixi run test
run: pixi run --environment ${{ matrix.pixi-environment }} test

build:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0.3.0
uses: prefix-dev/setup-pixi@v0.8.1
with:
manifest-path: pyproject.toml
- name: Run Tests
run: pixi run test
- name: Publish Code Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
- name: Build Docs
run: pixi run docs
- name: Deploy to Github Pages
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build
publish_dir: ./docs/_build
8 changes: 1 addition & 7 deletions numba_celltree/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
from importlib.metadata import version as _version

from .celltree import CellTree2d

try:
__version__ = _version("numba_celltree")
except Exception:
# Disable minimum version checks on downstream libraries.
__version__ = "9999"
__version__ = "0.1.6"

__all__ = ("CellTree2d",)
21,012 changes: 11,400 additions & 9,612 deletions pixi.lock

Large diffs are not rendered by default.

34 changes: 0 additions & 34 deletions pixi.toml

This file was deleted.

86 changes: 76 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[build-system]
requires = ["setuptools>=64.0.0", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "numba_celltree"
description = "Cell Tree Spatial Index"
readme = { file = "README.rst", content-type = "text/x-rst" }
version = "0.1.6"
dynamic = ["version"]
maintainers = [
{ name = "Huite Bootsma", email = "huite.bootsma@deltares.nl" }
]
Expand All @@ -16,7 +16,7 @@ dependencies = [
'numpy',
]
classifiers = [
'Development Status :: 3 - Alpha',
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
Expand All @@ -25,6 +25,7 @@ classifiers = [
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: Implementation :: CPython',
'Topic :: Scientific/Engineering',
]
Expand All @@ -45,14 +46,79 @@ Issues = "https://github.com/deltares/numba_celltree/issues"
all = ["matplotlib"]
docs = ["matplotlib", "pydata-sphinx-theme", "sphinx", "sphinx-gallery"]

[tool.setuptools]
packages = ["numba_celltree", "numba_celltree.algorithms"]
license-files = ["LICENSE"]
[tool.hatch.version]
path = "numba_celltree/__init__.py"

[tool.isort]
profile = "black"
[tool.hatch.build.targets.sdist]
only-include = ["numba_celltree", "tests"]

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
]
]

[tool.pixi.project]
channels = ["conda-forge"]
platforms = ["win-64", "linux-64", "osx-64", "osx-arm64"]

[tool.pixi.pypi-dependencies]
numba_celltree = { path = ".", editable = true }

[tool.pixi.dependencies]
matplotlib = "*"
numba = "*"
numpy = "*"
pip = "*"
pre-commit = "*"
pydata-sphinx-theme = "*"
pytest = "*"
pytest-cov = "*"
python = ">=3.9"
ruff = "*"
sphinx = "*"
sphinx-gallery = "*"

[tool.pixi.tasks]
pre-commit = "pre-commit run --all-files"
test = "NUMBA_DISABLE_JIT=1 pytest --cov=numba_celltree --cov-report xml --cov-report term"
docs = "NUMBA_DISABLE_JIT=1 sphinx-build docs docs/_build"
all = { depends_on = ["pre-commit", "test", "docs"]}
pypi-publish = "rm --recursive --force dist && python -m build && twine check dist/* && twine upload dist/*"

[tool.pixi.feature.py312.dependencies]
python = "3.12.*"

[tool.pixi.feature.py311.dependencies]
python = "3.11.*"

[tool.pixi.feature.py310.dependencies]
python = "3.10.*"

[tool.pixi.environments]
default = { features = ["py312"], solve-group = "py312" }
py312 = { features = ["py312"], solve-group = "py312" }
py311 = ["py311"]
py310 = ["py310"]

[tool.ruff.lint]
# See https://docs.astral.sh/ruff/rules/
select = ["C4", "D2", "D3", "D4", "E", "F", "I", "NPY", "PD"]
ignore = [
"D202",
"D205",
"D206",
"D400",
"D404",
"E402",
"E501",
"E703",
"PD002",
"PD901",
"PD003",
"PD004",
]
fixable = ["I"]
ignore-init-module-imports = true

[tool.ruff.lint.pydocstyle]
convention = "numpy"
21 changes: 0 additions & 21 deletions ruff.toml

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_geometry_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_to_point():
def test_cross_product():
u = Vector(1.0, 2.0)
v = Vector(3.0, 4.0)
assert np.allclose(gu.cross_product(u, v), np.cross(u, v))
assert np.allclose(gu.cross_product(u, v), u.x * v.y - u.y * v.x)


def test_dot_product():
Expand Down

0 comments on commit 5e9df68

Please sign in to comment.