setuptools

python installing package with submodules

一世执手 提交于 2019-12-01 08:37:41
I have a custom project package with structure like: package-dir/ mypackage/ __init__.py submodule1/ __init__.py testmodule.py main.py requirements.txt setup.py using cd package-dir followed by $pip install -e . or pip install . as suggested by python-packaging as long as I access the package from package-dir For example : $cd project-dir $pip install . at this point this works: $python -c 'import mypackage; import submodule1' but This does not work $ cd some-other-dir $ python -c 'import mypackage; import submodule1' Traceback (most recent call last): File "<stdin>", line 1, in <module>

Django 学习之路之初始化

南笙酒味 提交于 2019-12-01 08:24:39
我的电脑是windows7的版本, 1.之前就安装 了python27 2,下载了django却总是提示 没有setuptools,我不知道这个还需要单独安装,也不相信要单独安装,为此花费了将近一个小时捯饬,最后还是单独安装了setuptools,此后django安装成功,再设置一下环境变量,添入django和scripts的路径到path 3.下载mysqldb并安装, 至此安装结束,我开始连接了,看django能否练到数据库,先去试试,再来写心得。 来源: oschina 链接: https://my.oschina.net/u/2323085/blog/390911

Why does setup.py sweeps the content of the namespace before installing?

∥☆過路亽.° 提交于 2019-12-01 06:57:22
I'm using namespaces with setuptools to distribute a same module in two different repositories. The goal is to get mymodule.one and mymodule.two installed, knowing that the content of one and two comes from different repos. But it looks like two setup.py sweep each other content. ├── repo1 │ ├── mymodule │ │ ├── __init__.py │ │ └── one │ │ └── __init__.py │ └── setup.py └── repo2 ├── mymodule │ ├── __init__.py │ └── two │ └── __init__.py └── setup.py The namespace has the __init__.py below: test$ cat repo1/mymodule/__init__.py from pkgutil import extend_path __path__ = extend_path(__path__, _

Best way to share code across several setup.py scripts?

99封情书 提交于 2019-12-01 06:47:40
I've got several packages I'm working on, and I'd like to share code between their setup.py scripts. Is there any good way to do this or is code duplication my only option? Martijn Pieters Normally setup.py is the entry point for distribution of distinct packages. As such, it's hard to then share code between those packages. If you use setuptools (or it's fork, distribute ) in your setup.py , you can specify packages that must be installed when installing your package with the setup_requires entry. Unfortunately, your setup.py is executed first; as soon as the setup_requires line is parsed,

Having py2exe include my data files (like include_package_data)

江枫思渺然 提交于 2019-12-01 05:46:12
问题 I have a Python app which includes non-Python data files in some of its subpackages. I've been using the include_package_data option in my setup.py to include all these files automatically when making distributions. It works well. Now I'm starting to use py2exe. I expected it to see that I have include_package_data=True and to include all the files. But it doesn't. It puts only my Python files in the library.zip , so my app doesn't work. How do I make py2exe include my data files? 回答1: I

How to exclude a single file from package with setuptools and setup.py

强颜欢笑 提交于 2019-12-01 05:42:01
问题 I am working on blowdrycss . The repository is here. I want the settings file for blowdrycss_settings.py to be excluded from the final package on pypi. The intention is to dynamically build a custom settings file that will be placed in the users virtualenv / project folder. In setup.py , I have the following: packages=find_packages(exclude=['blowdrycss_settings.py', ]), I also tried exclude_package_data: exclude_package_data={ '': ['blowdrycss_settings.py'], '': ['blowdrycss/blowdrycss

Why does setup.py sweeps the content of the namespace before installing?

喜夏-厌秋 提交于 2019-12-01 04:58:35
问题 I'm using namespaces with setuptools to distribute a same module in two different repositories. The goal is to get mymodule.one and mymodule.two installed, knowing that the content of one and two comes from different repos. But it looks like two setup.py sweep each other content. ├── repo1 │ ├── mymodule │ │ ├── __init__.py │ │ └── one │ │ └── __init__.py │ └── setup.py └── repo2 ├── mymodule │ ├── __init__.py │ └── two │ └── __init__.py └── setup.py The namespace has the __init__.py below:

How to make easy_install execute custom commands in setup.py?

浪子不回头ぞ 提交于 2019-12-01 04:21:42
I want my setup.py to do some custom actions besides just installing the Python package (like installing an init.d script, creating directories and files, etc.) I know I can customize the distutils/setuptools classes to do my own actions. The problem I am having is that everything works when I cd to the package directory and do "python setup.py install", but my custom classes don't seem to be executed when I do "easy_install mypackage.tar.gz". Here's my setup.py file (create an empty myfoobar.py file in the same dir to test): import setuptools from setuptools.command import install as _install

How come I can't get the exactly result to *pip install* by manually *python setup.py install*?

好久不见. 提交于 2019-12-01 04:20:52
I like to figure out the myth behind Python's namespace packages by setuptools , and here is what I did test. Make a virtual environment by virtualenv . Find a namespaced package on PyPI . Install that package by pip install . Check the installed file hierarchy. The package I played with is zope.interface and it worked well with the following file hierarchy on my virtualenv: ~virenv/.../site-packages/zope.interface-3.8.0-py2.6-nspkg.pth /zope.interface-3.8.0-py2.6.egg-info/ /zope/ /interface/ /... Everything looked fine and I love the way zope.interface got installed as a real namespaced

How to include and install local dependencies in setup.py in Python?

一世执手 提交于 2019-12-01 04:10:02
I am creating a setup.py to distribute my application. This application has a number of dependencies which can be installed via pip, it also has some custom dependencies which can not be installed from PyPI. So, I have created a custom_package_0.1.whl which will be included into the distribution and must be installed as a dependency after setup.py installs everything from install_requires . Imagine the following app structure: my_app/ win_deps/custom_package_0.1.whl my_app/ __init__.py main.py setup.py setup.cfg How do I do that? There are several options that you can choose from: Upload your