You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+58-99Lines changed: 58 additions & 99 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,101 +6,48 @@ Advent of Code is an Advent calendar of small programming puzzles for a variety
6
6
7
7
#### Clone the Repository:
8
8
9
-
```
9
+
```bash
10
10
https://github.com/mbrickerd/advent-of-code-2024
11
11
```
12
12
13
13
#### Install Dependencies:
14
14
15
-
Poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. Poetry offers a lockfile to ensure repeatable installs, and can build your project for distribution.
16
-
17
-
For more information on how to install Poetry on your operating system, click [here](https://python-poetry.org/docs/#installation).
18
-
19
-
Once you have Poetry installed, run the following command from the root directory of this project:
20
-
21
-
```bash
22
-
poetry install
23
-
```
24
-
25
-
This command will also create a `.venv` virtual environment within your local project structure. Be sure to activate your newly created virtual environment before beginning with development with the appropriate command:
If you need to add additional packages or libraries as you develop, run the following command to update the `pyproject.toml`:
39
-
40
-
```
41
-
poetry add <package_name>
42
-
```
43
-
44
-
## Advent of Code configuration
15
+
This project uses `uv` for dependency management and `pre-commit` for maintaining code quality. Follow these steps to set up your development environment:
45
16
46
-
To interact directly with the Advent of Code platform (e.g., for downloading inputs or submitting answers), this framework requires two configuration files: `aoc_headers.json` and `aoc_session`. These files store essential metadata and session information necessary for authenticated requests.
17
+
1. First, install `uv`:
47
18
48
-
#### `aoc_headers.json`
19
+
**On Unix-like systems (Linux, macOS):**
20
+
```bash
21
+
curl -LsSf https://astral.sh/uv/install.sh | sh
22
+
```
49
23
50
-
This file contains HTTP headers used for all requests made to the Advent of Code platform. The most important header is the User-Agent, which helps identify your automated requests to the Advent of Code servers.
This ensures requests conform to the platform's API requirements and helps identify your script to the Advent of Code servers.
74
-
75
-
#### `aoc_session`
76
-
77
-
This file stores the session token obtained from the Advent of Code website after logging into your account. It is required for authentication and allows access to personalized inputs and submission capabilities.
78
-
79
-
To obtain your session token:
33
+
```bash
34
+
make install
35
+
```
80
36
81
-
1. Log into [Advent of Code](https://adventofcode.com)
37
+
This command will:
38
+
- Install all project dependencies using `uv`
39
+
- Set up pre-commit hooks for code quality
82
40
83
-
2. Open your browser's Developer Tools:
84
-
- Chrome/Edge: Press F12 or Ctrl+Shift+I
85
-
- Firefox: Press F12 or Ctrl+Shift+I
86
-
- Safari: Enable 'Show Develop menu in menu bar' in Preferences > Advanced, then press Cmd+Option+I
41
+
3. Individual development tools can be managed using make commands:
87
42
88
-
3. Navigate to:
89
-
- Chrome/Edge: Application > Cookies > https://adventofcode.com
90
-
- Firefox: Storage > Cookies
91
-
- Safari: Storage > Cookies
92
-
93
-
4. Find the cookie named "session"
94
-
95
-
5. Copy its value into the `aoc_session` file
96
-
97
-
Example content:
98
-
99
-
```plaintext
100
-
abc123yourlongsessiontokenhere
101
-
```
102
-
103
-
This file provides authentication for downloading your unique puzzle inputs and submitting solutions under your account.
43
+
```bash
44
+
make help# Show all available commands
45
+
make lint # Run ruff linting checks
46
+
make format # Format code and organize imports
47
+
make type-check # Run mypy type checking
48
+
make test# Run pytest
49
+
make all # Run format, lint, type-check, and test
50
+
```
104
51
105
52
## Project structure
106
53
@@ -115,31 +62,34 @@ This repository is a modular and efficient framework designed to manage and solv
115
62
│ ├── __init__.py
116
63
│ ├── models
117
64
│ │ ├── __init__.py
118
-
│ │ ├── base.py # Base class definitions for shared functionality
├── main.py # Main script to manage tasks and run solutions
91
+
├── Makefile # Development workflow automation
92
+
├── pyproject.toml # Project dependencies and configuration
143
93
└── README.md
144
94
```
145
95
@@ -154,7 +104,7 @@ This is the core package for the project. It includes:
154
104
155
105
#### `solutions/`
156
106
157
-
Contains the solution files for each day's challenge. Each file represents a self-contained solution where you implement logic for both parts of the day’s task.
107
+
Contains the solution files for each day's challenge. Each file represents a self-contained solution where you implement logic for both parts of the day's task.
158
108
159
109
#### `templates/`
160
110
@@ -178,10 +128,19 @@ The central script to perform various tasks such as:
178
128
179
129
Provides convenient commands for common development tasks:
0 commit comments