Pysleigh is a command-line tool for managing, running, and submitting solutions to Advent of Code challenges. With features like input fetching, article retrieval, and automatic solution templating, Pysleigh streamlines the Advent of Code experience.
- Fetch inputs and problem descriptions directly from Advent of Code.
- Create solution templates with minimal effort.
- Run and benchmark solutions.
- Submit answers and receive feedback instantly.
- Interactive mode for an enhanced user experience.
- Python 3.7 or newer.
- A valid Advent of Code session cookie (stored in the environment variable
AOC_SESSION
or a configuration file).
-
Clone the repository:
git clone https://github.com/Dheebz/pysleigh.git cd pysleigh
-
Install the package:
pip install .
-
Verify installation:
pysleigh --help
Pysleigh requires a configuration file to specify paths for inputs, articles, and solutions, as well as your Advent of Code session cookie.
The default configuration file is located at ~/.config/pysleigh/config.toml
. If it doesn't exist, Pysleigh will create one. Ensure the session cookie is set:
[session_cookie]
session_cookie = "your_session_cookie_here"
[inputs]
path = "~/Workspace/advent-of-code/input/"
[articles]
path = "~/Workspace/advent-of-code/articles/"
[solutions]
path = "~/Workspace/advent-of-code/solutions/"
Alternatively, set the session cookie as an environment variable:
export AOC_SESSION=your_session_cookie_here
Pysleigh provides multiple commands to manage Advent of Code workflows:
pysleigh fetch-input-cli 2022 1 --overwrite --dry-run
Fetches the input for the specified year and day.
pysleigh fetch-article-cli 2022 1 --overwrite --dry-run
Fetches and formats the problem description for the specified year and day.
pysleigh create-solution-cli 2022 1 --overwrite --dry-run
Creates a solution template for the specified year and day.
pysleigh run-solution-cli --year 2022 --day 1 --part 1 --benchmark --dry-run
Runs the solution for the specified year, day, and part, with optional benchmarking.
pysleigh submit-solution-cli 2022 1 1 --answer 1234 --dry-run
Submits the solution for the specified year, day, and part.
pysleigh prep-day-cli 2022 1 --overwrite --dry-run
Fetches the input, problem description, and creates a solution template for the specified year and day.
Launch the interactive mode to manage tasks dynamically:
pysleigh interactive
.
├── pysleigh/
│ ├── config.py
│ ├── create_solution.py
│ ├── fetch_article.py
│ ├── fetch_input.py
│ ├── __init__.py
│ ├── main.py
│ ├── run_solution.py
│ └── submit_solution.py
├── README.md
└── setup.py
Contributions are welcome! Please open an issue or submit a pull request to contribute to Pysleigh.
Pysleigh is licensed under the MIT License.
- Advent of Code by Eric Wastl.
- Python community for libraries like
requests
,bs4
andtyper
.
Happy coding!