setup.py

What is the graft command in Python's MANIFEST.in file?

荒凉一梦 提交于 2019-11-30 16:27:36
问题 I found a Python project with a MANIFEST.in file. I can guess at the meaning of much of it, but I am unclear on the meaning of the line: graft tools 回答1: You can see such a file in JoshData/pdfminer/MANIFEST.in or openstack/deb-python-falcon/MANIFEST.in for instance. It is a python project which uses the MANIFEST.in template A MANIFEST.in file can be added in a project to define the list of files to include in the distribution built by the sdist command. When sdist is run, it will look for

Importing Python libraries and gracefully handling if they are not availalble

三世轮回 提交于 2019-11-30 15:28:25
问题 I would like to import bunch of libraries and catch the exception. If I have only 1 try catch block I get 1 exception (the first one). Is there a pattern to iterate over all of the libs and have a separate exception for each individual missing lib? #!/usr/bin/env python try: import sys except: print sys.exc_info() try: import numpy as np except: print sys.exc_info() try: import scipy as sp except: print sys.exc_info() try: import os as os except: print sys.exc_info() try: from operator import

Importing Python libraries and gracefully handling if they are not availalble

时光毁灭记忆、已成空白 提交于 2019-11-30 14:28:46
I would like to import bunch of libraries and catch the exception. If I have only 1 try catch block I get 1 exception (the first one). Is there a pattern to iterate over all of the libs and have a separate exception for each individual missing lib? #!/usr/bin/env python try: import sys except: print sys.exc_info() try: import numpy as np except: print sys.exc_info() try: import scipy as sp except: print sys.exc_info() try: import os as os except: print sys.exc_info() try: from operator import itemgetter except: print sys.exc_info() try: import socket except: print sys.exc_info() try: import

In setup.py or pip requirements file, how to control order of installing package dependencies?

谁都会走 提交于 2019-11-30 12:52:25
I've got a Python package with its setup.py having dependencies declared via the usual way, in install_requires=[...]. One of the packages there, scikits.timeseries, has a setup.py expecting numpy to already be installed, thus, I'd like some way to have numpy installed first. For this case and in general, can the order of dependency installation be controlled? How? Currently the order in which setup.py pulls down dependencies (as listed in the arg install_requires) seems practically random. Also, in the setup.py setup(...) I tried using the arg: extras_require={'scikits.timeseries': ['numpy']}

How to specify dependencies when creating the setup.py file for a python package

淺唱寂寞╮ 提交于 2019-11-30 11:17:54
The python doc for "Writing the Setupscript ( http://docs.python.org/2/distutils/setupscript.html ) mentions that dependencies can be specified under section > 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

Specifying optional dependencies in pypi python setup.py

戏子无情 提交于 2019-11-30 10:54:06
How do I specify optional dependencies in python's setup.py ? Here's my stab at specifying an optional dependency for an open source library of mine but it doesn't seem to do much. https://github.com/od-eon/django-cherrypy/blob/master/setup.py Specifically extra_requires in this snippet: setup( name='django-cherrypy', version='0.1', packages=packages, license='LICENSE', description='cherrypy, running under django', long_description=open('README.md').read(), author='Calvin Cheng', author_email='calvin@calvinx.com', install_requires=['cherrypy-wsgiserver'], extra_requires=['newrelic'], url=

Using an extra python package index url with setup.py

爱⌒轻易说出口 提交于 2019-11-30 07:59:46
Is there a way to use an extra python package index (ala pip --extra-index-url pypi.example.org mypackage ) with setup.py so that running python setup.py install can find the packages hosted on pypi.example.org ? Heston Liebowitz If you're the package maintainer, and you want to host one or more dependencies for your package somewhere other than PyPi, you can use the dependency_links option of setuptools in your distribution's setup.py file. This allows you to provide an explicit location where your package can be located. For example: from setuptools import setup setup( name='somepackage',

Installing nltk data dependencies in setup.py script

荒凉一梦 提交于 2019-11-30 07:25:46
问题 I use NLTK with wordnet in my project. I did the installation manually on my PC, with pip: pip3 install nltk --user in a terminal, then nltk.download() in a python shell to download wordnet. I want to automatize these with a setup.py file, but I don't know a good way to install wordnet. For the moment, I have this piece of code after the call to setup ( "nltk" is in the install_requires list of the call to setup ): import sys if 'install' in sys.argv: import nltk nltk.download("wordnet") Is

Is it possible to include subdirectories using dist utils (setup.py) as part of package data?

我只是一个虾纸丫 提交于 2019-11-30 00:13:24
问题 Basically my python package is setup like: module \_examples \_folder1 \_file1.py \_file2.py \_folder2 \_file1.py \_file2.py Basically I want to just use: package_data = { 'module': ['examples/*'], }, because my project always has people adding examples and I want it to be easy to list them from within my application. I can get it work for any FILE within examples, but not re-curse down through sub-directories. Is this possible? 回答1: I believe what you're looking for is something like this

Specifying optional dependencies in pypi python setup.py

家住魔仙堡 提交于 2019-11-29 16:04:28
问题 How do I specify optional dependencies in python's setup.py ? Here's my stab at specifying an optional dependency for an open source library of mine but it doesn't seem to do much. https://github.com/od-eon/django-cherrypy/blob/master/setup.py Specifically extra_requires in this snippet: setup( name='django-cherrypy', version='0.1', packages=packages, license='LICENSE', description='cherrypy, running under django', long_description=open('README.md').read(), author='Calvin Cheng', author_email