Skip to content

Commit

Permalink
migrate to rye
Browse files Browse the repository at this point in the history
  • Loading branch information
ciscorn committed Mar 24, 2024
1 parent 30b2c40 commit cf3d48e
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 940 deletions.
23 changes: 11 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,24 @@ jobs:
steps:
- uses: actions/checkout@v4

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

- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: "poetry"
cache: "pip"

- name: Install dependencies
run: poetry install
- name: Install Ruff
run: pip3 install ruff

- name: Check poetry.lock
run: poetry lock --check
- name: Install dependencies
run: |
pip3 install -r requirements-dev.lock
pip3 install -r requirements.lock
# - name: Type-check with Pyright
# run: poetry run pyright .

- name: Lint with ruff
run: poetry run ruff --output-format=github .
- name: Lint
run: ruff lint --output-format=github

- name: Format with ruff
run: poetry run ruff format .
- name: Format
run: ruff format --check
52 changes: 27 additions & 25 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,30 @@ jobs:
PYTHON: ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v4

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

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

- name: Install dependencies
run: poetry install

- name: Run pytest
run: poetry run pytest -v --cov --cov-report xml --cov-report term

- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
fail_ci_if_error: true
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: "pip"

- name: Install dependencies
run: |
pip3 install -r requirements-dev.lock
pip3 install -r requirements.lock
# - name: Type-check with Pyright
# run: poetry run pyright .

- name: Test
run: pytest -v --cov --cov-report xml --cov-report term

- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
fail_ci_if_error: true

882 changes: 0 additions & 882 deletions poetry.lock

This file was deleted.

47 changes: 26 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
[tool.poetry]
[project]
name = "earcut-py"
version = "0.3.0"
description = "A pure Python port of the Earcut polygon triangulation library."
authors = [
"MIERUNE Inc. <[email protected]>",
"Taku Fukada <[email protected]>",
{ name = "MIERUNE Inc.", email = "[email protected]" },
{ name = "Taku Fukada", email = "[email protected]" },
]
license = "ISC"
dependencies = []
readme = "README.md"
packages = [{include = "earcut"}]
requires-python = ">= 3.9"

[tool.poetry.dependencies]
python = "^3.9"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.poetry.group.dev.dependencies]
pytest-cov = "^4.1"
pytest = ">=7.4,<9.0"
ruff = ">=0.1,<0.4"
pyright = "^1.1"
numpy = "^1.26"
matplotlib = "^3.8"
seaborn = "^0.13"
[tool.rye]
managed = true
dev-dependencies = [
"pytest>=8.1.1",
"pytest-cov>=4.1.0",
"pyright>=1.1.355",
"numpy>=1.24.4",
"matplotlib>=3.7.5",
"seaborn>=0.13.2",
]

[tool.ruff]
ignore = ["E501"]
[tool.hatch.metadata]
allow-direct-references = true

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.hatch.build.targets.wheel]
packages = ["src/earcut_py"]

[tool.ruff.lint]
ignore = ["E501"]

[tool.coverage.run]
source = ['earcut']
source = ['earcut']
67 changes: 67 additions & 0 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false
# with-sources: false

-e file:.
contourpy==1.1.1
# via matplotlib
coverage==7.4.4
# via pytest-cov
cycler==0.12.1
# via matplotlib
exceptiongroup==1.2.0
# via pytest
fonttools==4.50.0
# via matplotlib
importlib-resources==6.4.0
# via matplotlib
iniconfig==2.0.0
# via pytest
kiwisolver==1.4.5
# via matplotlib
matplotlib==3.7.5
# via seaborn
nodeenv==1.8.0
# via pyright
numpy==1.24.4
# via contourpy
# via matplotlib
# via pandas
# via seaborn
packaging==24.0
# via matplotlib
# via pytest
pandas==2.0.3
# via seaborn
pillow==10.2.0
# via matplotlib
pluggy==1.4.0
# via pytest
pyparsing==3.1.2
# via matplotlib
pyright==1.1.355
pytest==8.1.1
# via pytest-cov
pytest-cov==4.1.0
python-dateutil==2.9.0.post0
# via matplotlib
# via pandas
pytz==2024.1
# via pandas
seaborn==0.13.2
setuptools==69.2.0
# via nodeenv
six==1.16.0
# via python-dateutil
tomli==2.0.1
# via coverage
# via pytest
tzdata==2024.1
# via pandas
zipp==3.18.1
# via importlib-resources
10 changes: 10 additions & 0 deletions requirements.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# generated by rye
# use `rye lock` or `rye sync` to update this lockfile
#
# last locked with the following flags:
# pre: false
# features: []
# all-features: false
# with-sources: false

-e file:.
2 changes: 2 additions & 0 deletions src/earcut_py/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def hello() -> str:
return "Hello from earcut-py!"

0 comments on commit cf3d48e

Please sign in to comment.