setuptools

A simple Hello World setuptools package and installing it with pip

核能气质少年 提交于 2019-12-31 10:40:49
问题 I'm having trouble figuring out how to install my package using setuptools, and I've tried reading the documentation on it and SO posts, but I can't get it to work properly. I'm trying to get a simple helloworld application to work. This is how far I got: helloworld.py: print("Hello, World!") README.txt: Hello, World! readme MANIFEST.in: recursive-include images *.gif setup.py: from setuptools import setup, find_packages setup( name='helloworld', version='0.1', license='BSD', author='gyeh',

How to find a class or function in a Python module?

徘徊边缘 提交于 2019-12-31 03:53:09
问题 I'm trying to find the function or class definition of gen_dataset_ops in tensorflow, which has its sourcecode here. I find many places where it is imported like so: from tensorflow.python.ops import gen_dataset_ops But I can't find where it is defined, I'd expect to find something like: def gen_dataset_ops(...): #Do something clever return I don't quite understand the anatomy of python modules in general, so I'm probably missing some basics here,.. any hint is welcome! 回答1: tensorflow.python

What is the correct way to include localisation in python packages?

落爺英雄遲暮 提交于 2019-12-31 03:08:07
问题 I am writing my own python application and I am wondering what is the correct way to include localisation in source distributions. I struggled with the documentation of setuptools; localisation is not even mentioned there. I use pypabel to extract my message catalogues and to compile them. Questions Is there a possibility to compile *.po to *.mo automatically before creating a source package with setup.py? Currently I have to compile everything before manually for each language... Where

`python -m ensurepip --upgrade` does not seem to be upgrading pip and setuptools

不打扰是莪最后的温柔 提交于 2019-12-31 02:48:09
问题 I am on a Mac running Yosemite (Mac OS X 10.10.1) and homebrew installed python and python3 and python -m ensurepip --upgrade does not seem to be working as I would have expected. python -m ensurepip --upgrade does not upgrade pip or setuptools. pip install --upgrade pip setuptools upgrades pip to 6.0.7 and upgrades setuptools to 12.0.5. Same results with Python3. Do I misunderstand the purpose of ensurepip? 回答1: Per the documentation: This module does not access the internet. All of the

Python setuptools: how to include a config file for distribution into <prefix>/etc

落花浮王杯 提交于 2019-12-30 02:40:05
问题 How can I write setup.py so that: The binary egg distribution ( bdist_egg ) includes a sample configuration file and Upon installation puts it into the {prefix}/etc directory? A sample project source directory looks like this: bin/ myapp etc/ myapp.cfg myapp/ __init__.py [...] setup.py The setup.py looks like this: from distutils.command.install_data import install_data packages = ['myapp', ] scripts = ['bin/myapp',] cmdclasses = {'install_data': install_data} data_files = [('etc', ['etc

Does pip handle extras_requires from setuptools/distribute based sources?

左心房为你撑大大i 提交于 2019-12-29 18:44:14
问题 I have package "A" with a setup.py and an extras_requires line like: extras_require = { 'ssh': ['paramiko'], }, And a package "B" that depends on util: install_requires = ['A[ssh]'] If I run python setup.py install on package B, which uses setuptools.command.easy_install under the hood, the extras_requires is correctly resolved, and paramiko is installed. However, if I run pip /path/to/B or pip hxxp://.../b-version.tar.gz , package A is installed, but paramiko is not. Because pip "installs

How to build and distribute a Python/Cython package that depends on third party libFoo.so

守給你的承諾、 提交于 2019-12-29 05:18:28
问题 I've written a Python module that depends on some C extensions. Those C extensions depend in turn on several compiled C libraries. I'd like to be able to distribute this module bundled with all the dependencies. I've put together a minimal example (it can be found on GitHub in its entirety). The directory structure is: $ tree . . ├── README.md ├── poc │ ├── __init__.py │ ├── cython_extensions │ │ ├── __init__.py │ │ ├── cvRoberts_dns.c │ │ ├── cvRoberts_dns.h │ │ ├── helloworld.c │ │ ├──

Distribute/distutils specify Python version

元气小坏坏 提交于 2019-12-28 18:08:34
问题 Kinda followup to this... :) My project is Python 3-only and my question is basically how I tell distutils/distribute/whoever that this package is Python 3-only? 回答1: Not sure if there's some special setting, but this in the beginning of setup.py might help: import sys if sys.version_info.major < 3: print("I'm only for 3, please upgrade") sys.exit(1) 来源: https://stackoverflow.com/questions/13385337/distribute-distutils-specify-python-version

how to cleanly uninstall my python packages with pip3 or any other way?

≡放荡痞女 提交于 2019-12-28 17:43:20
问题 this is my setup.py file for installing my python program, after the installation using python3 setup.py install an entry to my program was created named testmain , when i did pip3 freeze it showed abc==0.1 in its output ,so i uninstalled it using pip3 with pip3 uninstall abc , though the packages were uninstalled but there still existed the entry testmain on my path , is there a way that pip3 also removes this entry during the uninstall or any other way that i can cleanly uninstall my

Changing console_script entry point interpreter for packaging

末鹿安然 提交于 2019-12-28 11:56:10
问题 I'm packaging some python packages using a well known third party packaging system, and I'm encountering an issue with the way entry points are created. When I install an entry point on my machine, the entry point will contain a shebang pointed at whatever python interpreter, like so: in /home/me/development/test/setup.py from setuptools import setup setup( entry_points={ "console_scripts": [ 'some-entry-point = test:main', ] } ) in /home/me/.virtualenvs/test/bin/some-entry-point : #!/home/me