Started compiling a helper lib here (I'm doing a separate thing where I solve these in languages I don't know well enough (Rust for now), but I'm going to give up halfway through the month and just use python) (maybe javascript)
But I'll attach an argsparse thing so it has the bare minimum amount of interoperability, maybe?
no, lol. But you might wanna look at the implementation for your own. I'm not putting a lot of work into this, which makes it pretty simple to see what's happening.
There are several much better libraries if you want something with a finished cli or more comprehensive python implementation, etc.
if they're doing an aoc2023 then maybe at that point
- create a .env file for the session token (in the root of the working dir probably) - not currently handling anonymous sessions
(technically one could avoid the config style header with python's dotenv lib, not doing that right now) internally, we're doing the following to read it:
[API] session=your_session_token
key = configparser.ConfigParser() key.read(".env") self.key = key.get("API", "session")
- import the utils
from aoc_2022.utils.day_handler import DayInterface from aoc_2022.utils.transforms import DataTransforms
- use the utils in a script
# get data aoc_interface = DayInterface(3) real_input = aoc_interface.get_day() # transform your data (bunch more options for some common patterns) info = DataTransforms(input).lines info = DataTransforms(input).group_lines(3) # do stuff # ... # test result # ... # submit aoc_interface.submit_day(solve_day(real_input)) aoc_interface.submit_day(solve_day_part_2(real_input), 2)
- use the cli (TODO! doesn't really have a lot of stuff going on yet)
UNTESTED
it's worth noting, of course,
# seems to work # pull down data python -m aoc_2022.tools.cli get > some.txt # submit data python -m aoc_2022.tools.cli submit --day 3 --year 2022 --part 2 -s 594 # where -s is the solution # generate template file python -m aoc_2022.tools.mkday_cli -d 11 -p ./path/to/days/day_11.py # creates a file with appropriate day numbering and testing segments # contains: solve function, 2 test functions, submit section # the option for languages is a placeholder and will not actually do anything right now
aoc_2022
is replaced bysrc.aoc_2022
in these cli instructions if one clones into the repo instead of pip installing the repo