python-poetry / poetry Goto Github PK
View Code? Open in Web Editor NEWPython packaging and dependency management made easy
Home Page: https://python-poetry.org
License: MIT License
Python packaging and dependency management made easy
Home Page: https://python-poetry.org
License: MIT License
Basically this sdispater/poet#5
It'd be nice to detect as many things automatically, but somewhere in pyproject.toml
to manually add them would also be useful.
Hi :)
I am trying to build a package using poetry and I am receiving and error, the steps to reproduce it are these:
poetry new example
cd example
poetry build
and it returns [AttributeError] '_Printer' object has no attribute 'id'
Do you know how to fix this error?
Is there any documentarion about the pyproject.toml and its options?
Could be great if the default pyproject.toml includes more default options
We should implement a way to validate the poetry.toml file, both in a loose way (just for dependency management) and a strict way (for packaging).
I have an already existing project and would like to switch from pip to poetry. Basically I want to initialize an already exsting folder.
How should I do it? It seems poetry doesn't support this.
Kinda looking the same, just wondering :D
Hi,
The Official site referenced in README.md looks broken. Can you confirm this ?
> <new venv>
> pip install poetry
> poetry new <project>
> cd <project>
> poetry add --dev bpython
Using version ^0.17.1 for bpython
Updating dependencies
Resolving dependencies............
Package operations: 8 installs, 0 updates, 0 removals
Writing lock file
- Installing cryptography (2.2.2)
- Installing curtsies (0.3.0)
- Installing greenlet (0.4.13)
- Installing ndg-httpsclient (0.4.4)
- Installing pyasn1 (0.4.2)
- Installing pygments (2.2.0)
- Installing pyopenssl (17.5.0)
- Installing bpython (0.17.1)
> poetry remove --dev bpython
Updating dependencies
Resolving dependencies....
Package operations: 0 installs, 0 updates, 13 removals
Writing lock file
- Removing bpython (0.17.1)
- Removing certifi (2018.1.18)
- Removing chardet (3.0.4)
- Removing cryptography (2.2.2)
- Removing curtsies (0.3.0)
- Removing greenlet (0.4.13)
- Removing idna (2.6)
- Removing ndg-httpsclient (0.4.4)
- Removing pyasn1 (0.4.2)
- Removing pygments (2.2.0)
- Removing pyopenssl (17.5.0)
- Removing requests (2.18.4)
- Removing urllib3 (1.22)
> poetry add bpython
[ModuleNotFoundError]
No module named 'requests'
add [-D|--dev] [--optional] [--dry-run] [--] <name> (<name>)...
>
You can see that poetry removes more than it installed for bpython. In particular, it removed requests
, which it needs to operate.
We cannot run pip install -e .
because there is no setup.py
. What would be the way to achieve this using poetry?
The search command only failed with python version 2.7.12.
I also test with Python 3.6.4 and it works fine on this version.
Command:
poetry search pagseguro
Output:
pagseguro (0.3.2)
Pagseguro API v2 wrapper
pagseguro-api-v2 (0.0.2)
Pagseguro API
django-oscar-pagseguro (0.0.4)
Pagseguro integration for django-oscar
pagseguro-python (0.37)
PagSeguro API v.2 client library
pagseguro-sdk (0.1.2)
[UnicodeEncodeError]
'ascii' codec can't encode characters in position 16-17: ordinal not in range(128)
search [-N|--only-name] [--] <tokens> (<tokens>)...```
With PEP508 you can limit certain package to a specific platforms, e.g. waitress==1.0.2;platform_system=="Windows"
to install waitress
only on Windows.
It seem like poetry
doesn't support this feature at all or at least i wasn't able to specify the constraint from above. Neither poetry add waitress==1.0.2;platform_system=="Windows"
nor writing waitress = "=1.0.2;platform_system=Windows"
to the pyproject.toml
works.
The README indicates that poetry supports older versions of python, but when I run poetry install
in a fresh project directory it's using python 3 (the same one that poetry itself is running on). I can't find an option to specify the python version to use. I specified python 2.7 as a dependency in my pyproject.toml.
I only just rebuilt/installed a project of mine that included a plugins section. It seems when TOML validation was added in 0.6.0, the plugins section was left out of poetry-schema.json
causing validation to fail.
[ImportError]
cannot import name 'where'
There are still references to poet
vs poetry
in the README. And the CLI help still refers to poetry.toml
vs pyproject.toml
.
You mention features at to places:
You can also specify the features you want installed by passing the --f|--features option (See Features for more info)
poetry install --features "mysql pgsql" poetry install -f mysql -f pgsql
and
When installing packages, you can specify features by using the -E|--extras option:
poet install --extras "mysql pgsql" poet install -E mysql -E pgsql
Also the Features
(See Features for more info) link leads nowhere.
I have a big project with lots of dependencies that I'm trying to get working in poetry. I'm getting this error when trying poetry install
[SolverProblemError]
Unable to satisfy the following requirements:
- "django-imgix (^1.1.0)" required by "pyproject.toml"
Even if I pass -vvv
I'm not getting any more information about what's wrong. I assume there's some conflict in the dependency tree somewhere, but I have no idea where it is. It'd be nice if poetry would print out information about what constraints have been applied to this package and where those constraints come from.
Given this pyproject.toml
file:
[tool.poetry]
name = "example"
version = "0.1.0"
authors = [ "My Name <[email protected]>",]
description = "Example package"
[tool.poetry.dependencies]
python = "^2.7"
pytest = { version = "^3.4", optional = true }
[tool.poetry.dev-dependencies]
[tool.poetry.extras]
test = ["pytest"]
When I run poetry build
, if I then go and inspect the sdist that was built, the setup.py
file looks like this:
# -*- coding: utf-8 -*-
from distutils.core import setup
packages = \
['example']
package_data = \
{'': ['*']}
install_requires = \
['pytest (>=3.4.0.0,<4.0.0.0)']
setup_kwargs = {
'name': 'example',
'version': '0.1.0',
'description': 'Example package',
'long_description': None,
'author': 'My Name',
'author_email': '[email protected]',
'url': None,
'packages': packages,
'package_data': package_data,
'install_requires': install_requires,
'python_requires': '>= 2.7.0.0, < 3.0.0.0',
}
setup(**setup_kwargs)
As you can see pytest
has been added to install_requires
and not extras_require
.
This is a fun one. My project depends on pluggy = "^.0.6.0"
, which up until three days ago only had a .tar.gz
release. Then they uploaded some wheels with the same version. I ran a poetry install
today, and it seems that it's preferring the new .whl files (as it should), but then not realizing that this is a different file from the .tar.gz, so it shouldn't really be comparing to that old hash.
Here's the error I'm getting:
- Installing pluggy (0.6.0)
[VenvCommandError]
Command ['pip', 'install', '--no-deps', '-r', '/tmp/pluggy-0.6.0iCCMcYreqs.txt'] errored with the following output:
Collecting pluggy==0.6.0 (from -r /tmp/pluggy-0.6.0iCCMcYreqs.txt (line 1))
Downloading https://files.pythonhosted.org/packages/82/05/43e3947125a2137cba4746135c75934ceed1863f27e050fc560052104a71/pluggy-0.6.0-py2-none-any.whl
THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the packag
e contents carefully; someone may have tampered with them.
pluggy==0.6.0 from https://files.pythonhosted.org/packages/82/05/43e3947125a2137cba4746135c75934ceed1863f27e050fc560052104a71/pluggy-0.6.0-py2-none-any.whl#sha2
56=d345c8fe681115900d6da8d048ba67c25df42973bda370783cd58826442dcd7c (from -r /tmp/pluggy-0.6.0iCCMcYreqs.txt (line 1)):
Expected sha256 7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff
Got d345c8fe681115900d6da8d048ba67c25df42973bda370783cd58826442dcd7c
We should have a way to build non pure-python projects (from instance if they need to build C extensions).
Would be nice to automate the semantic version bumping process with equivalents for:
npm version patch
npm version minor
npm version major
(npm version [<newversion> | major | minor | patch | premajor | preminor | prepatch | prerelease | from-git]
)
If I prefer to include my vendored dependencies directly in my repository, is there a way for me to specify them as a dependency?
e.g., if I have vendor/foo
, it seems it'd be nice if I could specify a dependency like
[tool.poetry.dependencies]
foo-package = {path = "vendor/foo"}
After using the custom installer to install Poetry for Python 2.7, when I try to add a dependency to a project I get this Windows Error:
$ poetry add pendulum -vvv
Using version ^1.4 for pendulum
Updating dependencies
: 0: Starting resolution (2018-04-14 13:55:48.344000)
: 0: Requested dependencies: ['pendulum (^1.4)', 'pytest (^3.5)']
Resolving dependencies
: 0: Getting dependencies for pendulum-1.4.4
: 0: Getting dependencies for pendulum-1.4.3
: 0: Getting dependencies for pendulum-1.4.2
: 0: Getting dependencies for pendulum-1.4.1
: 0: Getting dependencies for pendulum-1.4.0
: 0: Creating possibility state for pendulum (^1.4) (5 remaining)
: 1: Attempting to activate [pendulum-1.4.4]
: 1: Activated pendulum at [pendulum-1.4.4]
: 1: Requiring nested dependencies (pytzdata (>= 2018.3.0.0), tzlocal (>= 1.5.0.0, < 2.0.0.0), python-dateutil (>= 2.6.0.0, < 3.0.0.0))
: 1: Getting dependencies for pytest-3.5.0
: 0: Creating possibility state for pytest (^3.5) (1 remaining)
: 2: Attempting to activate [pytest-3.5.0]
: 2: Activated pytest at [pytest-3.5.0]
: 2: Requiring nested dependencies (py (>= 1.5.0.0), six (>= 1.10.0.0), attrs (>= 17.4.0.0), more-itertools (>= 4.0.0.0), pluggy (< 0.7.0.0, >= 0.5.0.0), funcsigs (*), colorama (*))
: 2: Getting dependencies for pytzdata-2018.4
: 0: Finished resolution (2 steps) in 1.026 seconds
[WindowsError]
[Error 32] The process cannot access the file because it is being used by another process: 'c:\\users\\mitch\\appdata\\local\\temp\\tmp_2aucm\\pytzdata-2018.4.tar.gz'
Exception trace:
c:\python27\lib\site-packages\poetry\_vendor\cleo\application.py in run() at line 94
status_code = self.do_run(input_, output_)
c:\python27\lib\site-packages\poetry\console\application.py in do_run() at line 74
return super(Application, self).do_run(i, o)
c:\python27\lib\site-packages\poetry\_vendor\cleo\application.py in do_run() at line 197
status_code = command.run(input_, output_)
c:\python27\lib\site-packages\poetry\console\commands\command.py in run() at line 22
return super(BaseCommand, self).run(i, o)
c:\python27\lib\site-packages\poetry\_vendor\cleo\commands\base_command.py in run() at line 146
status_code = self.execute(input_, output_)
c:\python27\lib\site-packages\poetry\_vendor\cleo\commands\command.py in execute() at line 107
return self.handle()
c:\python27\lib\site-packages\poetry\console\commands\add.py in handle() at line 87
status = installer.run()
c:\python27\lib\site-packages\poetry\installation\installer.py in run() at line 73
self._do_install(local_repo)
c:\python27\lib\site-packages\poetry\installation\installer.py in _do_install() at line 171
ops = solver.solve(request, fixed=fixed)
c:\python27\lib\site-packages\poetry\puzzle\solver.py in solve() at line 41
graph = resolver.resolve(requested, base=base)
c:\python27\lib\site-packages\poetry\mixology\resolver.py in resolve() at line 39
base
c:\python27\lib\site-packages\poetry\mixology\resolution.py in resolve() at line 93
self._process_topmost_state()
c:\python27\lib\site-packages\poetry\mixology\resolution.py in _process_topmost_state() at line 158
self._attempt_to_activate()
c:\python27\lib\site-packages\poetry\mixology\resolution.py in _attempt_to_activate() at line 775
self._activate_new_spec()
c:\python27\lib\site-packages\poetry\mixology\resolution.py in _activate_new_spec() at line 821
self._require_nested_dependencies_for(self.possibility)
c:\python27\lib\site-packages\poetry\mixology\resolution.py in _require_nested_dependencies_for() at line 851
len(nested_dependencies) > 0
c:\python27\lib\site-packages\poetry\mixology\resolution.py in _push_state_for_requirements() at line 884
possibilities = self._possibilities_for_requirement(new_requirement)
c:\python27\lib\site-packages\poetry\mixology\resolution.py in _possibilities_for_requirement() at line 908
self._provider.search_for(requirement)
c:\python27\lib\site-packages\poetry\mixology\resolution.py in _group_possibilities() at line 942
dependencies = self._provider.dependencies_for(possibility)
c:\python27\lib\site-packages\poetry\puzzle\provider.py in dependencies_for() at line 207
complete_package = self._pool.package(package.name, package.version)
c:\python27\lib\site-packages\poetry\repositories\pool.py in package() at line 62
package = repository.package(name, version)
c:\python27\lib\site-packages\poetry\repositories\pypi_repository.py in package() at line 120
release_info = self.get_release_info(name, version)
c:\python27\lib\site-packages\poetry\repositories\pypi_repository.py in get_release_info() at line 234
lambda: self._get_release_info(name, version)
c:\python27\lib\site-packages\poetry\_vendor\cachy\repository.py in remember_forever() at line 174
val = value(callback)
c:\python27\lib\site-packages\poetry\_vendor\cachy\helpers.py in value() at line 6
return val()
c:\python27\lib\site-packages\poetry\repositories\pypi_repository.py in <lambda>() at line 234
lambda: self._get_release_info(name, version)
c:\python27\lib\site-packages\poetry\repositories\pypi_repository.py in _get_release_info() at line 302
requires_dist = self._get_requires_dist_from_urls(urls)
c:\python27\lib\site-packages\poetry\repositories\pypi_repository.py in _get_requires_dist_from_urls() at line 322
return self._get_requires_dist_from_sdist(urls['sdist'])
c:\python27\lib\site-packages\poetry\repositories\pypi_repository.py in _get_requires_dist_from_sdist() at line 385
return
c:\python27\lib\contextlib.py in __exit__() at line 24
self.gen.next()
c:\python27\lib\site-packages\poetry\utils\helpers.py in temporary_directory() at line 30
shutil.rmtree(name)
c:\python27\lib\shutil.py in rmtree() at line 266
onerror(os.remove, fullname, sys.exc_info())
c:\python27\lib\shutil.py in rmtree() at line 264
os.remove(fullname)
add [-D|--dev] [--optional] [--dry-run] [--] <name> (<name>)...
When installing bpython
as a dev package, blessings
is not installed:
> poetry new shared-mem
Created package shared-mem in shared-mem
> cd shared-mem
> poetry add --dev bpython
Using version ^0.17.1 for bpython
Updating dependencies
Resolving dependencies............
Package operations: 8 installs, 0 updates, 0 removals
Writing lock file
- Installing cryptography (2.2.2)
- Installing curtsies (0.3.0)
- Installing greenlet (0.4.13)
- Installing ndg-httpsclient (0.4.4)
- Installing pyasn1 (0.4.2)
- Installing pygments (2.2.0)
- Installing pyopenssl (17.5.0)
- Installing bpython (0.17.1)
> bpython
Traceback (most recent call last):
File "/<home>/.pyenv/versions/shared-mem/bin/bpython", line 7, in <module>
from bpython.curtsies import main
File "/<home>/.pyenv/versions/3.6.4/envs/shared-mem/lib/python3.6/site-packages/bpython/curtsies.py", line 11, in <module>
import curtsies
File "/<home>/.pyenv/versions/3.6.4/envs/shared-mem/lib/python3.6/site-packages/curtsies/__init__.py", line 4, in <module>
from .window import FullscreenWindow, CursorAwareWindow
File "/<home>/.pyenv/versions/3.6.4/envs/shared-mem/lib/python3.6/site-packages/curtsies/window.py", line 11, in <module>
import blessings
ModuleNotFoundError: No module named 'blessings'
>
After creating a new package with poetry new package
, pyproject.toml is missing description
and python
properties probably should be auto-created.
When running web server (or other daemon-like process) via poetry run
, like aiohttp.web.run_app
stopping it with Ctrl+C
leads to redundant traceback, like:
$ poetry run python -m api
======== Running on http://0.0.0.0:8205 ========
(Press CTRL+C to quit)
======== Running on http://0.0.0.0:8205 ========
(Press CTRL+C to quit)
^CTraceback (most recent call last):
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/bin/poetry", line 11, in <module>
sys.exit(console.run())
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/console/application.py", line 59, in run
return super().run(i, o)
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/cleo/application.py", line 94, in run
status_code = self.do_run(input_, output_)
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/console/application.py", line 70, in do_run
status_code = command.run(i, o)
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/console/commands/command.py", line 25, in run
return super(BaseCommand, self).run(i, o)
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/cleo/commands/base_command.py", line 146, in run
status_code = self.execute(input_, output_)
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/cleo/commands/command.py", line 108, in execute
return self.handle()
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/console/commands/run.py", line 17, in handle
return venv.exec(*args)
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/utils/venv.py", line 167, in exec
completed = subprocess.run([bin] + list(args), **kwargs)
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/subprocess.py", line 405, in run
stdout, stderr = process.communicate(input, timeout=timeout)
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/subprocess.py", line 835, in communicate
self.wait()
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/subprocess.py", line 1457, in wait
(pid, sts) = self._try_wait(0)
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/subprocess.py", line 1404, in _try_wait
(pid, sts) = os.waitpid(self.pid, wait_flags)
KeyboardInterrupt
From my POV, the keyboard interrupt traceback should be omitted as it is a kind of expected error for poetry run ...
calls.
Source of api/__main__.py
is listed below,
import uvloop
from aiohttp import web
from api.app import create_app
if name == 'main':
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
app = create_app()
if app['settings']['DEBUG']:
import aiohttp_autoreload
aiohttp_autoreload.start()
web.run_app(app, host='0.0.0.0', port=8205)
</details>
In order to make poetry standalone and not mess with the user system, we should probably vendorize the dependencies.
pip supports at least two private repositories through the combination of --index-url
and --extra-index-url
. It'd be nice to support any number of private repositories, but having at least two is necessary for my particular use case.
PS: thanks for this very promising project!
When I run poetry search requests it returns this error:
[CommandNotFound] Command "search" is not defined.
This command appears in the documentation and the README file, could you please tell me if this command will be part of poetry?
We should add a remove command that would behave the opposite of add()
:
poetry remove requests
PyPI now supports Markdown README files directly using description_content_type
set to "text/markdown"
. Here is the PR that added it to the warehouse project.
While trying to remember the exact name of this project and googling I first found your poet package which was a bit confusing.
Could you clarify what the (if any) relationship between the two is?
Also: Thanks a ton for bringing some fresh air into the python packaging world!
When I follow the installation instructions on my mac OS 10.13.4
using the following command:
pushd /usr/local/bin
ln -s pip3 pip
popd
curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python3
then I get the following error message:
Retrieving metadata
Installing version: 0.7.0
- Getting dependencies
Traceback (most recent call last):
File "<stdin>", line 259, in <module>
File "<stdin>", line 255, in main
File "<stdin>", line 165, in run
File "<stdin>", line 175, in install
File "<stdin>", line 233, in call
File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 336, in check_output
**kwargs).stdout
File "/usr/local/Cellar/python/3.6.4_4/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 418, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '('pip', 'install', 'poetry==0.7.0', '--target', '/var/folders/py/9zg6845j2gb664dqkw24wn4w0000gn/T/poetry-installer-toi2v75x/dist')' returned non-zero exit status 2.
I tried installing the package via pip3 directly, but that does not install a poetry
executable. If instead I try to run the package`s main function then I get this error message:
$ python3 -mpoetry
/usr/local/opt/python/bin/python3.6: No module named poetry.__main__; 'poetry' is a package and cannot be directly executed
Any ideas on how to get this to work?
It seems poetry is passing a PosixPath to execv, which needs strings. Maybe this is something that only affects Python 2.7?
Version: poetry 0.8.3
I added a print statement to see what git command was being run, that's the RUNNING GIT:
part in the output.
{}radix@pop-os:~/Juice/fruition$ poetry install -v
Using virtualenv: /home/radix/.cache/pypoetry/virtualenvs/fruition-py2.7
Updating dependencies
Resolving dependencies
RUNNING GIT: ('clone', u'git+https://github.com/imgix/imgix-python', PosixPath('/tmp/pypoetry-git-imgix0ivPX4'))
[TypeError]
execv() arg 2 must contain only strings
Exception trace:
/home/radix/.local/lib/python2.7/site-packages/cleo/application.py in run() at line 94
status_code = self.do_run(input_, output_)
/home/radix/.local/lib/python2.7/site-packages/poetry/console/application.py in do_run() at line 74
return super(Application, self).do_run(i, o)
/home/radix/.local/lib/python2.7/site-packages/cleo/application.py in do_run() at line 197
status_code = command.run(input_, output_)
/home/radix/.local/lib/python2.7/site-packages/poetry/console/commands/command.py in run() at line 22
return super(BaseCommand, self).run(i, o)
/home/radix/.local/lib/python2.7/site-packages/cleo/commands/base_command.py in run() at line 146
status_code = self.execute(input_, output_)
/home/radix/.local/lib/python2.7/site-packages/cleo/commands/command.py in execute() at line 107
return self.handle()
/home/radix/.local/lib/python2.7/site-packages/poetry/console/commands/install.py in handle() at line 40
return installer.run()
/home/radix/.local/lib/python2.7/site-packages/poetry/installation/installer.py in run() at line 73
self._do_install(local_repo)
/home/radix/.local/lib/python2.7/site-packages/poetry/installation/installer.py in _do_install() at line 171
ops = solver.solve(request, fixed=fixed)
/home/radix/.local/lib/python2.7/site-packages/poetry/puzzle/solver.py in solve() at line 41
graph = resolver.resolve(requested, base=base)
/home/radix/.local/lib/python2.7/site-packages/poetry/mixology/resolver.py in resolve() at line 39
base
/home/radix/.local/lib/python2.7/site-packages/poetry/mixology/resolution.py in resolve() at line 72
self._start()
/home/radix/.local/lib/python2.7/site-packages/poetry/mixology/resolution.py in _start() at line 113
self._handle_missing_or_push_dependency_state(self._initial_state())
/home/radix/.local/lib/python2.7/site-packages/poetry/mixology/resolution.py in _initial_state() at line 220
self._possibilities_for_requirement(initial_requirement, graph),
/home/radix/.local/lib/python2.7/site-packages/poetry/mixology/resolution.py in _possibilities_for_requirement() at line 908
self._provider.search_for(requirement)
/home/radix/.local/lib/python2.7/site-packages/poetry/puzzle/provider.py in search_for() at line 75
packages = self.search_for_vcs(dependency)
/home/radix/.local/lib/python2.7/site-packages/poetry/puzzle/provider.py in search_for_vcs() at line 115
git.clone(dependency.source, tmp_dir)
/home/radix/.local/lib/python2.7/site-packages/poetry/vcs/git.py in clone() at line 42
return self.run('clone', repository, dest)
/home/radix/.local/lib/python2.7/site-packages/poetry/vcs/git.py in run() at line 100
stderr=subprocess.STDOUT
/usr/lib/python2.7/subprocess.py in check_output() at line 212
process = Popen(stdout=PIPE, *popenargs, **kwargs)
/usr/lib/python2.7/subprocess.py in __init__() at line 390
errread, errwrite)
/usr/lib/python2.7/subprocess.py in _execute_child() at line 1025
raise child_exception
install [--no-dev] [--dry-run] [-E|--extras EXTRAS]
I'm unclear how to actually install and use this on macOS.
According to #36 there are no plans to support hombrew's python and the recommended method is to use pyenv. However, when using pyenv, the poetry command is only available in the env you've run the install script from which doesn't really work since we use virtualenvs for all our projects.
Trying to add Sphinx to my dependencies, but none of Sphinx's dependencies get installed.
Here's what my pyproject.toml
looks like after running poetry add sphinx
:
[tool.poetry]
name = "poetry-demo"
version = "0.1.0"
authors = [ "My Name <[email protected]>",]
description = "Here's a package supplied by Poetry."
[tool.poetry.dependencies]
python = "^2.7"
sphinx = "^1.7"
[tool.poetry.dev-dependencies]
pytest = "^3.4"
And my pyproject.lock
:
[[package]]
name = "attrs"
version = "17.4.0"
description = "Classes Without Boilerplate"
category = "dev"
optional = false
python-versions = "*"
platform = "*"
[[package]]
name = "colorama"
version = "0.3.9"
description = "Cross-platform colored terminal text."
category = "dev"
optional = false
python-versions = "*"
platform = "*"
[package.requirements]
platform = "win32"
[[package]]
name = "funcsigs"
version = "1.0.2"
description = "Python function signatures from PEP362 for Python 2.6, 2.7 and 3.2+"
category = "dev"
optional = false
python-versions = "*"
platform = "*"
[package.requirements]
python = "<3.0"
[[package]]
name = "pluggy"
version = "0.6.0"
description = "plugin and hook calling mechanisms for python"
category = "dev"
optional = false
python-versions = "*"
platform = "*"
[[package]]
name = "py"
version = "1.5.2"
description = "library with cross-python path, ini-parsing, io, code, log facilities"
category = "dev"
optional = false
python-versions = "*"
platform = "*"
[[package]]
name = "pytest"
version = "3.4.2"
description = "pytest: simple powerful testing with Python"
category = "dev"
optional = false
python-versions = "*"
platform = "*"
[package.dependencies]
colorama = ""
funcsigs = ""
pluggy = "<0.7,>=0.5"
attrs = ">=17.2.0"
setuptools = ""
six = ">=1.10.0"
py = ">=1.5.0"
[[package]]
name = "six"
version = "1.11.0"
description = "Python 2 and 3 compatibility utilities"
category = "dev"
optional = false
python-versions = "*"
platform = "*"
[[package]]
name = "sphinx"
version = "1.7.1"
description = "Python documentation generator"
category = "main"
optional = false
python-versions = "*"
platform = "*"
[metadata]
python-versions = "^2.7"
platform = "*"
content-hash = "520283d56df5911cac74bab7cd560271a1470283fac751f551c44e5eb6c466b0"
[metadata.hashes]
attrs = [ "a17a9573a6f475c99b551c0e0a812707ddda1ec9653bed04c13841404ed6f450", "1c7960ccfd6a005cd9f7ba884e6316b5e430a3f1a6c37c5f87d8b43f83b54ec9",]
colorama = [ "463f8483208e921368c9f306094eb6f725c6ca42b0f97e313cb5d5512459feda", "48eb22f4f8461b1df5734a074b57042430fb06e1d61bd1e11b078c0fe6d7a1f1",]
funcsigs = [ "330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca", "a7bb0f2cf3a3fd1ab2732cb49eba4252c2af4240442415b4abce3b87022a8f50",]
pluggy = [ "7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff",]
py = [ "8cca5c229d225f8c1e3085be4fcf306090b00850fefad892f9d96c7b6e2f310f", "ca18943e28235417756316bfada6cd96b23ce60dd532642690dcfdaba988a76d",]
pytest = [ "062027955bccbc04d2fcd5d79690947e018ba31abe4c90b2c6721abec734261b", "117bad36c1a787e1a8a659df35de53ba05f9f3398fb9e4ac17e80ad5903eb8c5",]
six = [ "832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb", "70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",]
sphinx = [ "41ae26acc6130ccf6ed47e5cca73742b80d55a134f0ab897c479bba8d3640b8e", "da987de5fcca21a4acc7f67a86a363039e67ac3e8827161e61b91deb131c0ee8",]
This was also happening when I was trying to install pylint, its dependencies weren't installed.
I've got Poetry installed using pipsi to keep it self contained from my system Python. I create a new project using Poetry then make a new virtualenv for it using Pew which launches a subshell in the new virtualenv. From there I run poetry add pendulum
, that's when I get the error, and no packages have been installed.
Here's the output:
E:\>cd tools/code
E:\tools\code>poetry new example
Created package example in example
E:\tools\code>cd example
E:\tools\code\example>pew new example-env
Using real prefix 'C:\\Users\\mitchell\\AppData\\Local\\Programs\\Python\\Python
36-32'
New python executable in C:\Users\mitchell\.virtualenvs\example-env\Scripts\pyth
on.exe
Installing setuptools, pip, wheel...done.
Launching subshell in virtual environment. Type 'exit' to return.
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
E:\tools\code\example>poetry add pendulum
Using version ^1.4 for pendulum
Updating dependencies
Resolving dependencies.....
Package operations: 9 installs, 0 updates, 0 removals
Writing lock file
- Installing py (1.5.2)
[FileNotFoundError]
[WinError 2] The system cannot find the file specified
add [-D|--dev] [--optional] [--dry-run] [--] <name> (<name>)...
radix@pop-os:~$ poetry self:update -v
Updating to 0.8.4
[RuntimeError]
Unable to determine poetry's path
Exception trace:
/home/radix/.local/lib/python2.7/site-packages/cleo/application.py in run() at line 94
status_code = self.do_run(input_, output_)
/home/radix/.local/lib/python2.7/site-packages/poetry/console/application.py in do_run() at line 74
return super(Application, self).do_run(i, o)
/home/radix/.local/lib/python2.7/site-packages/cleo/application.py in do_run() at line 197
status_code = command.run(input_, output_)
/home/radix/.local/lib/python2.7/site-packages/poetry/console/commands/command.py in run() at line 22
return super(BaseCommand, self).run(i, o)
/home/radix/.local/lib/python2.7/site-packages/cleo/commands/base_command.py in run() at line 146
status_code = self.execute(input_, output_)
/home/radix/.local/lib/python2.7/site-packages/cleo/commands/command.py in execute() at line 107
return self.handle()
/home/radix/.local/lib/python2.7/site-packages/poetry/console/commands/self/update.py in handle() at line 68
self.update(release)
/home/radix/.local/lib/python2.7/site-packages/poetry/console/commands/self/update.py in update() at line 102
raise RuntimeError('Unable to determine poetry\'s path')
self:update [--preview] [--] [<version>]
Might want to provide proper Apache License source attribution in your README for the code copied from Twine (and any other copy-pasted code in the codebase):
https://github.com/sdispater/poetry/blob/master/poetry/masonry/publishing/publisher.py#L257
https://github.com/pypa/twine/blob/master/twine/commands/upload.py#L149
Hat-tip to @brainwane for pointing this out!
$ poetry add Qt.py
Using version ^1.1 for Qt.py
[InvalidProjectFile]
[dependencies] 'Qt.py' does not match any of the regexes: '^[a-zA-Z-_0-9]+$'
The pyproject.toml
file looks correct but Poetry isn't happy with the dot it seems?
Hi,
After upgrading pip
to 9.0.2 version on MacOS 10.11.6 using Python 3.6.4 installed via pyenv
poetry
stops work with,
$ poetry --version
Traceback (most recent call last):
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/bin/poetry", line 7, in <module>
from poetry import console
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/__init__.py", line 1, in <module>
from poetry.console import Application
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/console/__init__.py", line 1, in <module>
from .application import Application
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/console/application.py", line 8, in <module>
from poetry.poetry import Poetry
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/poetry.py", line 13, in <module>
from .repositories.pypi_repository import PyPiRepository
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/poetry/repositories/pypi_repository.py", line 2, in <module>
from pip.req import InstallRequirement
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/pip/__init__.py", line 45, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/pip/download.py", line 40, in <module>
from pip._vendor import requests, six
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/pip/_vendor/requests/__init__.py", line 98, in <module>
from . import packages
File "/Users/playpauseandstop/.pyenv/versions/3.6.4/lib/python3.6/site-packages/pip/_vendor/requests/packages.py", line 12, in <module>
sys.modules['pip._vendor.requests.packages.' + mod] = sys.modules["pip._vendor." + mod]
KeyError: 'pip._vendor.urllib3.contrib'
In same time, pip seems to work as usual, it installed packages and able to execute common commands (freeze
, list
, etc),
$ pip freeze | grep poetry
poetry==0.6.1
$ pip list -lo
Package Version Latest Type
---------------------- ------- ------ -----
decorator 4.1.2 4.2.1 wheel
http-prompt 0.10.2 0.11.2 wheel
MacFSEvents 0.7 0.8.1 sdist
pexpect 4.3.1 4.4.0 wheel
pipenv 9.0.1 11.8.0 sdist
pipenv-to-requirements 0.1.9 0.3.1 wheel
python-dateutil 2.6.1 2.7.0 wheel
virtualenv-clone 0.2.6 0.3.0 wheel
Related issues: pypa/pip#5079 + pypa/pip#5081
Using a new Poetry project, running poetry add --optional pendulum
is installing Pendulum as a dependency but the optional setting is being left out of the pyproject.toml
.
$ poetry add --optional pendulum -v
Using virtualenv: C:\Users\mitch\.virtualenvs\example-env
Using version ^1.4 for pendulum
Updating dependencies
Resolving dependencies..
Package operations: 5 installs, 0 updates, 0 removals
Writing lock file
- Installing six (1.11.0)
- Installing python-dateutil (2.7.0)
- Installing tzlocal (1.5.1)
- Installing pytzdata (2018.3)
- Installing pendulum (1.4.4)
The pyproject.toml
afterwards:
[tool.poetry]
name = "example"
version = "0.1.0"
authors = [ "My Name <[email protected]>",]
description = "Example package"
[tool.poetry.dependencies]
python = "^2.7"
pendulum = "^1.4"
[tool.poetry.dev-dependencies]
Hi,
Something nice in npm or pipenv is the management of isolation. For now, poetry
is global by default (not event scoped to user installation) unless a virtualenv is already created and activated.
Do you have some plan on managing isolation with poetry ?
Regards,
Étienne
They are all written on the same line. I believe this is simply due there being no fp.write('\n')
inside the inner for loop in _write_entry_points
.
I have a project that depends on boto3, but for some reason botocore isn't being installed. I checked the boto3 wheel and I see that it has a botocore dependency listed in METADATA, and pip also fetches botocore when installing into a virtualenv, so I think this might be a poetry bug.
{}radix@pop-os:~$ poetry new testboto3
Created package testboto3 in testboto3
{}radix@pop-os:~$ cd testboto3/
{}radix@pop-os:~/testboto3$ cat pyproject.toml
[tool.poetry]
name = "testboto3"
version = "0.1.0"
description = ""
authors = ["Your Name <[email protected]>"]
[tool.poetry.dependencies]
python = "*"
boto3 = "^1.7.0"
[tool.poetry.dev-dependencies]
pytest = "^3.5"
{}radix@pop-os:~/testboto3$ poetry install
Creating virtualenv testboto3-py3.6 in /home/radix/.cache/pypoetry/virtualenvs
Updating dependencies
Resolving dependencies...
Package operations: 7 installs, 0 updates, 0 removals
Writing lock file
- Installing attrs (17.4.0)
- Installing more-itertools (4.1.0)
- Installing pluggy (0.6.0)
- Installing py (1.5.3)
- Installing six (1.11.0)
- Installing boto3 (1.7.0)
- Installing pytest (3.5.0)
{}radix@pop-os:~/testboto3$ poetry run python
Python 3.6.3 (default, Oct 3 2017, 21:45:48)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/radix/.cache/pypoetry/virtualenvs/testboto3-py3.6/lib/python3.6/site-packages/boto3/__init__.py", line 16, in <module>
from boto3.session import Session
File "/home/radix/.cache/pypoetry/virtualenvs/testboto3-py3.6/lib/python3.6/site-packages/boto3/session.py", line 17, in <module>
import botocore.session
ModuleNotFoundError: No module named 'botocore'
Poetry 0.7.0
sys.version_info(major=3, minor=6, micro=3, releaselevel='final', serial=0)
Bash executed:
poetry add ipython
Error message:
[ValueError]
Could not parse version constraint: >=18.5decorator
add [-D|--dev] [--optional] [--dry-run] [--] <name> (<name>)...
The setup.py
contents include
install_requires = [
'setuptools>=18.5',
'jedi>=0.10',
'decorator',
'pickleshare',
'simplegeneric>0.8',
'traitlets>=4.2',
'prompt_toolkit>=1.0.15,<2.0.0',
'pygments',
'backcall',
]
So it would seem that install requires is being parsed incorrectly, or something!
Hope this helps
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.