I have a directory tree like this:
dir/
A/
__init__.py
something.py
I used find_packages
on dir/A
and expected it to find something.py
. However, it returned an empty list. How do I make find_packages
find something.py
as a package?
from setuptools import find_packages
packages = find_packages('c:/dir/A')
print(packages)
Function defined in setuptools find_packages(where='.', exclude=()) Return a list all Python packages found within directory 'where' 'where' should be supplied as a “cross-platform” (i.e. URL-style) path; it will be converted to the appropriate local path syntax.
The setup. cfg is an ini file, containing option defaults for setup.py commands. You can pretty much specify every keyword we used in the setup.py file in the new setup. cfg file and simply use the setup.py file as the command line interface.
You'd need to make it a package, it's a module right now. You would do this the same way you made the A
package: create a directory with the package name, include an __init__.py
file (in this case, you would rename something.py
to __init__.py
under the something
directory).
find_packages('c:/dir')
would find A
, since A
is a package under c:/dir
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With