问题标签 [python-poetry]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
1124 浏览

python - 在 Azure 管道上执行“诗歌安装”时没有名为“pyparsing”的模块

首先,我不确定这是否是 Windows、诗歌或 pyparsing 的问题,因为我没有 Windows 环境来重现此错误。

但是,当我在 Azure 管道上运行测试时会发生以下情况:

https://dev.azure.com/laike9m/laike9m/_build/results?buildId=2

poetry用来管理我的依赖,执行时poetry install发生错误:

但是,之前的日志显示pyparsing已经安装成功。

我的 Azure 管道配置文件在这里

https://github.com/laike9m/Cyber​​brain/blob/master/azure-pipelines.yml

不知何故,此错误仅发生在 Win + Python3.7 上,但在 Win + Python3.6 以及 Linux 和 OSX 上传递。

0 投票
1 回答
1994 浏览

python-3.x - 从 python 2.7 升级到 3.7 时的诗歌和 python 版本错误

我已经开始努力自学python。该项目在我的 Mac 上启动,安装版本为 python 2.7。在朋友的建议下,我安装了诗歌来进行依赖处理。这非常有效。

不久之后,我意识到 python 2.7 已经过时并尝试升级。我是通过自制软件做到的,这似乎打破了很多。 python --versoin仍然显示 2.7,虽然我可以调用python3 --version并看到正确的,但我的项目似乎仍然停留在 2.7 上,即使#!/usr/bin/env python3它位于文件的顶部。更糟糕的是poetry up,不会在项目中升级我的 python 依赖项并在 pyproject.toml 中更改该值会阻止一切。我有一个依赖项,它似乎在此过程中已经中断,但无法对损坏的诗歌/python 版本混乱做任何事情。错误来自诗歌。

因此,从顶部开始,我如何才能开始使用正确版本的 python?

我的 bash_profile 有

0 投票
1 回答
2589 浏览

python - Poetry and Pytest-cov with Sonar: how to reconcile the references?

I'm migrating all my modules to Poetry and I have a problem.

Before with a python setup.py test I was able to run my tests with the correct coverage information.

Now I'm moving to poetry, so my best option is poetry run pytest or otherwise poetry install; pytest. In both cases, I have to specify the source location in Sonar to collect the coverage data. Here I would naturally just pass my src folder, but clearly the references will be wrong because pytest is running using the code installed in the environment by poetry, not on the local code as it used to happen before, so the references will be mismatched. No amount of tinkering seems to be working.

So, is there a way with poetry to use the local references instead of the environment references when running with pytest? Or should I give up and use some weird trick with inspect to retrieve the path of the installed package in the site-packages folder?

0 投票
0 回答
1627 浏览

django - 添加包时的 Python 诗歌 [EnvCommandError]

[EnvCommandError]每当我尝试添加一个包时,Python's Poetry 总是让我失望。当我尝试安装依赖项时也会出现同样的错误,即诗歌安装

请注意,

1)我安装poetry正确(使用他们网站上提供的 curl)

2)我正在尝试将诗歌与 Docker 集成,所以我计划将开发与 docker 完全隔离,而不是与任何其他虚拟环境(如果有“更好”的方法来做到这一点,请这样说)

3)我处于开发的第一阶段:设置。没有什么是真正具体的,我正在尝试首先组织我要使用的包,这是我得到的错误

初始化很好:

它显示了交互式安装,但经过修改或任何形式的使用诗歌:

它返回给我:

0 投票
3 回答
7507 浏览

python - Can't install dependencies in docker container

I'm using poetry library to manage project dependencies, so when I use

docker build --tag=helloworld .

I got this error

Installing breaks on umongo (2.1.0) package

Here is my pyproject.toml file

And poetry.lock https://pastebin.com/kUjAKJHM

Dockerfile:

0 投票
1 回答
883 浏览

python - 跨平台 Pipenv.lock

我正在创建一个跨平台的 Python 应用程序,使用pipenv (据我了解poetry也有同样的问题)用于管理依赖项和虚拟环境。

在尝试在 Windows 和 Linux 上构建应用程序时,我注意到这Pipenv.lock是特定于平台的。

例如,我在 Windows 上创建一个项目并添加pytest, 它在锁定文件中具有coloramawith 。"markers": "sys_platform == 'win32'"但是在Linux上修改锁文件时,比如添加一个新的lib,这个依赖就会消失。

这是两个系统和差异的完整输出https://gist.github.com/AlexP11223/6457fd4c98272c526c855c63088c00d4

它应该像那样工作吗?如果是,最好的处理方法是什么?除了将所有平台的锁定文件提交到 Git 存储库(例如Pipenv-win.lock, Pipenv-linux.lock)并Pipenv.lock在构建时将其中一个重命名为之外,还有什么更好的解决方案吗?

0 投票
1 回答
1480 浏览

python-poetry - Poetry 中的 deps 和 dev-deps 有什么区别?

在 Poetry 的pyproject.toml配置文件中,您可以同时指定dependenciesdev-dependencies,但文档没有明确说明有什么区别。

我猜从名称来看,发布版本不会安装开发依赖项,但我没有注意到任何区别。您如何正确使用这些字段,例如排除构建中的开发依赖项?

0 投票
1 回答
2967 浏览

python - 安装后找不到随诗发布的Python包

在过去的几天里,我正在研究一个 python 模块。到目前为止,我poetry在许多其他项目中用作包管理工具,但这是我第一次想将包发布到 PyPI。

我能够运行poetry buildpoetry publish命令。我还能够安装已发布的软件包:

但是,安装后,我无法运行我的包:

我的项目具有以下结构:

我尝试在 pyproject.toml 文件中使用不同的脚本配置,但安装后我一直无法使其工作。

或者

我不知道这是 python/pip 路径/版本问题还是我需要更改配置文件中的某些内容。

如果有帮助,就是我正在谈论的 GitHub 存储库。该包也发布在 PyPI 上

0 投票
0 回答
203 浏览

python - 访问使用诗歌制作的包中的函数

我想用诗歌打包我的python代码。我已经设法制作了一个可以使用 pip 安装的 .whl,但是当我在 python 中导入它时,我无法访问任何功能。

这是我当前的pyproject.toml文件:

在诗歌创建的包目录中有 3 个文件helper.pyscheduler.py__init__.py. 里面helper.py有一个函数叫做adder(x,y).

我希望能够在 python 中调用这个函数,我必须如何修改我的 .toml 文件才能做到这一点?我尝试了各种包的变体并包含参数,但到目前为止没有任何效果。谢谢

0 投票
1 回答
1713 浏览

cython - 诗歌 + 狮身人面像 + Cython

我使用诗歌来构建我的 cython 包。我在所有函数和类中都有 NumPy 样式的文档字符串。我现在要做的是添加 Sphinx 自动文档并在 Read the Docs 上发布。

我已阅读此线程如何将 Sphinx 与 Cython 一起使用?并了解首先我必须编译我的 .pyx 文件。但是,当我poetry build最后打电话时,我只得到 .tar.gz 和 .whl 文件,没有 .pyd 或 .so 文件。

所以问题如下:有没有办法在诗歌构建过程中插入回调,以便在使用某些参数调用时文档自动生成?

我还将欣赏包的链接,将诗歌、狮身人面像和 cython 一起使用,以便我可以从中学习。