The PyPI name was taken, so I shipped a sha256-pinned wheel from GitHub Releases
A few months ago I went to publish a small Python library and hit the least dramatic, most annoying problem in packaging: the name I wanted was already on PyPI. Not a squatter, not a malicious lookalike. Someone else simply got there first.
I could have renamed it. I didn't want to. The library does one narrow thing - it runs untrusted text as argv instead of shell syntax - and the name said exactly that. Adding -py or -real would have made people trust it less, not more. So I shipped it as a wheel from a GitHub Release. Here is what that actually looks like, including the mistake I made first.
The install line
pip install https://github.com/derbaroser-eng/shellguard-lib/releases/download/v1.5.1/shellguard-1.5.1-py3-none-any.whl That is the whole install. No index lookup, no name collision, no dependency resolution - the package has zero dependencies and supports Python 3.8+. The wheel is 18,206 bytes.
Pin the bytes, not just the URL
A URL tells you where a file came from. It says nothing about whether the file is still the one you reviewed. So the README also records the digest:
sha256:88224e4f5df6b54c1b36d221abe7aab739ba037b47076cafaf7f2dc885328ac1 If you want to be strict about it, download the wheel, check the hash, then install the local file. In CI, pinning the digest is the difference between "we tested something" and "we tested this exact build."
That matters more here than usual. A shell-injection library that gets silently swapped for a different build is a genuinely bad outcome. A digest is cheap insurance, and there is no reason not to print it beside the install command.
The mistake I made first
The first version of the README linked the release tag page, not the asset. pip does not follow a tag page to discover a wheel inside it - it needs the direct asset URL. I spent an embarrassingly long time staring at a 404 before I noticed. If your install line ends in /tag/v1.5.1, it is wrong.
The second thing I got wrong: I assumed a wheel from a Release would show up in pip search. It does not. There is no index entry at all. That is the trade-off you accept when you skip PyPI, and it is fine for a tool people find through a README or an article rather than a search.
What you give up
Be honest about this before someone finds out the hard way:
- No
pip install shellguard. The install line is long and copy-paste oriented. - No upgrade notification. Pinning means you choose when to move.
- A Release can be deleted. The digest protects you from change, not from disappearance; mirror the wheel if this is load-bearing for you.
In exchange you get a deterministic artifact with no namespace politics and no dependency surprises. For a 142-test library with one job, that is a fair deal.
About the license
The source is MIT and always will be. There is also a commercial license - EUR 49 once - for teams that want to embed it in a proprietary product without MIT attribution, plus an offline license key and email support. The free source, the tests and the full write-up are on the site: https://derbaroser-eng.github.io/shellguard/. If you just want to keep the work going, there is a pay-what-you-can link there too.
The sh -c argv trap and the scanner rule that catches it are written up here: https://derbaroser-eng.github.io/shellguard/blog/sha256-pinned-wheel.html. That one is a proper write-up, not a sales page.
- Elena Brandt