Skip to content

Commit 548edd6

Browse files
authored
migrated the package manager and build-backend (#73)
* make package compatible with pip * update taskfile to use uv * use uv for package management * add support automatic versioning from git tags * make scripts accessible (docs and pyproject.toml update) * migrate flake-8 config to pyproject.toml
1 parent dc9f2d1 commit 548edd6

File tree

10 files changed

+1744
-1996
lines changed

10 files changed

+1744
-1996
lines changed

.github/workflows/ci-cd.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ jobs:
3333
sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d
3434
3535
# Cache dependencies from poetry to speed things up
36-
- name: Load cached venv
37-
id: cached-poetry-dependencies
38-
uses: actions/cache@v3
39-
with:
40-
path: .venv
41-
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
42-
43-
- name: Install and upgrade pip and poetry
44-
run: python -m pip install --upgrade pip poetry
36+
# - name: Load cached venv
37+
# id: cached-poetry-dependencies
38+
# uses: actions/cache@v3
39+
# with:
40+
# path: .venv
41+
# key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
42+
43+
- name: Install and upgrade pip and uv
44+
run: python -m pip install --upgrade pip uv
4545

4646
- name: Install Dependencies
4747
run: ./bin/task setup

Taskfile.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,24 @@ tasks:
44
setup:
55
desc: Setup the development environment.
66
cmds:
7-
- poetry install
7+
- uv sync
88

99
lint:
1010
desc: Lints the code and reports on issues.
1111
cmds:
12-
- poetry run black --check .
13-
- poetry run ruff check .
12+
- uv run black --check .
13+
- uv run ruff check .
1414

1515
build:
1616
desc: Builds the python package
1717
cmds:
18-
- poetry build
18+
- uv build
1919

2020
test:
2121
desc: Runs tests on the code
2222
cmds:
2323
- >
24-
poetry run pytest test
24+
uv run pytest test
2525
--cov=lasso
2626
--cov-report=html
2727
@@ -31,29 +31,29 @@ tasks:
3131
- test
3232
- docs:changelog
3333
cmds:
34-
- poetry run mkdocs serve
34+
- uv run mkdocs serve
3535

3636
docs:build:
3737
desc: Build the documentation
3838
deps:
3939
- test
4040
- docs:changelog
4141
cmds:
42-
- poetry run mkdocs build
42+
- uv run mkdocs build
4343

4444
docs:deploy:
4545
desc: Deploys the docs to GitHub (be careful!)
4646
deps:
4747
- test
4848
- docs:changelog
4949
cmds:
50-
- poetry run mkdocs gh-deploy
50+
- uv run mkdocs gh-deploy
5151

5252
docs:changelog:
5353
desc: Generates the changelog
5454
cmds:
5555
- >
56-
poetry run git-changelog .
56+
uv run git-changelog .
5757
--output CHANGELOG.md
5858
--style angular
5959
--template angular

docs/diffcrash/run.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ easier.
1818
You can get the run info by performing:
1919

2020
```console
21-
$ python -m lasso.diffcrash.run --help
21+
$ diffcrash --help
2222

2323
==== D I F F C R A S H ====
2424

docs/dimred/command_line_interface.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ resizeContents()
160160
You can call the command-line tool as follows:
161161

162162
```console
163-
$ python -m lasso.dimred.run --help
163+
$ dimred --help
164164

165165
usage: run.py [-h] --reference-run REFERENCE_RUN
166166
[--exclude-runs [EXCLUDE_RUNS [EXCLUDE_RUNS ...]]]

lasso/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from importlib.metadata import version, PackageNotFoundError
2+
3+
try:
4+
__version__ = version("lasso-python")
5+
except PackageNotFoundError:
6+
# package is not installed
7+
pass

lasso/dimred/graph_laplacian.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _laplacian_gauss_idw(
9696
for i, (j, d, e, k) in enumerate(
9797
zip(
9898
*tree.query_radius(points, return_distance=True, r=search_radius),
99-
*tree.query(points, return_distance=True, k=1 + min_neighbors)
99+
*tree.query(points, return_distance=True, k=1 + min_neighbors),
100100
)
101101
):
102102
# Always search for k neighbors, this prevents strongly connected local areas

poetry.lock

Lines changed: 0 additions & 1941 deletions
This file was deleted.

pyproject.toml

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
[tool.poetry]
1+
[project]
22
name = "lasso-python"
3-
version = "2.0.3"
43
description = "An open-source CAE and Machine Learning library."
5-
authors = ["open-lasso-python <[email protected]>"]
6-
license = "BSD-3"
4+
license-files = ["LICENSE.md"]
5+
readme = "README.rst"
6+
dynamic = ["version"]
7+
authors = [{ name = "open-lasso-python", email = "[email protected]" }]
78
classifiers = [
89
"Development Status :: 5 - Production/Stable",
910
"Topic :: Scientific/Engineering",
@@ -12,43 +13,52 @@ classifiers = [
1213
"Operating System :: Microsoft :: Windows",
1314
"Operating System :: POSIX :: Linux",
1415
"Programming Language :: Python :: 3",
15-
"Programming Language :: Python :: 3.8",
1616
"Programming Language :: Python :: 3.9",
1717
"Programming Language :: Python :: 3.10",
1818
"Programming Language :: Python :: 3.11",
19+
"Programming Language :: Python :: 3.12",
1920
]
20-
packages = [
21-
{ include = "lasso" }
21+
22+
requires-python = ">=3.9"
23+
dependencies = [
24+
"h5py==3.*",
25+
"scipy==1.*",
26+
"numpy==1.*",
27+
"plotly==5.*",
28+
# "attrs==23.*"
29+
"psutil==5.*",
30+
"rich==13.*",
31+
"pandas==2.*",
32+
"scikit_learn==1.*"
2233
]
2334

24-
[tool.poetry.dependencies]
25-
python = "^3.9"
26-
h5py = "^3.7.0"
27-
scipy = "^1.9.1"
28-
numpy = "^1.23.3"
29-
plotly = "^5.10.0"
30-
attrs = "^23.2.0"
31-
psutil = "^5.9.2"
32-
rich = "^13.0.0"
33-
pandas = "^2.2.0"
34-
scikit-learn = "^1.2.1"
35+
[project.scripts]
36+
diffcrash = "lasso.diffcrash.run:main"
37+
dimred = "lasso.dimred.run:main"
3538

36-
[tool.poetry.group.dev.dependencies]
37-
pytest = "^8.0.0"
38-
pytest-cov = "^5.0.0"
39-
black = "^24.3.0"
40-
ruff = "^0.3.7"
41-
mkdocs = "^1.4.2"
42-
mkdocs-material = "^9.5.0"
43-
mkdocstrings = {extras = ["python"], version = "^0.24.3"}
44-
mkdocs-coverage = "^1.0.0"
45-
git-changelog = "^2.5.0"
46-
twine = "^5.0.0"
39+
[dependency-groups]
40+
dev = [
41+
"pytest==8.*",
42+
"pytest-cov==5.*",
43+
"black==24.*",
44+
"ruff==0.3.*",
45+
"mkdocs==1.*",
46+
"mkdocs-material==9.*",
47+
"mkdocstrings[python]==0.*",
48+
"mkdocs-coverage==1.*",
49+
"git-changelog==2.*",
50+
"twine==5.*",
51+
"go-task-bin"
52+
]
4753

4854
[build-system]
49-
requires = ["poetry-core>=1.0.0"]
50-
build-backend = "poetry.core.masonry.api"
55+
requires = ["setuptools>=78", "setuptools-scm>=8"]
56+
build-backend = "setuptools.build_meta"
5157

5258
[tool.black]
5359
# We allow longer lines since 80 is quite short
5460
line-length=100
61+
62+
[tool.flake8]
63+
exclude = [".git", "*migrations*"]
64+
max-line-length = 100

setup.cfg

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)