Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify the setuptools output directory? [duplicate]

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 441
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.

Does PIP depend on setuptools?

In Fedora, our pip package Recommends setuptools. Practically that means: Majority of users who install pip will get setuptools by default. Users can explicitly uninstall setuptools after installing pip or exclude setuptools when installing pip.

What is pyproject toml used for?

What is pyproject. toml? The pyproject. toml file was introduced in PEP-518 (2016) as a way of separating configuration of the build system from a specific, optional library (setuptools) and also enabling setuptools to install itself without already being installed.

What is the use of setuptools in Python?

Setuptools is a package development process library designed to facilitate packaging Python projects by enhancing the Python standard library distutils (distribution utilities). It includes: Python package and module definitions. Distribution package metadata.


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 153
Martijn Pieters Avatar answered Sep 23 '22 11:09

Martijn Pieters