Pipenv:Python开发人员工作流

Pipenv是一个生产就绪的工具,旨在把所有的包装世界的最好的带到Python的世界。它将Pipfile,pip和virtualenv整合到一个命令中。

它具有非常漂亮的终端颜色。


PipenvPython.org正式推荐的Python打包工具


Pipenv是一个旨在将最好的包装世界(bundler, composer, npm, cargo, yarn, etc.)带到Python世界的工具。

Windows是世界上一流的公民。


它会自动创建和管理你的项目的virtualenv,以及添加/删除从你的包pipfile当你安装/卸载软件包。它也产生过重要的–pipfile.lock,这是用来产生确定性的建立。


pipenv所要解决的问题是多方面的:

  • 你不再需要使用PIPvirtualenv分开。他们一起工作
  • 管理requirements.txt文件可能是有问题的,所以pipenv利用即将到来的pipfilepipfile.lock相反,这是基本的用例上。
  • 哈希值是使用无处不在,总是。安防自动暴露安全漏洞。
  • 给你洞察你的依赖图(如美元pipenv图表
  • 简化开发流程,加载env文件

安装pipenv

Pipenv是一个python包,所以可以使用安装 pip正如你所期望的那样。

$ pip install pipenv
如果您有很好的尝试,那么有许多其他的安装方法可以防止pipenv和它的依赖关系干扰您的python安装的其他部分。


Pipenv和虚拟环境


用户褒奖

曾担任PIP 维护人员的Jannis Leidel-
Pipenv是我一直想要为PIP打造的瓷器。它适合我的大脑,并且大部分替代virtualenvwrapper和手动点子呼叫我。用它。
贾斯汀Myles Holmes  -
Pipenv终于是一个抽象的概念,而不仅仅是文件系统。
艾萨克·桑德斯  -
Pipenv是我今天最好的事情。谢谢,Kenneth!

Pipenv功能

  • 启用真正确定性的构建,同时轻松指定你想要的
  • 为锁定的依赖项生成并检查文件哈希。
  • 自动安装所需的Pythons,如果pyenv可用。
  • 自动找到你的项目回家,通过寻找一个Pipfile
  • 自动生成一个Pipfile,如果不存在。
  • 在标准位置自动创建一个virtualenv。
  • Pipfile在卸载/安装软件包自动添加/删除软件包
  • 自动加载.env文件,如果它们存在。

主要的命令是installuninstalllock,它会生成一个Pipfile.lock这些旨在取代使用,以及手动virtualenv管理(以激活virtualenv,运行)。$ pip install$ pipenv shell



基本概念

  • 当一个不存在时,virtualenv会自动创建。
  • 当没有参数传递时install[packages]将会安装指定的所有软件包
  • 要初始化Python 3虚拟环境,请运行$ pipenv --three
  • 要初始化Python 2虚拟环境,请运行$ pipenv --two
  • 否则,默认的virtualenv将是默认值。

其他命令

  • graph 将向您显示您已安装的依赖关系的依赖关系图。
  • shell 将激活virtualenv生成一个shell。
  • run将从virtualenv运行一个给定的命令,使用任何参数(例如)。$ pipenv run python
  • check 检查安全漏洞,并断言当前环境正在满足PEP 508的要求。


此外文档指南



Pipenv用法

pipenv 

pipenv [ OPTIONS ]命令[ ARGS ] ...

选项

--update

更新Pipenv&点到最新。

--where

输出项目的家庭信息。

--venv

输出virtualenv信息。

--py

输出Python解释器信息。

--envs

Output Environment Variable options.

--rm

Remove the virtualenv.

--bare

Minimal output.

--completion

Output completion (to be eval’d).

--man

Display manpage.

--three --two

Use Python 3/2 when creating virtualenv.

--python  <python>

Specify which version of Python virtualenv should use.

--site-packages

Enable site-packages for the virtualenv.

--jumbotron

An easter egg, effectively.

--version

Show the version and exit.

check
pipenv check [OPTIONS] [ARGS]...

Options

--three --two

Use Python 3/2 when creating virtualenv.

--python  <python>

Specify which version of Python virtualenv should use.

--unused  <unused>

Given a code path, show potentially unused dependencies.

--style  <style>

Given a code path, show Flake8 errors.

Arguments

ARGS

Optional argument(s)

graph
pipenv graph [OPTIONS]

Options

--bare

Minimal output.

--json

Output JSON.

--reverse

Reversed dependency graph.

install
pipenv install [OPTIONS] [PACKAGE_NAME] [MORE_PACKAGES]...

Options

-d --dev

Install package(s) in [dev-packages].

--three --two

Use Python 3/2 when creating virtualenv.

--python  <python>

Specify which version of Python virtualenv should use.

--system

System pip management.

-r --requirements  <requirements>

Import a requirements.txt file.

-c --code  <code>

Import from codebase.

--verbose

Verbose mode.

--ignore-pipfile

Ignore Pipfile when installing, using the Pipfile.lock.

--sequential

Install dependencies one-at-a-time, instead of concurrently.

--skip-lock

Ignore locking mechanisms when installing—use the Pipfile, instead.

--deploy

Abort if the Pipfile.lock is out–of–date, or Python version is wrong.

--pre

Allow pre–releases.

Arguments

PACKAGE_NAME

Optional argument

MORE_PACKAGES

Optional argument(s)

lock
pipenv lock [OPTIONS]

Options

--three --two

Use Python 3/2 when creating virtualenv.

--python  <python>

Specify which version of Python virtualenv should use.

--verbose

Verbose mode.

-r --requirements

Generate output compatible with requirements.txt.

-d --dev

Generate output compatible with requirements.txt for the development dependencies.

--clear

Clear the dependency cache.

--pre

Allow pre–releases.

open
pipenv open [OPTIONS] MODULE

Options

--three --two

Use Python 3/2 when creating virtualenv.

--python  <python>

Specify which version of Python virtualenv should use.

Arguments

MODULE

Required argument

run
pipenv run [OPTIONS] COMMAND [ARGS]...

Options

--three --two

Use Python 3/2 when creating virtualenv.

--python  <python>

Specify which version of Python virtualenv should use.

Arguments

COMMAND

Required argument

ARGS

Optional argument(s)

shell
pipenv shell [OPTIONS] [SHELL_ARGS]...

Options

--three --two

Use Python 3/2 when creating virtualenv.

--python  <python>

Specify which version of Python virtualenv should use.

--fancy

Run in shell in fancy mode (for elegantly configured shells).

--anyway

Always spawn a subshell, even if one is already spawned.

Arguments

SHELL_ARGS

Optional argument(s)

uninstall
pipenv uninstall [OPTIONS] [PACKAGE_NAME] [MORE_PACKAGES]...

Options

--three --two

Use Python 3/2 when creating virtualenv.

--python  <python>

Specify which version of Python virtualenv should use.

--system

System pip management.

--verbose

Verbose mode.

--lock

Lock afterwards.

--all-dev

Un-install all package from [dev-packages].

--all

Purge all package(s) from virtualenv. Does not edit Pipfile.

Arguments

PACKAGE_NAME

Optional argument

MORE_PACKAGES

Optional argument(s)

update
pipenv update [OPTIONS] [PACKAGE_NAME]

Options

-v --verbose

Verbose mode.

-d --dev

Additionally install package(s) in [dev-packages].

--three --two

Use Python 3/2 when creating virtualenv.

--python  <python>

Specify which version of Python virtualenv should use.

--dry-run

Just output outdated packages.

--bare

Minimal output.

--clear

Clear the dependency cache.

--sequential

一次安装依赖关系,而不是同时安装。

参数

PACKAGE_NAME

可选参数


翻译自:https://docs.pipenv.org/
























  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值