Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jzimbel/adventofcode-python
Python Solutions and Utilities for Advent of Code puzzles
https://github.com/jzimbel/adventofcode-python
advent-of-code advent-of-code-2018 adventofcode puzzle python python3
Last synced: 21 days ago
JSON representation
Python Solutions and Utilities for Advent of Code puzzles
- Host: GitHub
- URL: https://github.com/jzimbel/adventofcode-python
- Owner: jzimbel
- License: mit
- Created: 2018-12-23T10:02:06.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T06:34:51.000Z (about 2 years ago)
- Last Synced: 2024-11-30T10:12:30.546Z (25 days ago)
- Topics: advent-of-code, advent-of-code-2018, adventofcode, puzzle, python, python3
- Language: Python
- Homepage:
- Size: 199 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Advent of Code solutions
This project holds my Python solutions + utilities for **[Advent of Code](https://adventofcode.com/)** puzzles over the years.
## Run it
To run solutions and utilities, first you must install dependencies. I highly recommend using a virtual environment for this. I've been using `pipenv` for that lately.
```sh
pipenv install
# start a new shell within the virtualenv. The shell (and virtualenv) can be exited normally, with `exit` or Ctrl-D.
pipenv shell
```
Once that's done, you can run solutions like so:
```sh
python -m adventofcode run [-y ]
```
If the input for the solution you're trying to run hasn't already been saved in the `inputs` directory, the program will try to download it from the Advent of Code site first. If this is your first time downloading an input, you'll be asked to provide your unique session id. It's held in a cookie named `session` saved by the site--you can view it using your browser's dev tools or a number of cookie-viewing browser extensions.---
To set up solution and test directories for a new year of puzzles, run
```sh
python -m adventofcode init [-y ]
```
The year param is optional in both of the `adventofcode` commands, and if not specified the latest year listed in the solutions directory (or latest year + 1 for `init`) is used.
Note: this command's output will be nicer if you have the `tree` shell command installed!## Test it
Assuming you've installed dependencies as described above, you can run tests with the following:
```sh
# run all tests
PYTHONPATH=$(pwd) py.test
# run a specific test
PYTHONPATH=$(pwd) py.test path/to/test.py
```## Copy it
If you like the setup I've got here, feel free to use it yourself. Or let me know if it's garbage! This is my first time making a proper Python project from scratch, so I'm sure it's not perfect. ¯\\\_(ツ)\_/¯