Myk*_*lis 6 python google-app-engine pip
I have a Python library that is published to PyPI. Before pushing each new version of the library, I want to test it by upgrading a sample application to use the new version.
The suggested method to do this is to work in "development mode" using the -e (--editable) flag:
$ pip install -e <my package root>
Run Code Online (Sandbox Code Playgroud)
And this does indeed install the package into my global environment.
However, my sample program is written for Google App Engine, which requires that all third-party libraries be copied into an application-specific folder (./lib in my case). I normally install packages here by using the -t (--target) option to pip:
$ pip install -t lib/ <package>
Run Code Online (Sandbox Code Playgroud)
However, it appears that the -e and -t options are not compatible, and my attempts to install my local, unpublished library to a specified target folder by using both flags together fail.
How can I test my library package by installing it in a custom directory before publishing?
对于新软件包的一次性测试,直接从本地文件系统安装似乎是最好的选择:
$ cd /my/sample/application
$ pip install -t lib /my/local/package
Run Code Online (Sandbox Code Playgroud)
当我对本地包进行进一步更改时,此安装不会保持同步(如果我要使用pip install --editable),但对于此用例,我可以在没有它的情况下生活。
我无法得到@pbaranay 的答案,因为该方式pip install -e使用了“egg-info”文件,而 GAE 的 dev_appserver.py 脚本显然无法理解/遍历这些文件。不过,创建 virtualenv 并将其符号链接到 lib (而不是使用 直接将软件包安装到 lib -t)的建议是一个很好的建议。
| 归档时间: |
|
| 查看次数: |
11495 次 |
| 最近记录: |