TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Poetry – Dependency Management for Python – v1.0

129 点作者 devj超过 5 年前

20 条评论

dragonsh超过 5 年前
We have moved our dependency management from pipenv to poetry and hasn’t been more happier than now working with and publish Python modules.<p>Now we use pyenv with poetry to run all our projects in Python with venv in project instead of decided by poetry default settings. We changed the settings with:<p><pre><code> poetry config settings.virtualenvs.in-project true </code></pre> After this in hgignore or gitignore added .venv folder.<p>Now everything is the way we wanted, with Pipenv many times faced issues that the project worked with requirements.txt but not in Pipenv. Didn’t have this issue moving to poetry yet.<p>Also with emacs support and automated deployment tools the predictability of poetry made our team easy to work with and publish Python application modules.
评论 #21780414 未加载
评论 #21779953 未加载
smnrchrds超过 5 年前
The recommended installation method still doesn&#x27;t work without manual intervention. For the reference, I use WSL with the latest Ubuntu LTS version.<p>- I tried using the recommended installation method of<p><pre><code> curl -sSL https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;python-poetry&#x2F;poetry&#x2F;master&#x2F;get-poetry.py | python </code></pre> Didn&#x27;t work. I don&#x27;t have python installed, just python3. Fair enough.<p>- Using the above method, but replacing `| python` with `| python3`: The installation works. But trying to invoke poetry gives this error:<p><pre><code> &#x2F;usr&#x2F;bin&#x2F;env: ‘python’: No such file or directory </code></pre> Turns out poetry executable is calling python in the shebang.<p>- Manually changed shebang in `$HOME&#x2F;.poetry&#x2F;bin&#x2F;poetry` to `#!&#x2F;usr&#x2F;bin&#x2F;env python3`: Now poetry runs successfully.<p>I mean, it works, but it is fragile (shebang probably needs to be manually reset at every update), not beginner-friendly, and not ergonomic. Installing using pip3 has the same issue. In comparison, pipenv is much easier to install. I was hoping this issue would not be present for poetry v1.0, but unfortunately it is.
评论 #21787635 未加载
评论 #21789622 未加载
评论 #21784404 未加载
Townley超过 5 年前
Even putting aside it&#x27;s approach to dependency management, Poetry has a fond place in my heart for making it so much easier to publish to PyPI.<p>If poetry did nothing but simply the process of publishing and updating python packages, it would still be an amazing tool.
评论 #21779665 未加载
评论 #21785476 未加载
Caligatio超过 5 年前
While I&#x27;m excited that Poetry hit 1.0, I&#x27;m actually more excited about the fact more devs were added to the maintenance team and that it transitioned to a project namespace. Sébastien was previously the sole dev with commit access so I&#x27;m hopeful this gives the project a much healthier future.
评论 #21779550 未加载
dhruvkar超过 5 年前
I&#x27;ve been watching poetry for the last couple years, hoping that it is THE replacement to the virtualenv&#x2F;virtualenvwrapper&#x2F;pyenv workflow.<p>pipenv never felt quite right. poetry has felt really close.<p>I&#x27;d love to know if anyone has made this jump and their experience.
评论 #21779551 未加载
评论 #21779547 未加载
guitarbill超过 5 年前
hopefully v1.0 now means it&#x27;s pretty stable. using poetry so far has been painful, the gains you got with the improved dependency resolution were unfortunately somewhat impacted by crazy annoying bugs, like `poetry shell` not actually activating the virtual environment [0]<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;python-poetry&#x2F;poetry&#x2F;issues&#x2F;571" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;python-poetry&#x2F;poetry&#x2F;issues&#x2F;571</a><p>edit: gah, still hitting baffling errors:<p><pre><code> $ poetry env use &#x2F;usr&#x2F;local&#x2F;bin&#x2F;python3 [NoCompatiblePythonVersionFound] The specified Python version (3.7) is not supported by the project (^3.7). Please choose a compatible version or loosen the python constraint specified in the pyproject.toml file. $ poetry env use &#x2F;usr&#x2F;local&#x2F;bin&#x2F;python3 [NoCompatiblePythonVersionFound] The specified Python version (3.7) is not supported by the project (&gt;=3.7). Please choose a compatible version or loosen the python constraint specified in the pyproject.toml file. </code></pre> v1.0.0 generally seems to work smoother though
acemarke超过 5 年前
For whatever reason, I&#x27;ve never understood the point or actual benefit of virtualenvs.<p>Having lived more in the JS ecosystem for the last several years, my ideal workflow would be a copy of how the Yarn package manager works:<p>- Top-level dependencies defined in an editable metadata file<p>- Transitive dependencies with hashes generated based on the calculated dependency tree<p>- All dependencies installed locally to the project, in the equivalent of a `node_modules` folder<p>- All package tarballs &#x2F; wheels &#x2F; etc cached locally and committed in an &quot;offline mirror&quot; folder for easy and consistent installation<p>- Attempting to reinstall packages when they already are installed in that folder should be an almost instantaneous no-op<p>PEP-582 (adding standard handling for a &quot;__pypackages__&quot; folder) appears to be the equivalent of `node_modules` that I&#x27;ve wanted, but tools don&#x27;t seem to support it yet. I&#x27;d looked through several Python packaging tools over the last year, but none of them seemed to support it yet (including Poetry [0]).<p>The only tool that I can find that really supports PEP-582 atm is `pythonloc` [1], which is really just a wrapper around `python` and pip` that adds that folder to the path. Using that and `pip-tools`, I was able to mostly cobble together a workflow that mimics the one I want. I wrote a `requirements.in` file with my main deps, generated a `requirements.txt` with the pinned versions and hashes with `pip-compile`, was able to download and cache them using `pip`, and installed them locally with `piploc`.<p>Admittedly, I&#x27;ve only tried this out once a few weeks ago on an experimental task, but it seemed to work out sufficiently, and I intend to implement that workflow on several of our Python services in the near future.<p>If anyone&#x27;s got suggestions on better &#x2F; alternate approaches, I&#x27;d be interested.<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;python-poetry&#x2F;poetry&#x2F;issues&#x2F;872" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;python-poetry&#x2F;poetry&#x2F;issues&#x2F;872</a><p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;cs01&#x2F;pythonloc" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cs01&#x2F;pythonloc</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;jazzband&#x2F;pip-tools" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jazzband&#x2F;pip-tools</a>
评论 #21779954 未加载
评论 #21779967 未加载
SaberTail超过 5 年前
Does anyone know if the situation with using `poetry` with `pyenv` has gotten any better? I like poetry&#x27;s approach, but I had a very difficult time getting it to play nice with my system last time I tried.
评论 #21784221 未加载
yegle超过 5 年前
What&#x27;s the advantage of using poetry compare to vendorize your dependencies and check in the whl files (which can be manylinux binary) into your version management system?
评论 #21779715 未加载
EsssM7QVMehFPAs超过 5 年前
Why would I use this instead of Anaconda?
评论 #21779574 未加载
评论 #21779579 未加载
评论 #21782400 未加载
starpilot超过 5 年前
Is there a good way to build a portable package containing dependencies for installing on an airgapped system?
评论 #21779460 未加载
评论 #21779497 未加载
评论 #21779659 未加载
评论 #21779558 未加载
评论 #21787783 未加载
评论 #21779643 未加载
评论 #21780308 未加载
评论 #21787604 未加载
MegaLeon超过 5 年前
I thought the billions ways to sort out dependencies and environments Python were its messiest part. I&#x27;ve been using a custom little batch script on windows to streamline that a bit as I mainly use python for small utilities as opposed to big projects - <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;leoncvlt&#x2F;10e67d9415e61eff0f5010ef6fec51d8#file-evenvo-bat-L33" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;leoncvlt&#x2F;10e67d9415e61eff0f5010ef6fe...</a> - but interested in giving this a spin!
merricksb超过 5 年前
Big discussion about project 4 months ago:<p><a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20672436" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=20672436</a>
himynameisdom超过 5 年前
Since pipenv is pretty much dormant, this seems to be a nice alternative. Thanks for sharing!
sansnomme超过 5 年前
Just to note, dev dependencies in Poetry is still rather flaky vis-à-vis projects forever in pre-release mode e.g. Black. Consider sticking with Pipenv if you have heavy dev dependencies requirements.
评论 #21779919 未加载
评论 #21779465 未加载
评论 #21779629 未加载
评论 #21779640 未加载
calibas超过 5 年前
Messing around with major&#x2F;minor Python version compatibility and dependency conflicts has always been my least favorite part of Python. A tool like this is much appreciated!
lkjaero超过 5 年前
This looks pretty nice! Definitely reminds me of the node ecosystem.
RocketSyntax超过 5 年前
it has a nice comparison to pipenv
评论 #21784306 未加载
skept超过 5 年前
It&#x27;s not clear from the current title but Poetry v1.0.0 was just released: <a href="https:&#x2F;&#x2F;github.com&#x2F;python-poetry&#x2F;poetry&#x2F;releases&#x2F;tag&#x2F;1.0.0" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;python-poetry&#x2F;poetry&#x2F;releases&#x2F;tag&#x2F;1.0.0</a>
juanuys超过 5 年前
Looks like Randall&#x27;s comic needs an update!<p><a href="https:&#x2F;&#x2F;github.com&#x2F;dephell&#x2F;dephell" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dephell&#x2F;dephell</a><p><a href="https:&#x2F;&#x2F;xkcd.com&#x2F;1987&#x2F;" rel="nofollow">https:&#x2F;&#x2F;xkcd.com&#x2F;1987&#x2F;</a>
评论 #21779927 未加载
评论 #21779660 未加载