Working on this post a little early because I overhauled the publishing pipeline's dependencies as a side effect of fixing a bug I had that was breaking Poetry in weird ways. I'm fairly confident it wasn't a Poetry bug, it's just that Poetry was able to reproduce it. My solution may have been... somewhat drastic: I uninstalled the Pythons that Homebrew was providing, and replaced them with pyenv. This had the unintentional effect of Marie-Kondo-ing my pip installation. I should probably make a requirements file for this folder, and hardcode the theme path.
Oh man, this one aspect of my system is getting way more organized now. This is exciting! I could probably install Anaconda now without getting mad at it, but let's not go crazy.
Let's take stock:
- I've installed pyenv and pyenv-virtualenv.
- I've used them to install Pythons 2.7.16, 3.7.3, and 3.8-dev.
- I can't think of any reason to keep using 2.7 besides Mercurial, which is working on a Python 3-compatible release.
- Oh yeah, whatever was keeping me from just pip-installing Mercurial before, is fixed now, so that let me uninstall it from Homebrew.
- I've got completely empty output from pip freeze currently, and I'd like to try to keep it that way by maintaining project-specific virtualenvs and requirements files.
- Speaking of which, I made virtualenvs for my text editors, so I can manage their Python requirements separately.
I'm not going to get too far on any projects now, but I want to try putting together one from scratch with this stuff. Cross my fingers I'll do better at working through the tutorial, because I'm going to try to rewrite the Python 3 roguelike tutorial in Coconut. And what better name to give to a vaguely medieval game in Python, than Dennis? Let's get the basics together.
- poetry new --src dennis
- cd dennis
- pyenv virtualenv 3.7.3 dennis
- pyenv local dennis 2.7.16 (Maybe I should give mercurial its own virtualenv so it's more obvious what's going on)
- pip install -U pip
- hg init
- poetry add --dev coconut -E all, poetry add --dev nox, poetry add --dev invoke, poetry add --dev bump2version (I'm thinking that I want things that interact with the source code, like transpilers, task runners, and helpers, to be dev dependencies, while things that interact with the installed package, like sphinx, hypothetically, would be optional dependencies)
- poetry install --no-root not merged yet, can't use that option, aww. For now, I'll just try to be careful.
- mkdir coconut-src, mkdir coconut-src/dennis, mkdir src/dennis/data
- (Save the spritesheet to the data folder)
- mv src/dennis/__init__.py coconut-src/dennis/__init__.coco
- Ponder whether having hgignore ignore all python files under src would break things. Guess I'll have to try it out.
- hg add everything, then commit
- (Discover that blowing away pip failed to uninstall coconut properly, what a surprise. I'll probably have a bunch of files I'll have to delete, oh well.)
- coconut coconut-src/ src
- poetry build
- Hm, yes, it completely didn't work. Actually, wait, it worked perfectly I think, Quick Look is just a dirty liar sometimes.
Okay, before I jump into anything else, I need to work out the tasks:
- Clean: delete stuff
- Build-coco: coconut coconut-src/ src, probably with other options
- Build: requires build-coco, poetry build
- nox: requires build, does some checks, not sure what, pytest, mypy maybe, could make docs
- bumpversion: takes parameter, let's say it passes the parameter to bump2version, then passes the result to poetry version. I dunno, it can do whatever, probably.
- touch noxfile.py tasks.py
- poetry remove -D pytest, poetry add --optional twine coverage pytest
- Add stuff to the noxfile and the tasks file.
- inv nox. Hm, the output isn't colorized. I'll try to fix that. Also, I didn't add configuration for pytest or coverage, so that's all wrong. I'll get on that now.
- Okay, I fixed the test and coverage configuration, got colors working, and added a "Private" trove classifier so I don't fumble-finger this onto anywhere. (I don't think it's that easy to accidentally upload to PyPI, but I don't really care.)
And now it's midnight. Tomorrow, I can try actually writing code.