2

I already had a look at the following question but I was not able to understand which is the solution...

I'm trying to write a setup.py file to build my code.

Here is the directory structure of the project:

project
|
├── setup.py
|
├── MANIFEST.in
|
├── package1
    ├── __init__.py
    ├── data.py
    |__ file.yml
    └── util_folder
├── package2
    ├── __init__.py
    ├── tool.py
    └── utils.py  
|___ script1.py
|___ script2.py

Here the main content of setup.py

setup(
     name = "MyProject",
     packages=['package1','package2'],
     include_package_data=True,
)

Here my MANIFEST.in to also include the util_folder under package1 and the two scripts located at the root folder.

include *.py
recursive-include package1 *

However, after running

python setup.py install

in my conda env, script1.py and script2.py are not copied to the destination, i.e.

path/to/my/conda/env/lib/python3.7/site-packages/MyProject-1.0-py3.7.egg/

Under that location I can see only package1 and package2.

What's wrong?

Fab
  • 1,145
  • 7
  • 20
  • 40

1 Answers1

2

Looks to me like you should probably do something like:

import setuptools
setuptools.setup(
    # ...
    py_modules=[
        'script1',
        'script2',
    ],
)

Note than in such a case the preferred denomination is module, instead of script. From my point of view scripts are meant to be called and executed directly, and modules are meant to be imported.

sinoroc
  • 18,409
  • 2
  • 39
  • 70