V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
ChrisFreeMan
V2EX  ›  Python

pdm 是那熟悉的 npm 味道,很好用

  •  
  •   ChrisFreeMan · 2021-09-21 23:22:38 +08:00 · 3344 次点击
    这是一个创建于 919 天前的主题,其中的信息可能已经有所发展或是发生改变。
    11 条回复    2021-09-23 08:56:10 +08:00
    frostming
        1
    frostming  
       2021-09-22 09:37:40 +08:00
    感谢,还是要重申说清楚
    1. pdm 没有依赖地狱
    2. pdm 依赖目录真的不大
    3. pdm 依赖甚至可以复用已有安装
    ChrisFreeMan
        2
    ChrisFreeMan  
    OP
       2021-09-22 09:39:10 +08:00
    @frostming 厉害了哥,向你学习
    devliu1
        3
    devliu1  
       2021-09-22 10:53:17 +08:00
    之前就想要一个 npm-like 的 python 依赖管理工具,poetry 和 pipenv 这类都差点意思,pip 的 dependency hell 不严重,持续关注中。
    skiy
        4
    skiy  
       2021-09-22 14:34:46 +08:00
    @frostming 中文文档中的 “Linux/Mac 安装命令” 中的 raw.githubusercontent.com 建议改成国内的 git 。现在感觉 GitHub 已经被全面封禁( 443 )了。虽然浏览器用 Switchy 方便,但是命令行中直接使用不了(虽然有一些第三方的加速方案)。
    wangxn
        5
    wangxn  
       2021-09-22 14:49:42 +08:00 via Android
    npm 相比 pip 有啥突出的地方?以至于想在 Python 里用?只听说过各种吐槽,类似于磁盘空间占用率巨大。
    frostming
        6
    frostming  
       2021-09-22 14:59:10 +08:00
    @wangxn 就怕有这种印象,我在#1 重申多少次都没用
    javlib
        7
    javlib  
       2021-09-22 15:02:52 +08:00
    依赖放到项目自己的目录下确实比放在 vrituanenv 里面来的方便,至少删项目后,依赖就删了,方便清理。
    但是依赖放到项目下后,复用已有依赖是怎么做到的? java maven/gradle 是把所有依赖都放在同一个地方,所以复用很正常。
    wangxn
        8
    wangxn  
       2021-09-22 15:08:54 +08:00
    原来如此。刚刚手机看的贴,没看到项目描述。
    pip 可以类比于 Go 1.11 之前的全局包管理,这个有点像 1.11 之后的 Go Modules 。
    frostming
        9
    frostming  
       2021-09-22 16:15:37 +08:00
    @javlib 一样,放在一个中心化的地方,然后用「软链」(打引号是因为不是真的软链)
    hutoer
        10
    hutoer  
       2021-09-22 20:12:03 +08:00
    执行 eval $(pdm --pep582) 会报错
    bash: syntax error: unexpected end of file
    frostming
        11
    frostming  
       2021-09-23 08:56:10 +08:00   ❤️ 1
    @hutoer eval "$(pdm --pep582)"
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1007 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 19:29 · PVG 03:29 · LAX 12:29 · JFK 15:29
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.