question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for ext_modules in static setup.cfg

See original GitHub issue

In the process of porting an old project from the now defunct d2to1 I noticed a feature of d2to1 that is still missing from setuptools is support for configuring extension modules in setup.cfg.

At least, that’s what my reading of the source suggests, especially ConfigOptionsHandler

In d2to1 this looks something like:

[extension=<module_name>]
sources = <file1> <file2> ...
language = c
<keyword> = <value>

where each key/value pair correspond to setuptools.Extension arguments.

For setuptools it might look something more like:

[options.ext_modules.<module_name>]
<key>=<value>

Though I’m open to other suggestions for the format, and would be happy to provide a PR once we agree on and nail down a format.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:10
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
samvvcommented, Jun 8, 2021

Does there happen to be a roadmap for this? I’d be very interested to see this happen.

2reactions
embraycommented, Jul 6, 2020

I agree with your point about using a different delimiter to separate the config namespace from the module name. I’m fine with :, I think it’s a good choice.

One problem with all this I realized, is that while it would work fine for simple cases, I noticed that it’s still fairly common in several of my packages to involve a little bit of code in configuring extension modules. Most commonly was using numpy.get_include() to get the path to the Numpy headers. Another is using cythonize to build Cython modules. In d2to1 I believe I included special cases for both of these, but hard-coding special cases doesn’t scale well.

Of course, this could get arbitrarily complex to the point where not every case can be supported in a static config. I think there could be a way for code to provide extensions to the syntax while still allowing most of the configuration to be static. But maybe as a first pass it would be best to just implement the “obvious” static configuration and then figure out more complex cases later.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Building Extension Modules - Setuptools
Setuptools can build C/C++ extension modules. The keyword argument ext_modules of setup() should be a list of instances of the setuptools.Extension class.
Read more >
How to build a C extension in keeping with PEP 517, i.e. with ...
Any items that are dynamic or determined at install-time, as well as extension modules or extensions to setuptools , need to go into...
Read more >
2. Writing the Setup Script — Python 3.11.1 documentation
The Distutils' own setup script, shown here, is used to install the package into ... supports a great deal of flexibility in describing...
Read more >
static metadata for distutils - Fetchez le Python
from distutils.core import setup setup(name='MyDistribution', ... We wanted to extend the Metadata fields list in order to add a "requires" ...
Read more >
Build systems - pybind11 documentation
To use pybind11 inside your setup.py , you have to have some system to ensure ... and pybind11 supports all four: You can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found