Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to uv from rye and add isort to ruff linting toolset #57

Merged
merged 4 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ jobs:
# Checkout repo
- name: Checkout
uses: actions/checkout@v3
# Install rye with cache
- name: Install the latest version of rye
uses: eifinger/setup-rye@v4
# Install uv with cache
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
# Sync dependencies
- name: Sync dependencies
run: rye sync
# Run tests
run: uv sync
# Run tests without updating uv.lock
- name: Run tests
run: rye test
run: uv run --frozen pytest
# Code coverage to codecov.io
- name: Upload results to Codecov
uses: codecov/codecov-action@v4
Expand All @@ -61,17 +61,17 @@ jobs:
# Checkout repo
- name: Checkout
uses: actions/checkout@v3
# Install rye with cache
- name: Install the latest version of rye
uses: eifinger/setup-rye@v4
# Install uv with cache
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
# Sync dependencies
- name: Sync dependencies
run: rye sync
run: uv sync
# Build
- name: Build
run: rye build
run: uv build
# Publish to PyPI
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ repos:
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
args: [ --select=I, --fix ]
# Run the formatter.
- id: ruff-format
20 changes: 13 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ If you are proposing a feature:
Ready to contribute? Here's how to set up `isp-workbook-parser` for local development.

1. Download a copy of `isp-workbook-parser` locally.
2. Install [`rye`](https://rye.astral.sh/).
3. Install `isp-workbook-parser` using `rye` by running `rye sync` in the project directory.
4. Install the `pre-commit` git hook scripts that `isp-workbook-parser` uses by running the following code using `rye`:
2. Install [`uv`](https://github.com/astral-sh/uv).
3. Install `isp-workbook-parser` using `uv` by running `uv sync` in the project directory.
4. Install the `pre-commit` git hook scripts that `isp-workbook-parser` uses by running the following code using `uv`:

```console
$ rye run pre-commit install
$ uv run pre-commit install
```

5. Use `git` (or similar) to create a branch for local development and make your changes:
Expand All @@ -80,9 +80,15 @@ Ready to contribute? Here's how to set up `isp-workbook-parser` for local develo
$ git checkout -b name-of-your-bugfix-or-feature
```

6. When you're done making changes, check that your changes conform to any code formatting requirements and pass any tests. That is:
- Use the the `ruff` formatter bundled with `rye` by running `rye fmt`
- Run tests by running `rye test`
6. When you're done making changes, check that your changes conform to any code formatting requirements (we use [`ruff`](https://github.com/astral-sh/ruff)) and pass any tests.
- `pre-commit` should run `ruff`, but if you wish to do so manually, run the following code to use `ruff` as a `uv` [tool](https://docs.astral.sh/uv/concepts/tools/):

```bash
uvx ruff check --fix
uvx ruff format
```

- Run tests by running `uv run --frozen pytest`

7. Commit your changes and open a pull request.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Continuous Integration and Deployment](https://github.com/Open-ISP/isp-workbook-parser/actions/workflows/cicd.yml/badge.svg)](https://github.com/Open-ISP/isp-workbook-parser/actions/workflows/cicd.yml)
[![codecov](https://codecov.io/github/Open-ISP/isp-workbook-parser/graph/badge.svg?token=BUGWITKZV1)](https://codecov.io/github/Open-ISP/isp-workbook-parser)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/Open-ISP/isp-workbook-parser/main.svg)](https://results.pre-commit.ci/latest/github/Open-ISP/isp-workbook-parser/main)
[![Rye](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/rye/main/artwork/badge.json)](https://rye.astral.sh)
[![UV](https://camo.githubusercontent.com/4ab8b0cb96c66d58f1763826bbaa0002c7e4aea0c91721bdda3395b986fe30f2/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f61737472616c2d73682f75762f6d61696e2f6173736574732f62616467652f76302e6a736f6e)](https://github.com/astral-sh/uv)

A Python package for reading data from the Inputs, Assumptions and Scenarios Report (IASR) Microsoft Excel workbook
published by the Australian Energy Market Operator for use in their Integrated System Plan modelling.
Expand Down
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ requires-python = ">= 3.9"
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[tool.rye]
[tool.uv]
managed = true
dev-dependencies = [
"pre-commit>=3.8.0",
"ipython>=8.26.0",
"ipython>=8.0",
"ipdb>=0.13.13",
"pytest>=8.3.2",
"pytest-cov>=5.0.0",
Expand All @@ -39,6 +39,12 @@ testpaths = ["src", "tests"]
# --cov-branch runs branch coverage
addopts = "-ra --doctest-modules --cov=src/ --cov-branch --cov-report xml:tests/coverage.xml --cov-report html:tests/htmlcov"

[tool.ruff.lint]
select = [
# isort
"I",
]

[tool.setuptools.packages.find]
where = ["src"]

Expand Down
104 changes: 0 additions & 104 deletions requirements-dev.lock

This file was deleted.

43 changes: 0 additions & 43 deletions requirements.lock

This file was deleted.

4 changes: 3 additions & 1 deletion tests/test_packaged_table_configs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from pathlib import Path

import pytest

from isp_workbook_parser import Parser
from pathlib import Path

workbook_path = Path("workbooks")

Expand Down
2 changes: 1 addition & 1 deletion tests/test_validation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from isp_workbook_parser.parser import TableConfigError
from isp_workbook_parser.config_model import TableConfig
from isp_workbook_parser.parser import TableConfigError


def test_end_row_not_on_sheet_throws_error(workbook_v6):
Expand Down
Loading
Loading