hachyderm.io is one of the many independent Mastodon servers you can use to participate in the fediverse.
Hachyderm is a safe space, LGBTQIA+ and BLM, primarily comprised of tech industry professionals world wide. Note that many non-user account types have restrictions - please see our About page.

Administered by:

Server stats:

9.7K
active users

Itamar Turner-Trauring

So there was a time when if you wanted compiled extensions in your Python project, but you didn't want to install a _package_, you'd have a setup.py, and you'd do:

python setup.py build_ext -i

Thing is, calling setup.py directly is now deprecated.

Is there any way to do the above that isn't calling setup.py? I've seen a suggestion of calling setuptools internal API directly, which ... ok, I guess. But wondering what people do in practice. Just make everything compiled an installable package?

"pip install -e ." is not equivalent! E.g. if you're using setuptools-rust it will build in non-release mode.

EDIT: To clarify, what are people using setuptools doing? I understand other tools may have options for this.

I went and tried "setup.py build_ext -i" and... it's not deprecated? No warnings, anyway, still works fine. So just gonna go with it still.

@melissawm I should look at that, yeah, but the question isn't really what tool should I use in my own code project.

Rather, it's how can I support this ability in a dockerizing template that's supposed to work with random projects' build systems that likely use setuptools.

(Right now the template uses "setup.py build_ext -i".)

@itamarst I would normally aim for a package that encapsulates this at build time, yea. If I really wanted to avoid that, I'd probably hold my nose and use the deprecated command, or write my own automation to drive the relevant compilation. In practice I've only done the former in production, but I *have* done the latter for examples in my 'playground' where I whittle down reproducers or write little demos/prototypes