[Brendan Herger] was warned that the process of publishing a Python package would be challenging. He relishes a challenge, however, and so he went at it with gusto. The exhausting process led him to share a cheat sheet for publishing Python packages with the goal of making the next time smoother, while also letting other people benefit from his experience and get a running start.
[Brendan] describes publishing a Python package as “tying together many different solutions with brittle interchanges.” His cheat sheet takes the form of an ordered workflow for getting everything in place, with some important decisions and suggestions about things like formatting and continuous integration (CI) made up-front.
The guide is brief, but [Brendan] has made errors and hit dead ends in the hopes that others won’t have to. The whole thing came about from his work in deep learning, and his desire to create a package that allows rapid building and iterating on deep learning models.
Deep learning is a type of machine learning that involves finding representations in large amounts of data. [Brendan] used it in a project to automatically decide whether a Reddit post contains Star Wars plot spoilers, and we recently saw it featured in a method of capturing video footage only if a hummingbird is present.
It’s interesting how many times I’ve documented something for “the internet” and it ends up being really helpful for me to remember whatever it was later.
This is mostly what I use GitHub for. If other people benefit from it then great, but it’s mostly so that when I come back in 6 months and can’t remember a thing about my project there’s a handy guide pitched at idiot-level to teach me what I once knew. It’s about current-you doing future-you a favour.
Agree with the Cook and Shoe totally – I have both public and private instances of PHPBB I use for that. The junk I think might help someone else – public. The stuff that’s peculiar to my setups like their peculiar sysadmin settings, or that it’s kind of embarrassing to admit I don’t memorize goes into the private one. Searchability rocks!
The meat is here:
https://packaging.python.org/tutorials/packaging-projects/#creating-setup-py
I would also add this (funny and well-written) guide to Python Entry Points:
https://amir.rachum.com/blog/2017/07/28/python-entry-points/
Entry points drop an entry in your $PATH to allow you to call $ my_py_program directly,
instead of having to run $ python my_py_program