0

I'm using setup.py to package my project. the structure is like:

foo -
    |
    |--foo/
    |    |
    |    |--first.py
    |    |--second.py
    |    |--...
    |--README
    |--requirements.txt
    |--scripts/
    |        |
    |        |-script1.sh
    |        |-script2.py
    |--service.py
    |--setup.py

If I run the current setup.py, which is in accordance with the suggestions here: What is setup.py? then in the venv/lib/python3.6/site-packages/foo and venv/lib/python3.6/site-packages/scripts I can see all python classes there. But service.py is absent. My question is how to modify the setup.py to include service.py into packaging such that I can find service.py at venv/lib/python3.6/site-packages/? Thanks in advance!

sinoroc
  • 18,409
  • 2
  • 39
  • 70
Yibo Liu
  • 71
  • 6

1 Answers1

1

For top level modules, such as service.py, to be included in the distributions, setuptools offers the py_modules parameter.

The setuptools documentation does not show it clearly, but it is the same as in (now deprecated) distutils:

setuptools.setup(
    # ...
    py_modules=['service'],  # no '.py'
)
sinoroc
  • 18,409
  • 2
  • 39
  • 70