Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change default dist folder with setuptools

Tags:

I'm using setuptools 0.6 to package my code. By default when I type python setup.py sdist, the tool creates a folder dist directly in the same folder of my script. What I can do to change this default folder? Edit: Another question is, if my setup script and my package folder are not in the same folder, what can I do to specify the exact path of the package? Thanks

like image 736
nam Avatar asked Nov 30 '12 10:11

nam


People also ask

What is Find_packages in setuptools?

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.

What is PIP setuptools?

Setuptools is the Python Packaging Authority (PyPA) package development process library and utility for building Python projects based on packages and their dependencies listed in a setup.py script.

Does Python come with setuptools?

Usually, Yes. the setuptools is not part of the python vanilla codebase, hence not a vanilla modules. python.org installers or mac homebrew will install it for you, but if someone compile the python by himself or install it on some linux distribution he may not get it and will need to install it by himself.


1 Answers

Use the --dist-dir=[differentdir] option. From python setup.py sdist --help:

  --dist-dir (-d)   directory to put the source distribution archive(s) in                     [default: dist] 

You can specify the top-level package directory with the package_dir keyword argument to setup():

package_dir = {'': 'src'}, 

I can recommend the Python Packaging User Guide for a good tutorial on how to package your python projects.

like image 156
Martijn Pieters Avatar answered Oct 16 '22 05:10

Martijn Pieters