11 votes

What's the current state-of-the-art in Python package creation/distribution?

I've been thinking on and off about packaging up a few simple Python utilities I've written to stick up on Github for people to use if they want, but, every time I go to check out how one goes about managing dependencies and all that for a project, I run into a whole wall of options. Does anyone better versed in all of this have any recommendations for me?

10 comments

  1. [4]
    dblohm7
    (edited )
    Link
    I’m going to offer a shoutout to my former colleague Greg, who just released PyOxidizer last year. EDIT: The elevator pitch for this is that it generates a single executable binary that embeds the...

    I’m going to offer a shoutout to my former colleague Greg, who just released PyOxidizer last year.

    EDIT: The elevator pitch for this is that it generates a single executable binary that embeds the interpreter, your project, and all its dependencies.

    10 votes
    1. Gyrfalcon
      Link Parent
      A way to package up a python application pretty much exactly like that is something I have wanted for a while. Definitely going to try this out!

      A way to package up a python application pretty much exactly like that is something I have wanted for a while. Definitely going to try this out!

      3 votes
    2. [2]
      mrbig
      Link Parent
      Please forgive my ignorance, but how is different from pyinstaller?

      Please forgive my ignorance, but how is different from pyinstaller?

      1. dblohm7
        Link Parent
        I have no idea TBH; I am not very well versed in the Python ecosystem.

        I have no idea TBH; I am not very well versed in the Python ecosystem.

        1 vote
  2. leigh
    Link
    If you want to build something you can put on PyPI and have people install with pip install yourpackage, Poetry is rapidly gaining popularity and is really lovely to work with. It's also useful...

    If you want to build something you can put on PyPI and have people install with pip install yourpackage, Poetry is rapidly gaining popularity and is really lovely to work with. It's also useful for things where you're making an end product that gets packaged in a Dockerfile, because it uses lock files.

    4 votes
  3. [3]
    Wes
    Link
    I'd be curious to know as well. Most of the time I see Python programs distributed as source files. That's fine for programmers, but less-so for regular people. I played around with some tools to...

    I'd be curious to know as well. Most of the time I see Python programs distributed as source files. That's fine for programmers, but less-so for regular people.

    I played around with some tools to generate executables about 10 years ago, but didn't love any of them. Maybe things have improved since then.

    A way to generate wasm files would be even more impressive. Assuming the gc problems have been solved.

    3 votes
    1. sqew
      Link Parent
      I think Python is in a bit of a weird position there. It's interpreted, but it's also known by so many people as their main/first language that there's a strong desire to write stuff like CLI...

      I think Python is in a bit of a weird position there. It's interpreted, but it's also known by so many people as their main/first language that there's a strong desire to write stuff like CLI tools in it and pass them around as you might a grep executable or something. Tough to standardize a way to pass around a self-contained binary for something that runs on an interpreter :(

      1 vote
    2. stu2b50
      Link Parent
      I mean it wouldn't really be possible to generate wasm files unless you packaged the entire python runtime in there.

      I mean it wouldn't really be possible to generate wasm files unless you packaged the entire python runtime in there.

  4. arghdos
    Link
    Pip is pretty standard, while a Conda package is pretty nice to have too (especially if you require any precompiled binaries or interfaces to C/CXX codes). This is a good place to start:...

    Pip is pretty standard, while a Conda package is pretty nice to have too (especially if you require any precompiled binaries or interfaces to C/CXX codes).

    This is a good place to start:

    https://packaging.python.org/tutorials/packaging-projects/

    3 votes
  5. TonyLozano
    Link
    Poetry is my new go-to tool for package setup but I tell users to use pipx to install the package https://poetry.eustace.io/ https://pypi.org/project/pipx/ Pipx installs the entry points user-wide...

    Poetry is my new go-to tool for package setup but I tell users to use pipx to install the package

    https://poetry.eustace.io/
    https://pypi.org/project/pipx/

    Pipx installs the entry points user-wide on the command line, but isolates each tool and its dependencies into a virtual environment automatically.

    2 votes