TL;DR: Install my WSL-specific xdg-open replacement by following the instructions on the xdg-open-wsl github page.
Convert a Python script to a Python package with Poetry.
In my previous vxlabs post, I explained how to use Emacs lisp advising to fix buggy behaviour when opening Windows files from Emacs running on WSL.
In that post I mentioned my home-grown xdg-open replacement.
As I was writing that bit, I wondered how long it would take for the first astute reader to wonder about the mentioned script.
Sure enough, after two days the comment arrived, which was enough motivation to take the single-file script and upgrade it in the following ways:
- Add documentation.
- Write tests.
- Create a poetry configuration.
- Push to GitHub.
- Configure GitHub actions to run the tests automatically on each push and PR.
What I learned.
Long live Poetry.
Whilst a few months ago I did not think poetry was going to be able to fill the hole that pipenv (RIP) has left, going so far as to doubt seriously the single-focus mindset of its developer sdispater, I have come to realise that I was quite wrong.
sdispater took upon himself the exceptionally difficult task of saying “no” most of the time (also known as vision), but this has contributed substantially to the exceptional dependency management tool that poetry has become.
In the case of this simple package, it was a cinch setting up package metadata
and dependencies, all in the single
From here anyone can setup a new development environment by doing
I can build wheels and sdists by doing
poetry build and publish to pypi (TBD)
Thanks to PEP 517 and 518
users can install straight from github using a recent pip, no
Setting up GitHub actions for CI using poetry and pytest is straight-forward.
After having written some pytest tests, the skeleton of which
poetry new your-new-package helpfully sets up for you, getting these tests to run
automatically on github took only a few minutes of searching and then creating
file which uses the Python Poetry Action from the GitHub