支持 python2 & python3 使用多个 Pipfile
Support python2 & python3 using multiple Pipfiles
到目前为止很喜欢 pipenv 但是我想知道如何使用它来支持 python2.7 和 python3.7.
我正在编写一个 python 包,我想通过内部 pypi 存储库分发它,我想同时支持 python2.7 和 python3。 7(到目前为止,我已经针对 python2.7 进行了开发)。鉴于我必须在 Pipfile 中指定 python 版本,我得出的逻辑结论是我需要多个 Pipfiles。
我想我应该像这样构建我的项目:
root
|
|-python2.7
| |-Pipfile
|-python3.7
| |-Pipfile
到目前为止有什么想法吗?别人会这样吗?
假设我要这样做,我将需要指定在 运行 测试和构建包时使用哪个 Pipfile。根据 https://pipenv.kennethreitz.org/en/latest/advanced/#configuration-with-environment-variables 我可以使用 env var PIPENV_PIPFILE 来指定 Pipfile 位置。这很好,我很惊讶没有在命令行上指定 Pipfile 位置的选项(例如 pipenv --pipfile-location
)。值得我请求这样的功能吗?
欢迎对以上内容发表任何评论。
嗯……看完后我重新思考了一下:
The inclusion of [requires] python_version = "3.6" specifies that your application requires this version of Python, and will be used automatically when running pipenv install against this Pipfile in the future (e.g. on other machines). If this is not true, feel free to simply remove this section.
https://pipenv.readthedocs.io/en/latest/basics/#specifying-versions-of-python
我现在只有一个 Pipfile。我在 docker 容器中构建我的代码,因此我根据需要选择具有正确版本 python (https://hub.docker.com/_/python?tab=tags) 的图像
还有:
Do not keep Pipfile.lock in version control if multiple versions of Python are being targeted.
https://pipenv.readthedocs.io/en/latest/basics/#general-recommendations-version-control
到目前为止很喜欢 pipenv 但是我想知道如何使用它来支持 python2.7 和 python3.7.
我正在编写一个 python 包,我想通过内部 pypi 存储库分发它,我想同时支持 python2.7 和 python3。 7(到目前为止,我已经针对 python2.7 进行了开发)。鉴于我必须在 Pipfile 中指定 python 版本,我得出的逻辑结论是我需要多个 Pipfiles。
我想我应该像这样构建我的项目:
root
|
|-python2.7
| |-Pipfile
|-python3.7
| |-Pipfile
到目前为止有什么想法吗?别人会这样吗?
假设我要这样做,我将需要指定在 运行 测试和构建包时使用哪个 Pipfile。根据 https://pipenv.kennethreitz.org/en/latest/advanced/#configuration-with-environment-variables 我可以使用 env var PIPENV_PIPFILE 来指定 Pipfile 位置。这很好,我很惊讶没有在命令行上指定 Pipfile 位置的选项(例如 pipenv --pipfile-location
)。值得我请求这样的功能吗?
欢迎对以上内容发表任何评论。
嗯……看完后我重新思考了一下:
The inclusion of [requires] python_version = "3.6" specifies that your application requires this version of Python, and will be used automatically when running pipenv install against this Pipfile in the future (e.g. on other machines). If this is not true, feel free to simply remove this section.
https://pipenv.readthedocs.io/en/latest/basics/#specifying-versions-of-python
我现在只有一个 Pipfile。我在 docker 容器中构建我的代码,因此我根据需要选择具有正确版本 python (https://hub.docker.com/_/python?tab=tags) 的图像
还有:
Do not keep Pipfile.lock in version control if multiple versions of Python are being targeted.
https://pipenv.readthedocs.io/en/latest/basics/#general-recommendations-version-control