我想尝试诗歌,但最初的设置/测试对我不起作用,所以我有点困惑。我相信它应该“正常工作”,所以我想我错过了一些简单的步骤?
\n我使用的是 macOS:12.3 (21E230)\n我安装了最新版本:
\n$ poetry --version\nPoetry version 1.1.13\nRun Code Online (Sandbox Code Playgroud)\n现在我只想要一个纯粹的香草设置,并验证基础知识是否有效:
\n$ poetry new poetry_demo --src\nCreated package poetry_demo in poetry_demo\n$ cd poetry_demo/\n$ poetry install\nCreating virtualenv poetry-demo in /Users/barryredmond/dev/git/poetry_demo/.venv\nUpdating dependencies\nResolving dependencies... (0.1s)\n\nWriting lock file\n\nPackage operations: 8 installs, 0 updates, 0 removals\n\n \xe2\x80\xa2 Installing pyparsing (3.0.8)\n \xe2\x80\xa2 Installing attrs (21.4.0)\n \xe2\x80\xa2 Installing more-itertools (8.13.0)\n \xe2\x80\xa2 Installing packaging (21.3)\n \xe2\x80\xa2 Installing pluggy (0.13.1)\n \xe2\x80\xa2 Installing py (1.11.0)\n \xe2\x80\xa2 Installing wcwidth (0.2.5)\n \xe2\x80\xa2 Installing pytest (5.4.3)\n\nInstalling the current project: poetry_demo (0.1.0)\n\n$ …Run Code Online (Sandbox Code Playgroud) 我已经使用poetryand创建了一个新环境python3.7,并尝试安装项目中的第一个包:numpy。
当我运行时,poetry add numpy出现以下错误:
Using version ^1.22.4 for numpy\n\nUpdating dependencies\nResolving dependencies... (0.0s)\n\n SolverProblemError\n\n The current project's Python requirement (>=3.7,<4.0) is not compatible with some of the required packages Python requirement:\n - numpy requires Python >=3.8, so it will not be satisfied for Python >=3.7,<3.8\n \n Because no versions of numpy match >1.22.4,<2.0.0\n and numpy (1.22.4) requires Python >=3.8, numpy is forbidden.\n So, because base-env depends on numpy (^1.22.4), version solving …Run Code Online (Sandbox Code Playgroud) 我想在我的项目中使用包的预发布版本(https://test.pypi.org/project/delta-spark/2.1.0rc1/)。
我用来poetry管理我的pyproject.toml. 我该怎么做呢?
换句话说,相当于poetry:
pip install -i https://test.pypi.org/simple/ delta-spark==2.1.0rc1
我试过:
poetry add delta-spark==2.1.0rc1poetry add --allow-prereleases delta-spark==2.1.0rc1两者都给出:Could not find a matching version of package delta-spark
$ poetry config --local repositories.test-pypi https://test.pypi.org/
$ poetry config --list | fgrep repositories
repositories.test.url = "https://test.pypi.org/"
repositories.test-pypi.url = "https://test.pypi.org/"
$ fgrep -A 3 tool.poetry.source pyproject.toml
[[tool.poetry.source]]
name = "test-pypi"
url = "https://test.pypi.org/"
secondary = true
$ poetry add --group dev delta-spark==2.1.0rc1
Could not find a …Run Code Online (Sandbox Code Playgroud) 这应该是文档应该告诉您的第一件事,但它显然没有这样做。如何使用 peotry 安装我自己的软件包?
有了点,你就可以了pip install -e /path/to/folder/with/setup.py。与peetry对应的命令是什么?peotry install仅安装依赖项,而不安装模块本身。
在诗歌项目中,本地依赖项安装在~/.cache/pypoetry/virtualenvs/文件夹中。nvim 中的 Pyright 抱怨import无法解析包行。我应该包含什么内容pyproject.toml?或者如何向pyright显示依赖项的路径?谢谢
我的pyrightconfig.json看起来像这样:
{
"venvPath": ". /home/ajanb/.cache/pypoetry/virtualenvs/",
"venv": "tools-configfactory-materialmodel-jnEEQvIP-py3.10"
}
Run Code Online (Sandbox Code Playgroud)
我发现我需要将它添加到neovim的配置文件中,你能帮我把它写成.lua吗?
au FileType python let b:coc_root_patterns = ['.git', '.env', 'venv', '.venv', 'setup.cfg', 'setup.py', 'pyrightconfig.json']
Run Code Online (Sandbox Code Playgroud) 我使用的是 1.3.2 版本的 Poetry(目前是最后一个版本),并将组添加到 .toml 文件中,如下所示:[tool.poetry.group.dev.dependencies]。
以下官方文档尝试使用命令将库添加到该组:
poetry add pytest --group dev。
但总是收到错误消息:“--group”选项不存在。
(使用Python 3.9.15版本)
我尝试将诗歌版本更改为1.2.x,但没有帮助。
Poetry 无法安装 Hydra,出现以下错误。如何用诗歌安装Hydra:
\n$ poetry add hydra\n \nUsing version ^2.5 for hydra\n\nUpdating dependencies\nResolving dependencies... (6.3s)\n\nWriting lock file\n\nPackage operations: 1 install, 0 updates, 0 removals\n\n \xe2\x80\xa2 Installing hydra (2.5): Failed\n\n CalledProcessError\n\n Command '['/Users/mc/Library/Caches/pypoetry/virtualenvs/showcase-project-lis5iaDt-py3.9/bin/python', '-m', 'pip', 'install', '--use-pep517', '--disable-pip-version-check', '--isolated', '--no-input', '--prefix', '/Users/mc/Library/Caches/pypoetry/virtualenvs/showcase-project-lis5iaDt-py3.9', '--no-deps', '/Users/mc/Library/Caches/pypoetry/artifacts/d8/9a/72/7404c4669ad6d023f10626f1f4ad5a0f0bb0fe11b6e4ec7fe398dff895/Hydra-2.5.tar.gz']' returned non-zero exit status 1.\n\n at /opt/homebrew/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py:528 in run\n 524\xe2\x94\x82 # We don't call process.wait() as .__exit__ does that for us.\n 525\xe2\x94\x82 raise\n 526\xe2\x94\x82 retcode = process.poll()\n 527\xe2\x94\x82 if check and retcode:\n \xe2\x86\x92 528\xe2\x94\x82 raise CalledProcessError(retcode, …Run Code Online (Sandbox Code Playgroud) 我最近从 Pipenv 转向诗歌。我习惯在我的 Pipfile 中包含此部分:
[scripts]
test="pytest -s"
test:watch="ptw --runner 'pytest -s'"
Run Code Online (Sandbox Code Playgroud)
因此我可以轻松运行测试,而无需键入完整命令或输入 shell,例如:
[scripts]
test="pytest -s"
test:watch="ptw --runner 'pytest -s'"
Run Code Online (Sandbox Code Playgroud)
当我在 pyproject.toml 中尝试类似的操作时:
pipenv run test:watch
Run Code Online (Sandbox Code Playgroud)
我收到错误:
[tool.poetry.scripts]
watch = "ptw --runner 'pytest -s'"
Run Code Online (Sandbox Code Playgroud)
我应该为此使用 pyproject.toml 中的不同部分吗?
我安装了诗歌,但是在尝试调用诗歌时出现以下错误
zsh: command not found: poetry
Run Code Online (Sandbox Code Playgroud)
我知道我已经安装了它,因为我在尝试运行以下安装脚本时得到以下输出
$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
Retrieving Poetry metadata
Latest version already installed.
Run Code Online (Sandbox Code Playgroud) 以下内容位于requirements.txt中:
requirements.txt:packaging==20.9
Run Code Online (Sandbox Code Playgroud)
但在做了之后,我们现在在诗歌.lockpoetry add [some unrelated pkg] 中有:
{文件=“packaging-21.3.tar.gz”,散列=“sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb”},
这对我们不起作用。怎样才能得到诗歌听的requirements.txt?
我正在使用诗歌版本 1.2.2 和 python 3.11\n我想使用像 pl.read_sql() 这样的极坐标来读取 sql 查询\n但它需要connectorx库。\n我可以使用 pip installconnectorx 但诗歌来安装该库添加connectorx给出了这个错误:
\n RuntimeError\n\n Unable to find installation candidates for connectorx (0.3.1)\n\n at ~\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages\\poetry\\installation\\chooser.py:103 in choose_for\n 99\xe2\x94\x82\n 100\xe2\x94\x82 links.append(link)\n 101\xe2\x94\x82\n 102\xe2\x94\x82 if not links:\n \xe2\x86\x92 103\xe2\x94\x82 raise RuntimeError(f"Unable to find installation candidates for {package}")\n 104\xe2\x94\x82\n 105\xe2\x94\x82 # Get the best link\n 106\xe2\x94\x82 chosen = max(links, key=lambda link: self._sort_key(package, link))\n 107\xe2\x94\x82\n\nRun Code Online (Sandbox Code Playgroud)\n尝试清除诗歌缓存\n尝试添加到 pyproject.toml 中
\n如何为主要特征npm比较pip,pipenv以及poetry包管理器?以及如何使用pipenv或的那些功能poetry?
这主要可以帮助某人从JavaScript开发人员过渡到python开发人员。
我从未使用过rubygems,但将其主要功能与主要的python软件包管理器进行比较可能也很有用。帮助任何来自红宝石背景的人。
python-poetry ×12
python ×9
pip ×3
hydra ×1
pipenv ×1
postgresql ×1
pyright ×1
python-3.x ×1
python-venv ×1