Skip to content

Commit 50b06e0

Browse files
authored
Merge pull request #9 from IsaacCheng9/convert-to-uv
Convert from Poetry to UV
2 parents 2e8b651 + 6d52427 commit 50b06e0

7 files changed

Lines changed: 472 additions & 1008 deletions

File tree

.github/workflows/format.yml

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,26 @@ name: Format
22

33
on: [push]
44

5+
permissions:
6+
contents: write
7+
58
jobs:
69
format:
710
runs-on: ubuntu-latest
8-
strategy:
9-
matrix:
10-
python-version: [3.14.x]
11-
1211
steps:
13-
- uses: actions/checkout@v3
12+
- uses: actions/checkout@v4
1413

15-
- name: Run Python code formatting with Black
16-
uses: lgeiger/black-action@v1.0.1
14+
- name: Ruff format
15+
uses: astral-sh/ruff-action@v3
1716
with:
18-
args: "."
17+
args: format
1918

20-
- name: Commit changes made by Black
21-
uses: stefanzweifel/git-auto-commit-action@v5
19+
- name: Ruff lint (fix)
20+
uses: astral-sh/ruff-action@v3
2221
with:
23-
commit_message: Format Python code with Black
24-
25-
- name: Switch to current branch
26-
run: git checkout ${{ env.BRANCH }}
22+
args: check --fix
2723

28-
- name: Set up Python ${{ matrix.python-version }}
29-
uses: actions/setup-python@v3.1.4
24+
- name: Commit changes made by Ruff
25+
uses: stefanzweifel/git-auto-commit-action@master
3026
with:
31-
python-version: ${{ matrix.python-version }}
27+
commit_message: Format Python code with Ruff

.github/workflows/test.yml

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,36 @@
1-
name: test
1+
name: Test
22

3-
# Controls when the action will run.
43
on:
5-
# Triggers the workflow on push events but only for the main branch.
64
push:
7-
# Allows you to run this workflow manually from the Actions tab.
85
workflow_dispatch:
96

107
jobs:
118
test:
12-
# The type of runner that the job will run on.
139
runs-on: ubuntu-latest
14-
# Configures the build to use the latest version of Python 3.
1510
strategy:
1611
matrix:
17-
python-version: [3.14.x]
12+
python-version:
13+
- "3.14.x"
1814

1915
steps:
20-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can
21-
# access it.
22-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@main
2317

2418
- name: Switch to current branch
2519
run: git checkout ${{ env.BRANCH }}
2620

2721
- name: Set up Python ${{ matrix.python-version }}
28-
uses: actions/setup-python@v1
22+
uses: actions/setup-python@main
2923
with:
3024
python-version: ${{ matrix.python-version }}
3125

32-
- name: Install Poetry
33-
run: |
34-
python -m pip install --upgrade pip
35-
pip install poetry
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@main
3628

37-
- name: Install Python dependencies with Poetry
38-
run: |
39-
poetry install
29+
- name: Install the project
30+
run: uv sync --all-extras --dev
4031

41-
- name: Run unit tests with Pytest
42-
run: poetry run coverage run --source=src/boruvkas_algorithm -m pytest -v
32+
- name: Run tests with Pytest
33+
run: uv run coverage run --source=src/boruvkas_algorithm/ -m pytest -v
4334

4435
- name: Get code coverage report
45-
run: poetry run coverage report -m
36+
run: uv run coverage report -m

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
# Boruvka's Algorithm
22

3-
[![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
43
[![Test](https://github.com/IsaacCheng9/boruvkas-algorithm/actions/workflows/test.yml/badge.svg)](https://github.com/IsaacCheng9/boruvkas-algorithm/actions/workflows/test.yml)
54

6-
An implementation of Boruvka's algorithm to find a minimum spanning tree in a graph.
5+
An implementation of Boruvka's algorithm to find a minimum spanning tree in a
6+
graph.
77

88
[Link to narrated video demonstration on YouTube.](https://www.youtube.com/watch?v=n5LNVobuBNU)
99

1010
## Example
11+
1112
<img width="481" alt="image" src="https://github.com/IsaacCheng9/boruvkas-algorithm/assets/47993930/70c6d09e-7273-4416-8194-f4fe37701ef2">
1213

1314
<details>
@@ -61,30 +62,33 @@ MST edges (node1, node2, weight):
6162
(7, 8, 3)
6263
MST weight: 29
6364
```
65+
6466
</details>
6567

6668
## Usage
6769

6870
### Installing Dependencies
6971

72+
Install [uv](https://docs.astral.sh/uv/) if you haven't already.
73+
7074
Run the following command from the [project root](./) directory:
7175

7276
```bash
73-
poetry install
77+
uv sync --dev
7478
```
7579

7680
### Running the Application
7781

7882
Run the following command from the [project root](./) directory:
7983

8084
```bash
81-
poetry run app
85+
uv run python -m src.boruvkas_algorithm.boruvka
8286
```
8387

8488
### Running Tests
8589

8690
Run the following command from the [project root](./) directory:
8791

8892
```bash
89-
poetry run pytest
93+
uv run pytest -v
9094
```

0 commit comments

Comments
 (0)