Skip to content

Commit

Permalink
🪶 Switching back to poetry.
Browse files Browse the repository at this point in the history
Poetry seems faster than PDM so I'm switching back. It also does not seem to arbitrarily change the pyproject.toml file (not yet).
  • Loading branch information
rentruewang committed Nov 21, 2024
1 parent cb703be commit f726357
Show file tree
Hide file tree
Showing 17 changed files with 94 additions and 77 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,17 @@ jobs:
with:
python-version: "3.10"

- name: ⬇️ Python PDM
uses: pdm-project/setup-pdm@v4
- name: ⬇️ Python Poetry
uses: snok/install-poetry@v1
with:
python-version: "3.10"
version: 1.8.4
installer-parallel: true

- name: ⬇️ Python Dependencies
run: pdm install -G:all

- name: 🚂 Activate environment
run: echo "$(pdm venv --path in-project)/bin" >> $GITHUB_PATH
run: poetry install --sync

- name: 🚧 Jupyter build
run: jupyter book build docs
run: poetry run jupyter book build docs

- name: 📰 Publish docs
uses: JamesIves/github-pages-deploy-action@v4
Expand Down
23 changes: 13 additions & 10 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,20 @@ jobs:
with:
python-version: "3.10"

- name: ⬇️ Python PDM
uses: pdm-project/setup-pdm@v4
- name: ⬇️ Python Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.4
installer-parallel: true

- name: ⬇️ Python Dependencies
run: pdm install -G:all

- name: 🚂 Activate environment
run: echo "$(pdm venv --path in-project)/bin" >> $GITHUB_PATH
run: poetry install --sync

- name: 🏃 autoflake, isort, black
run: |
autoflake -cr $(find -iname "*.py" ! -path '*/.venv/*' ! -name __init__.py) --remove-all-unused-imports
isort --profile black --check .
black --check .
run: poetry run autoflake --check .

- name: 🏃 isort
run: poetry run isort --check .

- name: 🏃 black
run: poetry run black --diff .
30 changes: 30 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish
on: workflow_dispatch

jobs:
pypi-publish:
name: ⬆️ Upload release to PyPI
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: 🔔 Check out
uses: actions/checkout@v3

- name: 🏗️ python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: ⬇️ Python Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.4
installer-parallel: true

- name: ⬇️ Python Dependencies
run: poetry install --sync

- name: 🚧 Building distributions.
run: poetry publish --build
15 changes: 9 additions & 6 deletions .github/workflows/typecheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ jobs:
with:
python-version: "3.10"

- name: ⬇️ Python PDM
uses: pdm-project/setup-pdm@v4
- name: ⬇️ Python Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.4
installer-parallel: true

- name: ⬇️ Python Dependencies
run: pdm install -G:all
run: poetry install --sync

- name: 🚂 Activate environment
run: echo "$(pdm venv --path in-project)/bin" >> $GITHUB_PATH
- name: 📦 Install type stubs
run: poetry run mypy src --install-types --non-interactive

- name: 🏃 mypy
run: mypy . --disable-error-code=import-untyped --disable-error-code=import-not-found
run: poetry run mypy src
20 changes: 7 additions & 13 deletions .github/workflows/unittest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,14 @@ jobs:
with:
python-version: "3.10"

- name: ⬇️ Python PDM
uses: pdm-project/setup-pdm@v4
- name: ⬇️ Python Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.4
installer-parallel: true

- name: ⬇️ Python Dependencies
run: pdm install -G:all

- name: 🚂 Activate environment
run: echo "$(pdm venv --path in-project)/bin" >> $GITHUB_PATH
run: poetry install --sync

- name: 🏃 pytest
run: pytest -xv

# - name: 🏃 pytest
# run: coverage run -m pytest -v

# - name: 📊 coverage
# run: coverage report -m
run: poetry run pytest -xv
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ ipython_config.py
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
pdm.lock
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[virtualenvs]
in-project = true
63 changes: 25 additions & 38 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,45 +1,32 @@
[project]
[tool.poetry]
name = "koila"
version = "0.2.0"
description = "Prevent PyTorch's `CUDA error out of memory` in a few lines of code"
authors = [
{name = "RenChu Wang", email = "[email protected]"},
]
dependencies = [
"numpy>=1.26.3",
"scipy>=1.11.4",
"torch>=2.1.2",
"black>=24.4.2",
]
requires-python = "==3.10.*"
description = "Prevent PyTorch's `CUDA error out of memory` in a few lines of code."
authors = ["RenChu Wang <[email protected]>"]
license = "MIT"
readme = "README.md"
license = {text = "Apache-2.0"}

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.poetry.dependencies]
python = ">=3.10"
numpy = "^2.1.3"
torch = "^2.5.1"


[tool.pdm]
distribution = true
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.pdm.dev-dependencies]
test = [
"coverage>=7.4.0",
"pytest>=7.4.4",
"pytest-cov>=4.1.0",
"pytest-xdist>=3.5.0",
]
format = [
"autoflake>=2.2.1",
"black>=23.12.1",
"isort>=5.13.2",
]
website = [
"jupyter>=1.1.1",
"jupyter-book>=1.0.3",
"myst-parser>=2.0.0",
]
type = [
"mypy>=1.8.0",
]
[tool.poetry.group.dev.dependencies]
autoflake = "^2.3.1"
black = "^24.10.0"
isort = "^5.13.2"
mypy = "^1.13.0"
pip = "^24.3.1"
setuptools = "^75.6.0"
jupyter = "^1.1.1"
jupyter-book = "^1.0.3"
coverage = "^7.6.7"
pytest = "^8.3.3"
pytest-cov = "^6.0.0"
pytest-sugar = "^1.0.0"
pytest-xdist = "^3.6.1"

0 comments on commit f726357

Please sign in to comment.