Playing around with Advent of Code
I use the following steps in Windows.
- Install python: Install the latest Python 3 version from https://www.python.org/downloads
- Install git and Git Bash: Install the latest git version from https://git-scm.com/downloads
- Launch Git Bash to perform the remaining steps:
- git clone https://github.com/justinbeetle/advent_of_code.git
- cd advent_of_code
- python -m venv venv
- source venv/Scripts/activate
- pip install .
- (Optional) Save a session token from a browser cookie to token.txt: echo <session_token> > token.txt
Finding a session token in Chrome:
- Navigate to Advent of Code and log in
- Launch developer tools: CTRL-SHIFT-I
- Go to the Application tab
- On the sidebar, navigate to Storage -> Cookies -> https://adventofcode.com/
- Copy the value of the session key
Launch Git Bash and perform the following steps:
- cd advent_of_code
- source venv/Scripts/activate
- Run any of the problem scripts: 2022/01/p1.py
Launch Git Bash and perform the following steps:
- cd advent_of_code
- source venv/Scripts/activate
- pip install -r dev-requirements.txt
- Run black: python -m black src 20*
- Run mypy: python -m mypy src/aoc/*.py --strict
- Run pylint: python -m pylint $(git ls-files 'src/*.py')
- Run pytest: python -m pytest