Skip to content

Commit

Permalink
✨ Replace poetry with uv (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
perdy committed Mar 4, 2025
1 parent 20fb505 commit bef6442
Show file tree
Hide file tree
Showing 24 changed files with 2,847 additions and 4,023 deletions.
26 changes: 5 additions & 21 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,28 @@ feature, which is why we encourage you to follow the procedure depicted above as
Our code formatting rules are implicitly defined by using multiple tools. You can check your code against these
standards by running:

```commandline
make lint
```

This is a meta-rule that runs all the utilities used for checking and applying Flama coding standards, but it can be
done individually as follows:

### Code formatting

Flama uses Black for formatting the code to adhere to the Black code style ([PEP 8](https://peps.python.org/pep-0008/)
compliant):
Flama uses Ruff for formatting the code ([PEP 8](https://peps.python.org/pep-0008/) compliant):

```commandline
make black
```

### Imports ordering

Isort is used to reorganize library imports:

```commandline
make isort
make format
```

### Code quality checking

Ruff is used to determine if the code quality is high enough as required to be accepted:

```commandline
make ruff
make lint
```

### Static type checking

Flama is completely static typed. To make sure your code fulfils this constraint, you can check it using mypy:
Flama is completely static typed. To make sure your code fulfils this constraint, you can check it using pyright:

```commandline
make mypy
make typecheck
```

This will automatically fix any style violations in your code.
Expand Down
29 changes: 17 additions & 12 deletions .github/workflows/test_and_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
container:
image: python:${{ matrix.python }}
steps:
- uses: actions/checkout@master
with:
Expand All @@ -35,20 +33,24 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python }}
enable-cache: true
cache-dependency-glob: "uv.lock"
- id: install
name: Install requirements
run: |
pip install pip poetry --upgrade
./scripts/install
name: Install project
run: ./scripts/install
- id: format
name: Code format checking
run: ./scripts/format --check .
- id: lint
name: Code linting
run: ./scripts/lint --output-format=github .
- id: types
- id: typecheck
name: Static types check
run: ./scripts/types
run: ./scripts/typecheck
- id: tests
name: Tests
run: ./scripts/test
Expand All @@ -68,9 +70,13 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Setup poetry
run: pip install pip poetry --upgrade
node-version: 22
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ env.DEFAULT_PYTHON }}
enable-cache: true
cache-dependency-glob: "uv.lock"
- id: semantic
name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
Expand All @@ -82,7 +88,6 @@ jobs:
@semantic-release/git
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
- name: New release published
if: steps.semantic.outputs.new_release_published == 'true'
run: |
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/test_pull_request_branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ jobs:
strategy:
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
container:
image: python:${{ matrix.python }}
steps:
- uses: actions/checkout@master
with:
Expand All @@ -23,20 +21,24 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python }}
enable-cache: true
cache-dependency-glob: "uv.lock"
- id: install
name: Install requirements
run: |
pip install pip poetry --upgrade
./scripts/install
name: Install project
run: ./scripts/install
- id: format
name: Code format checking
run: ./scripts/format --check .
- id: lint
name: Code linting
run: ./scripts/lint --output-format=github .
- id: types
- id: typecheck
name: Static types check
run: ./scripts/types
run: ./scripts/typecheck
- id: tests
name: Tests
run: ./scripts/test
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ repos:
exclude: "make"
- id: types
name: Static types check
entry: ./scripts/types
entry: ./scripts/typecheck
language: system
types: [file, python]
exclude: "(make|tests/|examples/)"
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ lint: ## Runs code linting
lint-fix: ## Runs code linting with autofixing
@./scripts/lint --fix .

types: ## Runs static types checking
@./scripts/types
typecheck: ## Runs static types checking
@./scripts/typecheck

docker_push: ## Push docker images to registry
@./scripts/docker_push .

.PHONY: help check clean install build tests publish version format lint lint-fix types docker_push
.PHONY: help check clean install build tests publish version format lint lint-fix typecheck docker_push
.DEFAULT_GOAL := help

help:
Expand Down
Loading

0 comments on commit bef6442

Please sign in to comment.