Python Forum

Full Version: setup()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
what is the command  to turn a setup,py file into a zipped module?
I have used
C:\> py -3 setup sdist
sdist is tagged as unknown
The docs https://docs.python.org/2/distutils/sourcedist.html are pretty good on this,
and it's the first topic
thanks for the info, I checked the py3.6 docs and found My setup file was horribly put together. I have installed vsearch in site-packages file but when I try to import it I have had no luck. It is listed in site-packages as "vsearch-1.0.py3.6egg-info" I have tried
"from site-packages import vsearch" and get an invalid syntax error with the carat pointing at the hyphen. I have tried various just "import vsearch" and I get a no module found, I thought this would work since 'site-packages' is on the Python search path. I have tried the whole tag "vsearch-1.0.py3.6egg-info" and get an invalid syntax error. I have tried partial tags and also get an invalid syntax error. Any suggestions would be appreciated. One more question can you rename a module to a simpler syntax?
don't install by moving it into site-packages. While that might work in simple cases, it won't if there
are dependencies. You need to install using pip, or setup.py.
Please read this tutorial: https://python-forum.io/Thread-Basic-Pac...-py-Freeze
Follow tutorial here so you are sure that python and pip work from anywhere in cmd.
I guess you follow tutorial in this book.

pip can install from either Source Distributions (sdist) or Wheels.
Wheel is the preferred format and what i show how to make in  Packaging/Modules--Wheel--pip--setup.py--Freeze.
hare50 Wrote:sdist is tagged as unknown
Make wheel.
python setup.py bdist_wheel

Make Source Distribution
python setup.py sdist

Both install with pip
pip install name_of_wheel.whl
pip install name_of_sdist.zip
although I was in windows10 sdist put my file in a tarball. I added --formats=zip to sdist in setup(). Why the tarball if sdist is supposed to zip files on the windows platform.
You can force it make zip.
python setup.py sdist --formats=zip
But you should really make wheel 
Since I can't find a place to start a new thread, I have three questions. 1) where is the place to store binary extensions? 2) will 'import foo' accept a directory? 3)where is the best place to store self-made modules and how do you store them with attributes in the command?
I upgraded to 3.6.2 and now a call to 'setup.py' responds with an [errno 2= no module found}. I have search Python36 directory and can only find 'setup.py' in modules I wrote under 3.6.1. where does 'setup.py, reside?
hare50 Wrote:where does 'setup.py, reside?
You miss the point,you make setup.py
If look at my tutorial that has been posted before.
Making the first wheel i have setup.py and power.py is same folder.
In setup.py i point to py_modules=['power'] module which is file power.py.

Then i make wheel.
python setup.py bdist_wheel --universal
I do not mention Source Distributions(sdist),because wheel is the preferred way.
But can make zip file with same setup.py bye running.
python setup.py sdist --formats=zip