惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

SecWiki News
SecWiki News
I
InfoQ
The Cloudflare Blog
人人都是产品经理
人人都是产品经理
博客园 - Franky
T
Tailwind CSS Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
量子位
博客园_首页
罗磊的独立博客
V
V2EX
李成银的技术随笔
大猫的无限游戏
大猫的无限游戏
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
True Tiger Recordings
Vercel News
Vercel News
Cyberwarzone
Cyberwarzone
Cisco Talos Blog
Cisco Talos Blog
F
Fox-IT International blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
M
Microsoft Research Blog - Microsoft Research
Know Your Adversary
Know Your Adversary
爱范儿
爱范儿
The Register - Security
The Register - Security
G
Google Developers Blog
The Hacker News
The Hacker News
Malwarebytes
Malwarebytes
S
Securelist
博客园 - 三生石上(FineUI控件)
Jina AI
Jina AI
T
Threat Research - Cisco Blogs
T
The Exploit Database - CXSecurity.com
S
SegmentFault 最新的问题
博客园 - 叶小钗
F
Fortinet All Blogs
Apple Machine Learning Research
Apple Machine Learning Research
宝玉的分享
宝玉的分享
博客园 - 聂微东
T
Threatpost
博客园 - 【当耐特】
D
Docker
P
Privacy & Cybersecurity Law Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
G
GRAHAM CLULEY
V
Visual Studio Blog
C
Cisco Blogs
IT之家
IT之家
S
Security Archives - TechRepublic
Latest news
Latest news
阮一峰的网络日志
阮一峰的网络日志

herrkaefer

"Vibe planning \u003e vibe coding" Anything to Markdown "Built anocus: anonymous commenting for static sites" About 日记与小说 -- AI 续写小说欣赏 Any-podcast: from newsletters to a podcast Made MicPipe: a simple voice input tool using ChatGPT dictation 关于 Tools 和 Skills 的一点感想 Realtime monitoring of ComEd hourly price "Introducing SwiftEdgeTTS" Thoughts on the philosophy of building AI-native apps jelly鼻屎 等饭的人 Use home assistant to motivate my kid to brush teeth Migrated Blog to Hugo and Cloudflare Pages Easy Aspen monitoring for Chicago parents Introducing HabitBuilder: A simple Telegram bot for habit tracking 鼓捣 Open folder or file with Sublime Text from Finder toolbar Create new text file from Finder toolbar Uno reinvented for 3-year-old kids Uno变身儿童数字游戏 自动转发Twitter到微博 Handle annoying operations of objects in Realm DB Move Jekyll blog to Ubuntu VPS Introducing Mole Note taking without note taking app Deploy Python web application on Ubuntu server Setup Shadowsocks / VPN on Ubuntu Server Linode Notes - Basic Setup CLASS Style Adapted for Embedded Systems psycopgr Tutorial pgRouting Notes PostgreSQL Notes 阿城三王 这一年,这一把日子 另一面的发现——读《坟》 定理 封面与腰封 Google book下载 lulu最新写真出炉 The Big Bang Theory第三季 自拍婚纱照1 日全食 期待动画片 《麦兜响当当》动画电影主题曲 转:饶毅--“杂志拜物教”:何时发Cell Nature Science 论文害你 转:饶毅--提醒年轻人:何时SCI害你? 西安 3d打印机 twitter Dropbox 刷牙 贴几张照片 6156167 永久和凤凰 老板的想法 原来奥巴马也是个朗读者 应邀发Freeware List 2.0 史上最能睡的淘宝老板 至少出名的效果是达到了 错怪了msn 独立游戏节2009 114 馒头 Crayon Physics Deluxe 2008,2009 盖章记 小虎队附身许巍 怎么给word文档加索引:排序问题 怎么给word文档加索引Q&A 怎么给Word文档加索引 教我如何不疯掉 二则 哦!报告 P 蓝天 萧翰 lm 故宫印象 转:美国历任总统像 time can kill itself 建议,只是建议哦 奥地利行记3 奥地利行记2 奥地利行记1 叶子 GayBoy 天使教你扔frisbie 门徒因何面容愁? 手机教堂 丝竹管弦之盛 残奥 争座位 秋意浅
"Python dev workflow on macOS"
2018-10-24 · via herrkaefer

Here is the new workflow in place of the old popular one using virtualenv, pip, requirements.txt and virtualenvwrapper.

Tools

  • pyenv for Python version installation and switch

  • Pipenv for virtualenv creation and package management for each project

  • Pipenv-Pipes for Pipenv environment switch

Pipenv is the central tool. pyenv provides specific version of Python (and pip) for Pipenv to initialize its virtualenv. Pipes is just a handy tool for fast navigation between Pipenv’s virtualenvs (like virtualenvwrapper’s workon), which may be built into Pipenv in the future.

Basic workflow

pyenv

To install:

$ brew install pyenv

then add eval "$(pyenv init -)" to shell (e.g. ~/.zshrc)

To show available Python versions to install:

$ pyenv install --list

To install a Python version:

$ pyenv install

Pipenv

Install Pipenv:

$ brew install pipenv

To install environment with specific Python version other than system default, this version must exist in system, so we can use pyenv to install the version first, then switch to its context.

$ pyenv shell
$ pipenv --python

After this, pyenv will be of no use because corresponding Python and pip have been installed into Pipenv’s context, unless you update to a new Python version.

Tips

Create Pipfile from requirements.txt

To use Pipenv for an old project with requirements.txt available, we can first

$ pipenv install

Pipfile will be automatically created from requirements.txt, with all packages installed with specific version numbers.

Second, run

$ pipenv graph

to show a dependency tree graph, from which we can identify less packages that we want. Then we can manually edit Pipfile to keep only these key packages. Note that it does not need to make a Pipfile without any redundant (i.e. all packages are leaf nodes in the dependency tree).

Last, run pipenv install again.

Time saving with --skip-lock

Uninstall packages that are not in Pipfile

Manually deleted packages in Pipfile would not be automatically uninstalled, we can use

$ pipenv clean

Sublime Text syntax highlighting of Pipfile

(Tested for ST 3)

  1. Install package TOML for TOML syntax highlighting. (Pipfile uses TOML format.)
  2. Install package ApplySyntax for custom syntax hightlighting for non-default format
  3. Add the following to ApplySyntax settings:
{
  "syntaxes": [
    {
      "syntax": "TOML/TOML",
      "rules": [
        {"file_path": ".*\\Pipfile$"}
      ]
    },
    {
      "syntax": "JavaScript/JSON",
      "extensions": ["Pipfile.lock"]
    }
  ]
}