Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
f32cf660
Unverified
Commit
f32cf660
authored
Mar 30, 2018
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve CLI reactivity by deferring imports
parent
af3b46d7
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
49 additions
and
49 deletions
+49
-49
CHANGELOG.md
+1
-0
poetry/__init__.py
+1
-7
poetry/console/__init__.py
+4
-0
poetry/console/application.py
+6
-3
poetry/console/commands/add.py
+5
-4
poetry/console/commands/build.py
+2
-2
poetry/console/commands/check.py
+0
-2
poetry/console/commands/command.py
+1
-3
poetry/console/commands/config.py
+2
-2
poetry/console/commands/debug/resolve.py
+5
-5
poetry/console/commands/install.py
+2
-2
poetry/console/commands/lock.py
+2
-2
poetry/console/commands/publish.py
+2
-2
poetry/console/commands/remove.py
+2
-2
poetry/console/commands/show.py
+4
-3
poetry/console/commands/update.py
+2
-2
poetry/console/commands/venv_command.py
+2
-2
poetry/masonry/builders/complete.py
+2
-2
tests/masonry/builders/test_complete.py
+1
-1
tests/masonry/builders/test_sdist.py
+1
-1
tests/masonry/builders/test_wheel.py
+1
-1
tests/test_poetry.py
+1
-1
No files found.
CHANGELOG.md
View file @
f32cf660
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
-
Improved dependency resolution to avoid unnecessary operations.
-
Improved dependency resolution to avoid unnecessary operations.
-
Improved dependency resolution speed.
-
Improved dependency resolution speed.
-
Improved CLI reactivity by deferring imports.
### Fixed
### Fixed
...
...
poetry/__init__.py
View file @
f32cf660
from
poetry.console
import
Application
from
.__version__
import
__version__
from
.poetry
import
Poetry
__version__
=
Poetry
.
VERSION
console
=
Application
()
poetry/console/__init__.py
View file @
f32cf660
from
.application
import
Application
from
.application
import
Application
def
main
():
Application
()
.
run
()
poetry/console/application.py
View file @
f32cf660
...
@@ -4,8 +4,9 @@ from cleo import Application as BaseApplication
...
@@ -4,8 +4,9 @@ from cleo import Application as BaseApplication
from
cleo.inputs
import
ArgvInput
from
cleo.inputs
import
ArgvInput
from
cleo.outputs
import
ConsoleOutput
from
cleo.outputs
import
ConsoleOutput
from
poetry
import
__version__
from
poetry.io.raw_argv_input
import
RawArgvInput
from
poetry.io.raw_argv_input
import
RawArgvInput
from
poetry.poetry
import
Poetry
from
.commands
import
AboutCommand
from
.commands
import
AboutCommand
from
.commands
import
AddCommand
from
.commands
import
AddCommand
...
@@ -28,13 +29,15 @@ from .commands.debug import DebugResolveCommand
...
@@ -28,13 +29,15 @@ from .commands.debug import DebugResolveCommand
class
Application
(
BaseApplication
):
class
Application
(
BaseApplication
):
def
__init__
(
self
):
def
__init__
(
self
):
super
()
.
__init__
(
'Poetry'
,
Poetry
.
VERSION
)
super
()
.
__init__
(
'Poetry'
,
__version__
)
self
.
_poetry
=
None
self
.
_poetry
=
None
self
.
_skip_io_configuration
=
False
self
.
_skip_io_configuration
=
False
@property
@property
def
poetry
(
self
)
->
Poetry
:
def
poetry
(
self
):
from
poetry.poetry
import
Poetry
if
self
.
_poetry
is
not
None
:
if
self
.
_poetry
is
not
None
:
return
self
.
_poetry
return
self
.
_poetry
...
...
poetry/console/commands/add.py
View file @
f32cf660
...
@@ -3,10 +3,6 @@ import re
...
@@ -3,10 +3,6 @@ import re
from
typing
import
List
from
typing
import
List
from
typing
import
Tuple
from
typing
import
Tuple
from
poetry.installation
import
Installer
from
poetry.semver.version_parser
import
VersionParser
from
poetry.version.version_selector
import
VersionSelector
from
.venv_command
import
VenvCommand
from
.venv_command
import
VenvCommand
...
@@ -28,6 +24,9 @@ If you do not specify a version constraint, poetry will choose a suitable one ba
...
@@ -28,6 +24,9 @@ If you do not specify a version constraint, poetry will choose a suitable one ba
"""
"""
def
handle
(
self
):
def
handle
(
self
):
from
poetry.installation
import
Installer
from
poetry.semver.version_parser
import
VersionParser
packages
=
self
.
argument
(
'name'
)
packages
=
self
.
argument
(
'name'
)
is_dev
=
self
.
option
(
'dev'
)
is_dev
=
self
.
option
(
'dev'
)
...
@@ -142,6 +141,8 @@ If you do not specify a version constraint, poetry will choose a suitable one ba
...
@@ -142,6 +141,8 @@ If you do not specify a version constraint, poetry will choose a suitable one ba
name
,
name
,
required_version
=
None
required_version
=
None
)
->
Tuple
[
str
,
str
]:
)
->
Tuple
[
str
,
str
]:
from
poetry.version.version_selector
import
VersionSelector
selector
=
VersionSelector
(
self
.
poetry
.
pool
)
selector
=
VersionSelector
(
self
.
poetry
.
pool
)
package
=
selector
.
find_best_candidate
(
name
,
required_version
)
package
=
selector
.
find_best_candidate
(
name
,
required_version
)
...
...
poetry/console/commands/build.py
View file @
f32cf660
from
.venv_command
import
VenvCommand
from
.venv_command
import
VenvCommand
from
poetry.masonry
import
Builder
class
BuildCommand
(
VenvCommand
):
class
BuildCommand
(
VenvCommand
):
"""
"""
...
@@ -12,6 +10,8 @@ class BuildCommand(VenvCommand):
...
@@ -12,6 +10,8 @@ class BuildCommand(VenvCommand):
"""
"""
def
handle
(
self
):
def
handle
(
self
):
from
poetry.masonry
import
Builder
fmt
=
'all'
fmt
=
'all'
if
self
.
option
(
'format'
):
if
self
.
option
(
'format'
):
fmt
=
self
.
option
(
'format'
)
fmt
=
self
.
option
(
'format'
)
...
...
poetry/console/commands/check.py
View file @
f32cf660
import
jsonschema
from
.command
import
Command
from
.command
import
Command
...
...
poetry/console/commands/command.py
View file @
f32cf660
from
cleo
import
Command
as
BaseCommand
from
cleo
import
Command
as
BaseCommand
from
poetry.poetry
import
Poetry
from
..styles.poetry
import
PoetryStyle
from
..styles.poetry
import
PoetryStyle
class
Command
(
BaseCommand
):
class
Command
(
BaseCommand
):
@property
@property
def
poetry
(
self
)
->
Poetry
:
def
poetry
(
self
):
return
self
.
get_application
()
.
poetry
return
self
.
get_application
()
.
poetry
def
reset_poetry
(
self
)
->
None
:
def
reset_poetry
(
self
)
->
None
:
...
...
poetry/console/commands/config.py
View file @
f32cf660
import
json
import
json
import
re
import
re
from
poetry.config
import
Config
from
.command
import
Command
from
.command
import
Command
...
@@ -38,6 +36,8 @@ To remove a repository (repo is a short alias for repositories):
...
@@ -38,6 +36,8 @@ To remove a repository (repo is a short alias for repositories):
"""
"""
def
__init__
(
self
):
def
__init__
(
self
):
from
poetry.config
import
Config
super
()
.
__init__
()
super
()
.
__init__
()
self
.
_config
=
Config
.
create
(
'config.toml'
)
self
.
_config
=
Config
.
create
(
'config.toml'
)
...
...
poetry/console/commands/debug/resolve.py
View file @
f32cf660
...
@@ -2,11 +2,6 @@ import re
...
@@ -2,11 +2,6 @@ import re
from
typing
import
List
from
typing
import
List
from
poetry.packages
import
Dependency
from
poetry.puzzle
import
Solver
from
poetry.repositories.repository
import
Repository
from
poetry.semver.version_parser
import
VersionParser
from
..command
import
Command
from
..command
import
Command
...
@@ -19,6 +14,11 @@ class DebugResolveCommand(Command):
...
@@ -19,6 +14,11 @@ class DebugResolveCommand(Command):
"""
"""
def
handle
(
self
):
def
handle
(
self
):
from
poetry.packages
import
Dependency
from
poetry.puzzle
import
Solver
from
poetry.repositories.repository
import
Repository
from
poetry.semver.version_parser
import
VersionParser
packages
=
self
.
argument
(
'package'
)
packages
=
self
.
argument
(
'package'
)
if
not
packages
:
if
not
packages
:
...
...
poetry/console/commands/install.py
View file @
f32cf660
from
poetry.installation
import
Installer
from
.venv_command
import
VenvCommand
from
.venv_command
import
VenvCommand
...
@@ -24,6 +22,8 @@ exist it will look for <comment>pyproject.toml</> and do the same.
...
@@ -24,6 +22,8 @@ exist it will look for <comment>pyproject.toml</> and do the same.
"""
"""
def
handle
(
self
):
def
handle
(
self
):
from
poetry.installation
import
Installer
installer
=
Installer
(
installer
=
Installer
(
self
.
output
,
self
.
output
,
self
.
venv
,
self
.
venv
,
...
...
poetry/console/commands/lock.py
View file @
f32cf660
from
poetry.installation
import
Installer
from
.venv_command
import
VenvCommand
from
.venv_command
import
VenvCommand
...
@@ -17,6 +15,8 @@ the current directory, processes it, and locks the depdencies in the <comment>py
...
@@ -17,6 +15,8 @@ the current directory, processes it, and locks the depdencies in the <comment>py
"""
"""
def
handle
(
self
):
def
handle
(
self
):
from
poetry.installation
import
Installer
installer
=
Installer
(
installer
=
Installer
(
self
.
output
,
self
.
output
,
self
.
venv
,
self
.
venv
,
...
...
poetry/console/commands/publish.py
View file @
f32cf660
from
poetry.masonry.publishing.publisher
import
Publisher
from
.command
import
Command
from
.command
import
Command
...
@@ -22,6 +20,8 @@ the config command.
...
@@ -22,6 +20,8 @@ the config command.
"""
"""
def
handle
(
self
):
def
handle
(
self
):
from
poetry.masonry.publishing.publisher
import
Publisher
# Building package first, unless told otherwise
# Building package first, unless told otherwise
if
not
self
.
option
(
'no-build'
):
if
not
self
.
option
(
'no-build'
):
self
.
call
(
'build'
)
self
.
call
(
'build'
)
...
...
poetry/console/commands/remove.py
View file @
f32cf660
from
poetry.installation
import
Installer
from
.venv_command
import
VenvCommand
from
.venv_command
import
VenvCommand
...
@@ -20,6 +18,8 @@ list of installed packages
...
@@ -20,6 +18,8 @@ list of installed packages
<info>poetry remove</info>"""
<info>poetry remove</info>"""
def
handle
(
self
):
def
handle
(
self
):
from
poetry.installation
import
Installer
packages
=
self
.
argument
(
'packages'
)
packages
=
self
.
argument
(
'packages'
)
is_dev
=
self
.
option
(
'dev'
)
is_dev
=
self
.
option
(
'dev'
)
...
...
poetry/console/commands/show.py
View file @
f32cf660
from
poetry.semver
import
statisfies
from
poetry.version.version_selector
import
VersionSelector
from
.venv_command
import
VenvCommand
from
.venv_command
import
VenvCommand
...
@@ -241,6 +238,8 @@ lists all packages available."""
...
@@ -241,6 +238,8 @@ lists all packages available."""
self
.
set_style
(
color
,
color
)
self
.
set_style
(
color
,
color
)
def
find_latest_package
(
self
,
package
):
def
find_latest_package
(
self
,
package
):
from
poetry.version.version_selector
import
VersionSelector
# find the latest version allowed in this pool
# find the latest version allowed in this pool
if
package
.
source_type
==
'git'
:
if
package
.
source_type
==
'git'
:
return
return
...
@@ -253,6 +252,8 @@ lists all packages available."""
...
@@ -253,6 +252,8 @@ lists all packages available."""
)
)
def
get_update_status
(
self
,
latest
,
package
):
def
get_update_status
(
self
,
latest
,
package
):
from
poetry.semver
import
statisfies
if
latest
.
full_pretty_version
==
package
.
full_pretty_version
:
if
latest
.
full_pretty_version
==
package
.
full_pretty_version
:
return
'up-to-date'
return
'up-to-date'
...
...
poetry/console/commands/update.py
View file @
f32cf660
from
poetry.installation
import
Installer
from
.venv_command
import
VenvCommand
from
.venv_command
import
VenvCommand
...
@@ -15,6 +13,8 @@ class UpdateCommand(VenvCommand):
...
@@ -15,6 +13,8 @@ class UpdateCommand(VenvCommand):
"""
"""
def
handle
(
self
):
def
handle
(
self
):
from
poetry.installation
import
Installer
packages
=
self
.
argument
(
'packages'
)
packages
=
self
.
argument
(
'packages'
)
installer
=
Installer
(
installer
=
Installer
(
...
...
poetry/console/commands/venv_command.py
View file @
f32cf660
from
poetry.utils.venv
import
Venv
from
.command
import
Command
from
.command
import
Command
...
@@ -11,6 +9,8 @@ class VenvCommand(Command):
...
@@ -11,6 +9,8 @@ class VenvCommand(Command):
super
()
.
__init__
(
name
)
super
()
.
__init__
(
name
)
def
initialize
(
self
,
i
,
o
):
def
initialize
(
self
,
i
,
o
):
from
poetry.utils.venv
import
Venv
super
()
.
initialize
(
i
,
o
)
super
()
.
initialize
(
i
,
o
)
self
.
_venv
=
Venv
.
create
(
o
,
self
.
poetry
.
package
.
name
)
self
.
_venv
=
Venv
.
create
(
o
,
self
.
poetry
.
package
.
name
)
...
...
poetry/masonry/builders/complete.py
View file @
f32cf660
import
os
import
os
import
tarfile
import
tarfile
import
poetry
import
poetry
.poetry
from
contextlib
import
contextmanager
from
contextlib
import
contextmanager
from
tempfile
import
TemporaryDirectory
from
tempfile
import
TemporaryDirectory
...
@@ -26,7 +26,7 @@ class CompleteBuilder(Builder):
...
@@ -26,7 +26,7 @@ class CompleteBuilder(Builder):
dist_dir
=
self
.
_path
/
'dist'
dist_dir
=
self
.
_path
/
'dist'
with
self
.
unpacked_tarball
(
sdist_file
)
as
tmpdir
:
with
self
.
unpacked_tarball
(
sdist_file
)
as
tmpdir
:
wheel_info
=
WheelBuilder
.
make_in
(
wheel_info
=
WheelBuilder
.
make_in
(
poetry
.
Poetry
.
create
(
tmpdir
),
self
.
_venv
,
self
.
_io
,
dist_dir
,
poetry
.
poetry
.
Poetry
.
create
(
tmpdir
),
self
.
_venv
,
self
.
_io
,
dist_dir
,
original
=
self
.
_poetry
original
=
self
.
_poetry
)
)
...
...
tests/masonry/builders/test_complete.py
View file @
f32cf660
...
@@ -7,9 +7,9 @@ import zipfile
...
@@ -7,9 +7,9 @@ import zipfile
from
pathlib
import
Path
from
pathlib
import
Path
from
poetry
import
__version__
from
poetry
import
__version__
from
poetry
import
Poetry
from
poetry.io
import
NullIO
from
poetry.io
import
NullIO
from
poetry.masonry.builders
import
CompleteBuilder
from
poetry.masonry.builders
import
CompleteBuilder
from
poetry.poetry
import
Poetry
from
poetry.utils.venv
import
NullVenv
from
poetry.utils.venv
import
NullVenv
fixtures_dir
=
Path
(
__file__
)
.
parent
/
'fixtures'
fixtures_dir
=
Path
(
__file__
)
.
parent
/
'fixtures'
...
...
tests/masonry/builders/test_sdist.py
View file @
f32cf660
...
@@ -5,10 +5,10 @@ import tarfile
...
@@ -5,10 +5,10 @@ import tarfile
from
pathlib
import
Path
from
pathlib
import
Path
from
poetry
import
Poetry
from
poetry.io
import
NullIO
from
poetry.io
import
NullIO
from
poetry.masonry.builders.sdist
import
SdistBuilder
from
poetry.masonry.builders.sdist
import
SdistBuilder
from
poetry.packages
import
Package
from
poetry.packages
import
Package
from
poetry.poetry
import
Poetry
from
poetry.utils.venv
import
NullVenv
from
poetry.utils.venv
import
NullVenv
from
tests.helpers
import
get_dependency
from
tests.helpers
import
get_dependency
...
...
tests/masonry/builders/test_wheel.py
View file @
f32cf660
...
@@ -3,9 +3,9 @@ import shutil
...
@@ -3,9 +3,9 @@ import shutil
from
pathlib
import
Path
from
pathlib
import
Path
from
poetry
import
Poetry
from
poetry.io
import
NullIO
from
poetry.io
import
NullIO
from
poetry.masonry.builders
import
WheelBuilder
from
poetry.masonry.builders
import
WheelBuilder
from
poetry.poetry
import
Poetry
from
poetry.utils.venv
import
NullVenv
from
poetry.utils.venv
import
NullVenv
...
...
tests/test_poetry.py
View file @
f32cf660
...
@@ -2,7 +2,7 @@ import toml
...
@@ -2,7 +2,7 @@ import toml
from
pathlib
import
Path
from
pathlib
import
Path
from
poetry
import
Poetry
from
poetry
.poetry
import
Poetry
fixtures_dir
=
Path
(
__file__
)
.
parent
/
'fixtures'
fixtures_dir
=
Path
(
__file__
)
.
parent
/
'fixtures'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment