setuptools

Python package setup script install binary executable

一笑奈何 提交于 2019-12-05 15:41:10
I have a package awesomepkg with setup.py . I'd like to install a binary executable awesometool to the command line along with the package itself when users run pip install awesomepkg . I have compiled different OS versions for awesometool , which lives in a bin/ folder beside setup.py . However, I can't find a good way to configure setup.py . I have attempted the following: Use the scripts=[] keyword in setup() . Unfortunately, the "executable" must be a python script. So I try to wrap the binary in a python script using os.system('bin/awesometool') to delegate. It also fails because the

python的packages管理

房东的猫 提交于 2019-12-05 14:43:15
一、概念介绍 Python is known for it's “batteries included” philosophy and has a rich standard library。However, being a popular language, the number of third party packages is much larger than the number of standard library packages. So it eventually becomes necessary to discover how packages are used, found and created in Python. 目前python提供的包管理工具有多个,其关系如下: 具体可以参见: http://guide.python-distribute.org/introduction.html 可以看出,Distribute代替了Setuptools, 但将来会被distutils2取代,并作为标准库的一部分。 关于packages的管理,则由pip进行 有关packages的发布,查找的网站是: https://pypi.python.org/pypi Distribute是对标准库disutils模块的增强,disutils主要是用来更加容易的打包和分发包

How to instrument setup.py to use wheel packages

巧了我就是萌 提交于 2019-12-05 13:04:17
In my setup.py I have a dependency for numpy (in install_requires ). Is it possible to instrument the setup function to use wheel packages rather then source ones and not compile the whole numpy? Note: When I do pip install numpy it downloads the binary package of numpy. However python setup.py install gets the source package. The wheel package was introduced with the purpose of fixing the problems with source distributions that were used by setuptools . Although setuptools had their own Egg format for built distributions that predated wheel by 8 years, wheel is currently considered the

Install python package from private pypiserver

穿精又带淫゛_ 提交于 2019-12-05 12:26:44
I have setup a pypiserver behind an nginx proxy which uses htpasswd for authentication. I am currently able to upload sdists, but I can't figure out how to download them. I want to be able to download them when running setup.py test and somehow by using pip . Is this possible? [distutils] index-servers = private [private] repository = https://example.com/pypi username = remco password = mypass To make it extra hard the server is currently using a non verified ssl connection. I tried the following setup based on http://pythonhosted.org/setuptools/setuptools.html#setuptools-package-index , but

Setuptools entry_points/console_scripts have specific Python version in shebang

陌路散爱 提交于 2019-12-05 11:53:40
I am generating a Python package on RHEL6 (with Python2.6), and trying to deploy it to a RHEL7 server (Python2.7). The package includes scripts generated with entry_points/console_scripts. However, the generated scripts have the specific python2.6 version in the shebang, as in: #!/usr/bin/env python2.6 How can I override or disable this so it just generates: #!/usr/bin/env python entry_points = { 'console_scripts':[ ... ] }, options = { 'build_scripts': { 'executable': '/usr/bin/env python', }, }, 来源: https://stackoverflow.com/questions/28575431/setuptools-entry-points-console-scripts-have

using pip to install packages locally in spite of satisfied global requirements

廉价感情. 提交于 2019-12-05 11:22:22
I am trying to use pip to install a package locally in ~/.local . The problem is that the package (in an older version) is already available globally on the system. Even though the global python packages directory is not in my PYTHONPATH , pip still refuses to install, thinking that the package requirement is satisfied. This is similar to the issue described here, except I am not using sudo so the solution does not apply: pip - Requirement already satisfied? If I do: pip install --user numpy It says: Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/local/lib/python2.7

Accessing python egg's own metadata

青春壹個敷衍的年華 提交于 2019-12-05 08:26:04
I've produced a python egg using setuptools and would like to access it's metadata at runtime. I currently got working this: import pkg_resources dist = pkg_resources.get_distribution("my_project") print(dist.version) but this would probably work incorrectly if I had multiple versions of the same egg installed. And if I have both installed egg and development version, then running this code from development version would pick up version of the installed egg. So, how do I get metadata for my egg not some random matching egg installed on my system? I am somewhat new to Python as well, but from

Can python setup.py install use wheels?

会有一股神秘感。 提交于 2019-12-05 07:06:37
I am using setuptools. Is there a way to have the following command use wheels instead of source? python setup.py install In particular, I have a custom package that requires pandas. While pandas installs perfectly fine with pip (because it grabs the wheel), pandas won't install while running python setup.py (due to pandas having missing dependencies on my machine) Or perhaps, how do other people handle pandas as a dependency in there projects? Must I include all of pandas dependencies in my setup.py file? Thanks One solution is to use pip to install you project. pip is able to handle your

Override the shebang mangling in python setuptools

折月煮酒 提交于 2019-12-05 06:29:04
Background I write small python packages for a system that uses modules ( https://luarocks.org/ ) to manage packages. For those of you who don't know it, you can run module load x and a small script is run that modifies various environmental variables to make software 'x' work, you can then undo this with module unload x . This method of software management is nearly ubiquitous in scientific computing and has a lot of value in that arena: you can run ancient unmaintained software alongside packages that that software would interfere with, you can run multiple versions of software, which allows

How can I specify a python version using setuptools? [duplicate]

依然范特西╮ 提交于 2019-12-05 05:45:07
This question already has an answer here: setup.py: restrict the allowable version of the python interpreter 2 answers Is there a way to specify a python version to be used with a python package defined in setup.py? My setup.py currently looks like this: from distutils.core import setup setup( name = 'macroetym', packages = ['macroetym'], # this must be the same as the name above version = '0.1', description = 'A tool for macro-etymological textual analysis.', author = 'Jonathan Reeve', author_email = 'jon.reeve@gmail.com', url = 'https://github.com/JonathanReeve/macro-etym', download_url =