Skip to content

Dheebz/pysleigh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pysleigh

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.

Features

  • 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.

Installation

Requirements

  • Python 3.7 or newer.
  • A valid Advent of Code session cookie (stored in the environment variable AOC_SESSION or a configuration file).

Steps

  1. Clone the repository:

    git clone https://github.com/Dheebz/pysleigh.git
    cd pysleigh
  2. Install the package:

    pip install .
  3. Verify installation:

    pysleigh --help

Configuration

Pysleigh requires a configuration file to specify paths for inputs, articles, and solutions, as well as your Advent of Code session cookie.

Default Configuration

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

Usage

CLI Commands

Pysleigh provides multiple commands to manage Advent of Code workflows:

Fetch Input

pysleigh fetch-input-cli 2022 1 --overwrite --dry-run

Fetches the input for the specified year and day.

Fetch Article

pysleigh fetch-article-cli 2022 1 --overwrite --dry-run

Fetches and formats the problem description for the specified year and day.

Create Solution

pysleigh create-solution-cli 2022 1 --overwrite --dry-run

Creates a solution template for the specified year and day.

Run Solution

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.

Submit Solution

pysleigh submit-solution-cli 2022 1 1 --answer 1234 --dry-run

Submits the solution for the specified year, day, and part.

Prepare Day

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.

Interactive Mode

Launch the interactive mode to manage tasks dynamically:

pysleigh interactive

Directory Structure

.
├── 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

Contributing

Contributions are welcome! Please open an issue or submit a pull request to contribute to Pysleigh.

License

Pysleigh is licensed under the MIT License.

Acknowledgements

  • Advent of Code by Eric Wastl.
  • Python community for libraries like requests,bs4 and typer.

Happy coding!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages