From 3c839e8ee09dacffe6a8b843d73ec75a22bb6762 Mon Sep 17 00:00:00 2001 From: Chris Arderne Date: Tue, 16 Apr 2024 18:05:13 +0100 Subject: [PATCH] switch to rye --- .github/workflows/deploy.yml | 9 +- Makefile | 13 -- README.md | 19 +- pyproject.toml | 36 ++-- requirements-dev.lock | 378 +++++++++++++++++++++++++++++++++++ requirements.lock | 104 ++++++++++ 6 files changed, 515 insertions(+), 44 deletions(-) delete mode 100644 Makefile create mode 100644 requirements-dev.lock create mode 100644 requirements.lock diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 58a8a74..dd60c22 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,3 +1,5 @@ +name: deploy + on: push: tags: @@ -15,8 +17,11 @@ jobs: with: python-version: '3.12' - - name: Install - run: pip install '.[dev]' + - name: Install requirements + run: pip install -r requirements.lock + + - name: Install pytest + run: pip install pytest - name: Test run: pytest diff --git a/Makefile b/Makefile deleted file mode 100644 index 1466a4f..0000000 --- a/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -.PHONY: lint -lint: - ruff format . - ruff check . - -.PHONY: check -check: - pyright - -.PHONY: test -test: - pytest - ./examples/test.sh diff --git a/README.md b/README.md index 96a7696..2f5138f 100644 --- a/README.md +++ b/README.md @@ -32,20 +32,13 @@ Download or clone the repository and install the required packages (preferably i ```bash git clone https://github.com/carderne/gridfinder.git cd gridfinder -pip install -e '.[dev]' +rye sync ``` -### Linting +Useful commands: ```bash -make lint -``` - -### Typecheck -```bash -make check -``` - -### Testing -```bash -make test +rye fmt +rye lint +rye run check # type check +rye run test ``` diff --git a/pyproject.toml b/pyproject.toml index 221fc5b..f84b062 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,7 @@ -[build-system] -requires = [ - "setuptools>=65", - "wheel>=0.37.1", - "setuptools-scm[toml]>=7.0.5", -] -build-backend = "setuptools.build_meta" +[tool.rye.scripts] +check = "pyright" +test = "pytest" +ex = "./examples/test.sh" [project] name = "gridfinder" @@ -15,7 +12,7 @@ requires-python = ">=3.9" keywords = ["ntl", "electricity", "grid"] authors = [ - {name = "Chris Arderne", email="chris@rdrn.me"}, + {name = "Chris Arderne", email="chris@rdrn.me"}, ] dynamic = ["version"] @@ -49,28 +46,33 @@ dependencies = [ "Shapely ~= 2.0", ] -[project.optional-dependencies] -dev = [ +[tool.rye] +managed = true +dev-dependencies = [ + "pyright", + "pytest", "descartes ~= 1.1.0", "folium ~= 0.15", "matplotlib ~= 3.8", "pytest ~= 8.0", "ruff ~= 0.2", "seaborn ~= 0.13", + "jupyterlab ~= 4.1", ] [project.urls] homepage = "https://gridfinder.rdrn.me" repository = "https://github.com/carderne/gridfinder" -[tool.setuptools] -include-package-data = false +[build-system] +requires = ["pdm-backend"] +build-backend = "pdm.backend" -[tool.setuptools.packages.find] -include = ["gridfinder"] -exclude = ["docs*", "tests*"] +[tool.pdm.build] +includes = ["gridfinder/"] -[tool.setuptools_scm] +[tool.pdm.version] +source = "scm" [tool.ruff] target-version = "py39" @@ -96,6 +98,8 @@ select = [ known-first-party = ["gridfinder"] [tool.pyright] +venvPath = "." +venv = ".venv" include = ["gridfinder", "tests"] reportMissingImports = true reportMissingParameterType = true diff --git a/requirements-dev.lock b/requirements-dev.lock new file mode 100644 index 0000000..3a246ea --- /dev/null +++ b/requirements-dev.lock @@ -0,0 +1,378 @@ +# 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:. +affine==2.4.0 + # via gridfinder + # via rasterio +anyio==4.3.0 + # via httpx + # via jupyter-server +appnope==0.1.4 + # via ipykernel +argon2-cffi==23.1.0 + # via jupyter-server +argon2-cffi-bindings==21.2.0 + # via argon2-cffi +arrow==1.3.0 + # via isoduration +asttokens==2.4.1 + # via stack-data +async-lru==2.0.4 + # via jupyterlab +attrs==23.2.0 + # via fiona + # via jsonschema + # via rasterio + # via referencing +babel==2.14.0 + # via jupyterlab-server +beautifulsoup4==4.12.3 + # via nbconvert +bleach==6.1.0 + # via nbconvert +branca==0.7.1 + # via folium +certifi==2024.2.2 + # via fiona + # via httpcore + # via httpx + # via pyproj + # via rasterio + # via requests +cffi==1.16.0 + # via argon2-cffi-bindings +charset-normalizer==3.3.2 + # via requests +click==8.1.7 + # via click-plugins + # via cligj + # via fiona + # via gridfinder + # via rasterio +click-plugins==1.1.1 + # via fiona + # via rasterio +cligj==0.7.2 + # via fiona + # via rasterio +comm==0.2.2 + # via ipykernel +contourpy==1.2.1 + # via matplotlib +cycler==0.12.1 + # via matplotlib +debugpy==1.8.1 + # via ipykernel +decorator==5.1.1 + # via ipython +defusedxml==0.7.1 + # via nbconvert +descartes==1.1.0 +executing==2.0.1 + # via stack-data +fastjsonschema==2.19.1 + # via nbformat +fiona==1.9.6 + # via geopandas + # via gridfinder +folium==0.16.0 +fonttools==4.51.0 + # via matplotlib +fqdn==1.5.1 + # via jsonschema +geopandas==0.14.3 + # via gridfinder +h11==0.14.0 + # via httpcore +httpcore==1.0.5 + # via httpx +httpx==0.27.0 + # via jupyterlab +idna==3.7 + # via anyio + # via httpx + # via jsonschema + # via requests +imageio==2.34.0 + # via scikit-image +iniconfig==2.0.0 + # via pytest +ipykernel==6.29.4 + # via jupyterlab +ipython==8.23.0 + # via ipykernel +isoduration==20.11.0 + # via jsonschema +jedi==0.19.1 + # via ipython +jinja2==3.1.3 + # via branca + # via folium + # via jupyter-server + # via jupyterlab + # via jupyterlab-server + # via nbconvert +json5==0.9.25 + # via jupyterlab-server +jsonpointer==2.4 + # via jsonschema +jsonschema==4.21.1 + # via jupyter-events + # via jupyterlab-server + # via nbformat +jsonschema-specifications==2023.12.1 + # via jsonschema +jupyter-client==8.6.1 + # via ipykernel + # via jupyter-server + # via nbclient +jupyter-core==5.7.2 + # via ipykernel + # via jupyter-client + # via jupyter-server + # via jupyterlab + # via nbclient + # via nbconvert + # via nbformat +jupyter-events==0.10.0 + # via jupyter-server +jupyter-lsp==2.2.5 + # via jupyterlab +jupyter-server==2.14.0 + # via jupyter-lsp + # via jupyterlab + # via jupyterlab-server + # via notebook-shim +jupyter-server-terminals==0.5.3 + # via jupyter-server +jupyterlab==4.1.6 +jupyterlab-pygments==0.3.0 + # via nbconvert +jupyterlab-server==2.26.0 + # via jupyterlab +kiwisolver==1.4.5 + # via matplotlib +lazy-loader==0.4 + # via scikit-image +llvmlite==0.42.0 + # via numba +markupsafe==2.1.5 + # via jinja2 + # via nbconvert +matplotlib==3.8.4 + # via descartes + # via seaborn +matplotlib-inline==0.1.7 + # via ipykernel + # via ipython +mistune==3.0.2 + # via nbconvert +nbclient==0.10.0 + # via nbconvert +nbconvert==7.16.3 + # via jupyter-server +nbformat==5.10.4 + # via jupyter-server + # via nbclient + # via nbconvert +nest-asyncio==1.6.0 + # via ipykernel +networkx==3.3 + # via scikit-image +nodeenv==1.8.0 + # via pyright +notebook-shim==0.2.4 + # via jupyterlab +numba==0.59.1 + # via gridfinder +numpy==1.26.4 + # via contourpy + # via folium + # via gridfinder + # via imageio + # via matplotlib + # via numba + # via pandas + # via pyarrow + # via rasterio + # via scikit-image + # via scipy + # via seaborn + # via shapely + # via snuggs + # via tifffile +overrides==7.7.0 + # via jupyter-server +packaging==24.0 + # via geopandas + # via ipykernel + # via jupyter-server + # via jupyterlab + # via jupyterlab-server + # via lazy-loader + # via matplotlib + # via nbconvert + # via pytest + # via scikit-image +pandas==2.2.2 + # via geopandas + # via gridfinder + # via seaborn +pandocfilters==1.5.1 + # via nbconvert +parso==0.8.4 + # via jedi +pexpect==4.9.0 + # via ipython +pillow==10.3.0 + # via gridfinder + # via imageio + # via matplotlib + # via scikit-image +platformdirs==4.2.0 + # via jupyter-core +pluggy==1.4.0 + # via pytest +prometheus-client==0.20.0 + # via jupyter-server +prompt-toolkit==3.0.43 + # via ipython +psutil==5.9.8 + # via ipykernel +ptyprocess==0.7.0 + # via pexpect + # via terminado +pure-eval==0.2.2 + # via stack-data +pyarrow==15.0.2 + # via gridfinder +pycparser==2.22 + # via cffi +pygments==2.17.2 + # via ipython + # via nbconvert +pyparsing==3.1.2 + # via matplotlib + # via snuggs +pyproj==3.6.1 + # via geopandas + # via gridfinder +pyright==1.1.358 +pytest==8.1.1 +python-dateutil==2.9.0.post0 + # via arrow + # via jupyter-client + # via matplotlib + # via pandas +python-json-logger==2.0.7 + # via jupyter-events +pytz==2024.1 + # via pandas +pyyaml==6.0.1 + # via jupyter-events +pyzmq==26.0.0 + # via ipykernel + # via jupyter-client + # via jupyter-server +rasterio==1.3.10 + # via gridfinder +referencing==0.34.0 + # via jsonschema + # via jsonschema-specifications + # via jupyter-events +requests==2.31.0 + # via folium + # via jupyterlab-server +rfc3339-validator==0.1.4 + # via jsonschema + # via jupyter-events +rfc3986-validator==0.1.1 + # via jsonschema + # via jupyter-events +rpds-py==0.18.0 + # via jsonschema + # via referencing +rtree==1.2.0 + # via gridfinder +ruff==0.3.7 +scikit-image==0.23.1 + # via gridfinder +scipy==1.13.0 + # via gridfinder + # via scikit-image +seaborn==0.13.2 +send2trash==1.8.3 + # via jupyter-server +setuptools==69.5.1 + # via nodeenv + # via rasterio +shapely==2.0.3 + # via geopandas + # via gridfinder +six==1.16.0 + # via asttokens + # via bleach + # via fiona + # via python-dateutil + # via rfc3339-validator +sniffio==1.3.1 + # via anyio + # via httpx +snuggs==1.4.7 + # via rasterio +soupsieve==2.5 + # via beautifulsoup4 +stack-data==0.6.3 + # via ipython +terminado==0.18.1 + # via jupyter-server + # via jupyter-server-terminals +tifffile==2024.2.12 + # via scikit-image +tinycss2==1.2.1 + # via nbconvert +tornado==6.4 + # via ipykernel + # via jupyter-client + # via jupyter-server + # via jupyterlab + # via terminado +traitlets==5.14.2 + # via comm + # via ipykernel + # via ipython + # via jupyter-client + # via jupyter-core + # via jupyter-events + # via jupyter-server + # via jupyterlab + # via matplotlib-inline + # via nbclient + # via nbconvert + # via nbformat +types-python-dateutil==2.9.0.20240316 + # via arrow +tzdata==2024.1 + # via pandas +uri-template==1.3.0 + # via jsonschema +urllib3==2.2.1 + # via requests +wcwidth==0.2.13 + # via prompt-toolkit +webcolors==1.13 + # via jsonschema +webencodings==0.5.1 + # via bleach + # via tinycss2 +websocket-client==1.7.0 + # via jupyter-server +xyzservices==2024.4.0 + # via folium diff --git a/requirements.lock b/requirements.lock new file mode 100644 index 0000000..6b30b20 --- /dev/null +++ b/requirements.lock @@ -0,0 +1,104 @@ +# 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:. +affine==2.4.0 + # via gridfinder + # via rasterio +attrs==23.2.0 + # via fiona + # via rasterio +certifi==2024.2.2 + # via fiona + # via pyproj + # via rasterio +click==8.1.7 + # via click-plugins + # via cligj + # via fiona + # via gridfinder + # via rasterio +click-plugins==1.1.1 + # via fiona + # via rasterio +cligj==0.7.2 + # via fiona + # via rasterio +fiona==1.9.6 + # via geopandas + # via gridfinder +geopandas==0.14.3 + # via gridfinder +imageio==2.34.0 + # via scikit-image +lazy-loader==0.4 + # via scikit-image +llvmlite==0.42.0 + # via numba +networkx==3.3 + # via scikit-image +numba==0.59.1 + # via gridfinder +numpy==1.26.4 + # via gridfinder + # via imageio + # via numba + # via pandas + # via pyarrow + # via rasterio + # via scikit-image + # via scipy + # via shapely + # via snuggs + # via tifffile +packaging==24.0 + # via geopandas + # via lazy-loader + # via scikit-image +pandas==2.2.2 + # via geopandas + # via gridfinder +pillow==10.3.0 + # via gridfinder + # via imageio + # via scikit-image +pyarrow==15.0.2 + # via gridfinder +pyparsing==3.1.2 + # via snuggs +pyproj==3.6.1 + # via geopandas + # via gridfinder +python-dateutil==2.9.0.post0 + # via pandas +pytz==2024.1 + # via pandas +rasterio==1.3.10 + # via gridfinder +rtree==1.2.0 + # via gridfinder +scikit-image==0.23.1 + # via gridfinder +scipy==1.13.0 + # via gridfinder + # via scikit-image +setuptools==69.5.1 + # via rasterio +shapely==2.0.3 + # via geopandas + # via gridfinder +six==1.16.0 + # via fiona + # via python-dateutil +snuggs==1.4.7 + # via rasterio +tifffile==2024.2.12 + # via scikit-image +tzdata==2024.1 + # via pandas