Skip to content

Commit

Permalink
build(system): change to use Rye over Poetry (#388)
Browse files Browse the repository at this point in the history
  • Loading branch information
engeir authored Feb 27, 2024
1 parent 7e91c57 commit a5b19dd
Show file tree
Hide file tree
Showing 14 changed files with 327 additions and 1,734 deletions.
2 changes: 1 addition & 1 deletion .github/rich-codex.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
outputs:
- command: "poetry run ncdump-rich ./demo/example.nc"
- command: "rye run ncdump-rich ./demo/example.nc"
title: Latest Rich NcDump
img_paths:
- ./demo/latest.png
4 changes: 0 additions & 4 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
pip==23.0
nox==2023.4.22
nox-poetry==1.0.2
poetry==1.2.2
virtualenv==20.19.0
11 changes: 7 additions & 4 deletions .github/workflows/latest-screengrab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,22 @@ jobs:
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Install Poetry
- name: Install Rye
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
poetry --version
curl -sSf https://rye-up.com/get | RYE_INSTALL_OPTION="--yes" bash
source "$HOME/.rye/env"
rye --version
- name: Install project to generate image
run: |
poetry install
source "$HOME/.rye/env"
rye sync -f
- name: Generate latest terminal images with rich-codex
uses: ewels/rich-codex@v1
with:
commit_changes: "false"
skip_git_checks: "true"
clean_img_paths: |
./demo/latest.png
Expand Down
21 changes: 12 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,18 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: "3.12"

- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Install Poetry
- name: Install Rye
run: |
pip install --constraint=.github/workflows/constraints.txt poetry
poetry --version
curl -sSf https://rye-up.com/get | RYE_INSTALL_OPTION="--yes" bash
source "$HOME/.rye/env"
rye --version
- name: Check if there is a parent commit
id: check-parent-commit
Expand All @@ -71,18 +72,20 @@ jobs:
uses: salsify/action-detect-and-tag-new-version@v2.0.3
with:
version-command: |
bash -o pipefail -c "poetry version | awk '{ print \$2 }'"
bash -o pipefail -c "rye version | awk '{ print \$2 }'"
- name: Bump version for developmental release
if: "! steps.check-version.outputs.tag"
run: |
poetry version patch &&
version=$(poetry version | awk '{ print $2 }') &&
poetry version $version.dev.$(date +%s)
source "$HOME/.rye/env"
rye version -b patch &&
version=$(rye version | awk '{ print $2 }') &&
rye version $version.dev.$(date +%s)
- name: Build package
run: |
poetry build --ansi
source "$HOME/.rye/env"
rye build
- name: Publish package on PyPI
if: steps.check-version.outputs.tag
Expand Down
39 changes: 22 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ jobs:
- { python-version: "3.10", os: ubuntu-latest, session: "tests" }
- { python-version: "3.11", os: ubuntu-latest, session: "mypy" }
- { python-version: "3.11", os: ubuntu-latest, session: "tests" }
- { python-version: "3.11", os: macos-latest, session: "tests" }
- { python-version: "3.11", os: windows-latest, session: "tests" }
- { python-version: "3.11", os: ubuntu-latest, session: "docs-build" }
- { python-version: "3.11", os: ubuntu-latest, session: "pre-commit" }
- { python-version: "3.11", os: ubuntu-latest, session: "typeguard" }
- { python-version: "3.11", os: ubuntu-latest, session: "xdoctest" }
- { python-version: "3.12", os: ubuntu-latest, session: "mypy" }
- { python-version: "3.12", os: ubuntu-latest, session: "ruff" }
- { python-version: "3.12", os: ubuntu-latest, session: "tests" }
- { python-version: "3.12", os: macos-latest, session: "tests" }
# - { python-version: "3.12", os: windows-latest, session: "tests" }
- { python-version: "3.12", os: ubuntu-latest, session: "docs-build" }
- { python-version: "3.12", os: ubuntu-latest, session: "pre-commit" }
- { python-version: "3.12", os: ubuntu-latest, session: "typeguard" }
- { python-version: "3.12", os: ubuntu-latest, session: "xdoctest" }

env:
NOXSESSION: ${{ matrix.session }}
Expand All @@ -42,15 +45,15 @@ jobs:
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Install Poetry
- name: Install Rye
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt poetry
poetry --version
curl -sSf https://rye-up.com/get | RYE_INSTALL_OPTION="--yes" bash
source "$HOME/.rye/env"
rye --version
- name: Install Nox
run: |
pipx install --pip-args=--constraint=.github/workflows/constraints.txt nox
pipx inject --pip-args=--constraint=.github/workflows/constraints.txt nox nox-poetry
nox --version
- name: Compute pre-commit cache key
Expand Down Expand Up @@ -79,6 +82,7 @@ jobs:
- name: Run Nox
run: |
source "$HOME/.rye/env"
nox --force-color --python=${{ matrix.python-version }}
- name: Upload coverage data
Expand All @@ -102,27 +106,28 @@ jobs:
- name: Check out the repository
uses: actions/checkout@v3

- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: "3.12"

- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Install Poetry
- name: Install Rye
run: |
pip install --constraint=.github/workflows/constraints.txt poetry
poetry --version
curl -sSf https://rye-up.com/get | RYE_INSTALL_OPTION="--yes" bash
source "$HOME/.rye/env"
rye --version
- name: Install Nox
run: |
pip install --constraint=.github/workflows/constraints.txt nox nox-poetry
pip install --constraint=.github/workflows/constraints.txt nox
nox --version
- name: Run codecov session
run: nox --sessions tests-3.11 coverage
run: nox --sessions tests-3.12 coverage
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
53 changes: 15 additions & 38 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,90 +1,67 @@
repos:
- repo: local
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-added-large-files
name: Check for added large files
stages: [commit]
entry: check-added-large-files
language: system
- id: check-toml

- repo: local
hooks:
- id: ruff_format
name: ruff_format
stages: [commit]
language: system
entry: poetry run ruff format src tests docs
entry: ruff format src tests docs
types: [python]

- id: ruff
name: ruff
stages: [commit]
language: system
entry: poetry run ruff --fix src tests docs
entry: ruff --fix src tests docs
types: [python]

- id: xdoctest
name: xdoctest
stages: [commit]
language: system
entry: poetry run xdoctest
entry: xdoctest
types: [python]

- id: pydocstringformatter
name: pydocstringformatter
stages: [commit]
language: system
entry: poetry run pydocstringformatter src tests docs
entry: pydocstringformatter src tests docs
types: [python]

- id: mypy
name: mypy
stages: [commit]
language: system
entry: poetry run mypy
entry: mypy
types: [python]
require_serial: true

- id: pydoclint
name: pydoclint
stages: [commit]
language: system
entry: poetry run pydoclint src tests docs
entry: pydoclint src tests docs
types: [python]
require_serial: true

- id: pytest
name: pytest
stages: [commit]
language: system
entry: poetry run pytest tests
entry: pytest tests
types: [python]
pass_filenames: false

- id: check-toml
name: Check Toml
entry: check-toml
language: system
types: [toml]

- id: check-yaml
name: Check Yaml
entry: check-yaml
language: system
types: [yaml]

- id: end-of-file-fixer
name: Fix End of Files
entry: end-of-file-fixer
language: system
types: [text]
stages: [commit, push, manual]

- id: trailing-whitespace
name: Trim Trailing Whitespace
entry: trailing-whitespace-fixer
language: system
types: [text]
stages: [commit, push, manual]

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.3.0
hooks:
Expand Down
2 changes: 0 additions & 2 deletions .rtx.toml

This file was deleted.

Binary file modified demo/latest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a5b19dd

Please sign in to comment.