Il doc pitone per "Scrivere il Setupscript (http://docs.python.org/2/distutils/setupscript.html) afferma che le dipendenze possono essere specificate nella sezioneCome specificare le dipendenze durante la creazione del file setup.py per un pacchetto python
> 2.4. Relationships between Distributions and Packages
[...] These relationships can be specified using keyword arguments to the distutils.core.setup() function.
Dependencies on other Python modules and packages can be specified by supplying the requires keyword argument to setup(). The value must be a list of strings. Each string specifies a package that is required, and optionally what versions are sufficient.
To specify that any version of a module or package is required, the string should consist entirely of the module or package name. Examples include 'mymodule' and 'xml.parsers.expat'.
[...]
Date queste informazioni piuttosto rada senza un esempio voglio solo fare in modo che lo faccio bene. Inoltre, non riesco a trovare questo parametro requires
nella descrizione API http://docs.python.org/2/distutils/apiref.html#distutils.core.setup
Così si fa in questo modo, ad esempio,
setup(name='MyStuff',
version='1.0',
requires='os, sys, progressbar',
[...]
Spero che qualcuno possa darmi un po 'più di intuizione! Grazie!
EDIT:
Per affrontare il distutils.core, setuptools polemiche, si potrebbe semplicemente fare
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
Ha senso?
L'intero sistema di packaging Python è mal documentato, principalmente perché ci sono così tanti posti diversi con informazioni parzialmente buone ma contraddittorie. Guardo sempre i progetti esistenti. Nel caso in cui non hai esigenze particolari, hai solo bisogno di distutils. Ad esempio, il collo di bottiglia è un buon esempio per un file 'setup.py' che utilizzava solo distutils: https://github.com/kwgoodman/bottleneck/blob/master/setup.py –
@ Jan-PhilipGehrcke: tuttavia' bottleneck' non riesce a specificare che richiede 'numpy' nei metadati. 'setuptools' ha una documentazione molto migliore in questi giorni, grazie alla forchetta' distribute' che viene rimessa in una falla: http://pythonhosted.org/setuptools/ –
Proprio così, inizia anche con l'importazione numpy subito. –