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.

Document how to use setup.cfg with find_packages and the src layout

See original GitHub issue

When trying to create an MWE for #1436, I found it very hard to find the right syntax for using the src layout from setup.cfg. Here’s what I landed on:

[options]
package_dir=
 =src
packages=find:
        where=src

It would be nice to see this in the documentation somewhere as it’s a pretty common layout (and I daresay probably should be the preferred layout).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

12reactions
madigcommented, Oct 27, 2018

Got it, setup.cfg must look like this:

[metadata]
name=xxxyyy
version=0.0.1

[options]
package_dir=
    =src
packages=find:

[options.packages.find]
where=src

This also works with pip 10.0.1 and setuptools 39.0.1.

0reactions
madigcommented, Oct 27, 2018

Next stop: putting in a piece of documentation somewhere.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Package Discovery and Namespace Packages - Setuptools
cfg ), find_namespace_packages() (setup.py) and find (pyproject.toml) will scan all folders that you have in your project directory if you use a flat-layout....
Read more >
python setuptools setup.cfg: Including main- and subpackages ...
Using the directory layout in your example, I found a couple configurations that worked. Both of these allowed me to import all modules...
Read more >
Package Discovery and Namespace Package
To use it, consider the following directory. mypkg/ src/ pkg1/__init__.py pkg2/__init__.py additional/__init__.py setup.cfg #or setup.py.
Read more >
Using Package Data in Python Projects with Setuptools
Including Package Data via setup.py/setup.cfg ... MANIFEST.in command “graft packagename” (or “graft src” if you're using a src/ layout).
Read more >
python packaging: basic setup.py and declarative ... - YouTube
today I go over a basic setup.py for packaging a python package. I then show a few tools you can use to migrate...
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