Skip to content

Instantly share code, notes, and snippets.

@xypnox
Created September 3, 2019 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save xypnox/35935d5de8a2e8574e60167bb8fdee56 to your computer and use it in GitHub Desktop.
Save xypnox/35935d5de8a2e8574e60167bb8fdee56 to your computer and use it in GitHub Desktop.
Python packages

Creating Python Packages

Python packages are complex but not complicated, I believe that once you have created one package you will develop confidence and experience to publish more of them. While trying to deploy my project on pypi, I followed the following two guides quite helpful:

I mostly stuck to the first tutorial and only used the second one for additional reference and a different perspective. You can see my setup.py file for reference. To get an idea about which commands I run to build and distribute the project you can see my Makefile. If you do not use a virtual environment for your project I will suggest you to look into pipenv, It helps a lot in managing dependencies required for the project and is very simple to use.

I do think that there is a lot of room for improvement in the packaging system of python in general. Let us hope that they simplify the commands and streamline the process.

If you get stuck on anything, feel free to reach out!

Pip freeze for Ubuntu in virtual env adds pkg-resources package to the requirements which is fucked up because this is a fuck up. More details can be found at: What is “pkg-resources==0.0.0” in output of pip freeze command.

Recommended solution:

freeze:
    pip freeze | grep -v "pkg-resources" > requirements.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment