setup.py VS pex

Compare setup.py vs pex and see what are their differences.

pex

A tool for generating .pex (Python EXecutable) files, lock files and venvs. (by pex-tool)
Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
setup.py pex
5 9
5,065 2,454
- 0.8%
0.0 8.9
about 1 year ago 7 days ago
Python Python
MIT License Apache License 2.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

setup.py

Posts with mentions or reviews of setup.py. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-11-16.
  • Could I get some basic info on pyproject.toml please?
    1 project | /r/learnpython | 19 Feb 2022
    When I look at projects using the toml files exclusively without a setup.py in the project, I noticed something. No one is taking setup.py best practices and applying them where applicable to their toml files. What I mean by that is - take a look at navdeep-g's setup.py. I'm assuming `.toml` files can't import a `__version.py__` file and do other py things? What about something like,
  • How do I stay organized and define milestones?
    1 project | /r/learnpython | 19 Feb 2022
    Yesterday I was curious how the Requests library was doing something, which led me down a rabbit hole to navdeep-G's setup.py and I rewrote my setup.py to be one of the best setup.pyfiles I've ever written.. But I should have been revising my main module. I did need to rewrite my setup.py, but the point is - it should have been on a to do list and set aside as its own thing. But I just kind of found a rhythm and things were really clicking, so I went with it.
  • I am frustrated with packaging python, please educate me.
    2 projects | /r/Python | 16 Nov 2021
    Here is a wonderful setup.py template I like to use: https://github.com/navdeep-G/setup.py. But to be fair, I have also switched to poetry in the last year.
  • What the Fu-k Python?
    5 projects | news.ycombinator.com | 10 Feb 2021
    * Popular libraries for various use cases (i.e. Django/Flask for web applications)

    setup.py (for humans) - https://github.com/navdeep-G/setup.py

  • Hi Guys! I wrote my first useful program and I'd like to share it with all of you!
    1 project | /r/learnpython | 12 Jan 2021
    This is my favorite setup.py example.

pex

Posts with mentions or reviews of pex. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-06-15.
  • Our Plan for Python 3.13
    10 projects | news.ycombinator.com | 15 Jun 2023
    We get (very) close to cross-environment reproducible builds for Python with https://github.com/pantsbuild/pex (via Pants). For instance, we build Linux x86-64 artifacts that run on AWS Lambda, and can build them natively on ARM macOS.

    This is not raw requirements.txt, but isn’t too far off: Pants/PEX can consume one to produce a hash-pinned lock file.

  • Is it possible pickle a function with its dependencies?
    4 projects | /r/Python | 6 May 2023
    You should look into pex, or it’s parent build system pants. A PEX (Python EXecutable) file can package up all your code including dependencies and run on another machine of similar OS with just an available compatible interpreter.
  • Pex: Python EXecutable
    1 project | news.ycombinator.com | 7 Mar 2023
  • security risks in python libs
    1 project | /r/learnpython | 12 Sep 2022
    For well-supported libraries, pip-audit might do the trick. Where I've worked, we have used a central build system with library version enforcement. The build system produces a deployable archive, like PEX or similar. Rock-solid tests and sandbox validation environments provide good paths for version upgrades. Restricting libraries to a small set, making sure those repos remain actively developed, performing audits and centralizing builds has helped organizations I've worked in keep on top of potential security issues.
  • My latest blogpost, python packaging has moved forward, but we're still missing a crucial part - what do you think?
    1 project | /r/Python | 29 Jan 2022
  • PyBake: Create single file standalone Python scripts with builtin frozen file system
    2 projects | /r/Python | 23 Jan 2022
  • I am frustrated with packaging python, please educate me.
    2 projects | /r/Python | 16 Nov 2021
  • A function decorator that rewrites the bytecode to enable goto in Python
    5 projects | news.ycombinator.com | 20 Sep 2021
    Don't know if I agree about the goto thing, but there are actually a number of options now for delivering varying degrees of self-contained Python executable.

    When I evaluated the landscape a few years ago, I settled on PEX [1] as the solution that happened to fit my use-case the best— it uses a system-provided Python + stdlib, but otherwise brings everything (including compiled modules) with it in a self-extracting executable. Other popular options include pyinstaller and cx_freeze, which have different tradeoffs as far as size, speed, convenience, etc.

    [1]: https://github.com/pantsbuild/pex

  • Mypyc: Compile type-annotated Python to C
    6 projects | news.ycombinator.com | 23 Feb 2021
    Somewhat related, I had a devil of a time a little bit ago trying to ship a small Python app as a fully standalone environment runnable on "any Linux" (but for practical purposes, Ubuntu 16.04, 18.04, and 20.04). It turns out that if you don't want to use pip, and you don't want to build separate bundles for different OSes and Python versions, it can be surprisingly tricky to get this right. Just bundling the whole interpreter doesn't work either because it's tied to a particular stdlib which is then linked to specific versions of a bunch of system dependencies, so if you go that route, you basically end up taking an entire rootfs/container with you.

    After evaluating a number of different solutions, I ended up being quite happy with pex: https://github.com/pantsbuild/pex

    It basically bundles up the wheels for whatever your workspace needs, and then ships them in an archive with a bootstrap script that can recreate that environment on your target. But critically, it natively supports the idea of targeting multiple OS and Python versions, you just explicitly tell it which ones to include, eg:

        --platform=manylinux2014_x86_64-cp-38-cp38   # 16.04

What are some alternatives?

When comparing setup.py and pex you can also consider the following projects:

versioningit - Versioning It with your Version In Git

mypyc - Compile type annotated Python to fast C extensions

wtfpython - What the f*ck Python? 😱

python-goto - A function decorator, that rewrites the bytecode, to enable goto in Python

pip-tools - A set of tools to keep your pinned Python dependencies fresh.

pyBake - Create single file standalone Python scripts with builtin frozen file system

deno - A modern runtime for JavaScript and TypeScript.

plusplus - Enables increment operators in Python using a bytecode hack

awesome-python - An opinionated list of awesome Python frameworks, libraries, software and resources.

typed_python - An llvm-based framework for generating and calling into high-performance native code from Python.

mypyc-benchmark-results - Mypyc benchmark result data

pyccel - Python extension language using accelerators