Skip to content

Commit 22ba36a

Browse files
committed
Simplified CI
1 parent 8b00677 commit 22ba36a

File tree

2 files changed

+22
-76
lines changed

2 files changed

+22
-76
lines changed

.github/workflows/python-ci.yml

Lines changed: 16 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -13,61 +13,25 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v4
1515

16-
- name: Set up Python
17-
uses: actions/setup-python@v5
18-
with:
19-
python-version: '3.11'
20-
2116
- name: Install uv
22-
run: |
23-
curl -LsSf https://astral.sh/uv/install.sh | sh
24-
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
17+
uses: astral-sh/setup-uv@v5
2518

26-
- name: Set up uv cache
27-
uses: actions/cache@v4
19+
- name: Enable caching
20+
uses: astral-sh/setup-uv@v5
2821
with:
29-
path: |
30-
~/.cache/uv
31-
~/.uv
32-
key: ${{ runner.os }}-uv-${{ hashFiles('**/pyproject.toml') }}
33-
restore-keys: |
34-
${{ runner.os }}-uv-
35-
36-
- name: Install dependencies with uv
37-
run: |
38-
# Create the virtual environment
39-
uv venv
40-
41-
# Install the project with both primary and dev dependencies
42-
# Since uv doesn't natively support dependency groups through extras yet
43-
# we'll install them separately for proper resolution
44-
uv pip install -e .
45-
46-
# Extract and install dev dependencies
47-
uv pip install ruff==0.3.4 mypy>=1.13.0,<2 types-requests>=2.32.0,<3.0.0 types-beautifulsoup4>=4.12.0,<5.0.0 types-networkx>=3.4.2 pytest>=8.3.4,<9
22+
enable-cache: true
4823

49-
- name: Debug environment
50-
run: |
51-
source .venv/bin/activate
52-
echo "Python version:"
53-
python --version
54-
echo "Installed packages:"
55-
pip list
24+
- name: Install the project
25+
run: uv sync --all-extras --dev
5626

5727
- name: Check formatting
58-
run: |
59-
source .venv/bin/activate
60-
python -m ruff format --check .
28+
run: uv run ruff format --check .
6129

6230
- name: Run linting
63-
run: |
64-
source .venv/bin/activate
65-
python -m ruff check .
31+
run: uv run ruff check .
6632

6733
- name: Run type checking
68-
run: |
69-
source .venv/bin/activate
70-
python -m mypy .
34+
run: uv run mypy aoc/ solutions/ templates/ tests/ main.py
7135

7236
test:
7337
name: Tests
@@ -76,38 +40,16 @@ jobs:
7640
steps:
7741
- uses: actions/checkout@v4
7842

79-
- name: Set up Python
80-
uses: actions/setup-python@v5
81-
with:
82-
python-version: '3.11'
83-
8443
- name: Install uv
85-
run: |
86-
curl -LsSf https://astral.sh/uv/install.sh | sh
87-
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
44+
uses: astral-sh/setup-uv@v5
8845

89-
- name: Set up uv cache
90-
uses: actions/cache@v4
46+
- name: Enable caching
47+
uses: astral-sh/setup-uv@v5
9148
with:
92-
path: |
93-
~/.cache/uv
94-
~/.uv
95-
key: ${{ runner.os }}-uv-${{ hashFiles('**/pyproject.toml') }}
96-
restore-keys: |
97-
${{ runner.os }}-uv-
98-
99-
- name: Install dependencies with uv
100-
run: |
101-
# Create the virtual environment
102-
uv venv
103-
104-
# Install the project
105-
uv pip install -e .
49+
enable-cache: true
10650

107-
# Install pytest
108-
uv pip install pytest>=8.3.4,<9
51+
- name: Install the project
52+
run: uv sync --all-extras --dev
10953

11054
- name: Run tests
111-
run: |
112-
source .venv/bin/activate
113-
python -m pytest tests/
55+
run: uv run pytest tests/

solutions/day23.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ def construct_graph(self, data: list[str]) -> nx.Graph:
4141
-------
4242
NetworkX Graph object representing the connection network
4343
"""
44-
graph = nx.Graph()
45-
graph.add_edges_from(line.split("-") for line in data)
44+
graph: nx.Graph = nx.Graph()
45+
edges = []
46+
for line in data:
47+
source, target = line.split("-")
48+
edges.append((source, target))
49+
graph.add_edges_from(edges)
4650
return graph
4751

4852
def part1(self, data: list[str]) -> int:

0 commit comments

Comments
 (0)