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
5d61ab7c
Unverified
Commit
5d61ab7c
authored
Apr 25, 2018
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Speedup packages retrieval for already seen dependencies
parent
eb394670
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
7 deletions
+50
-7
poetry/puzzle/provider.py
+48
-2
poetry/puzzle/solver.py
+2
-4
poetry/semver/constraints/constraint.py
+0
-1
No files found.
poetry/puzzle/provider.py
View file @
5d61ab7c
...
...
@@ -9,6 +9,7 @@ from typing import List
from
poetry.mixology
import
DependencyGraph
from
poetry.mixology.conflict
import
Conflict
from
poetry.mixology.contracts
import
SpecificationProvider
from
poetry.mixology.contracts
import
UI
from
poetry.packages
import
Dependency
from
poetry.packages
import
FileDependency
...
...
@@ -27,7 +28,7 @@ from poetry.utils.venv import Venv
from
poetry.vcs.git
import
Git
class
Provider
(
SpecificationProvider
):
class
Provider
(
SpecificationProvider
,
UI
):
UNSAFE_PACKAGES
=
{
'setuptools'
,
'distribute'
,
'pip'
}
...
...
@@ -42,6 +43,9 @@ class Provider(SpecificationProvider):
self
.
_python_constraint
=
package
.
python_constraint
self
.
_base_dg
=
DependencyGraph
()
self
.
_search_for
=
{}
self
.
_constraints
=
{}
super
(
Provider
,
self
)
.
__init__
(
debug
=
self
.
_io
.
is_debug
())
@property
def
pool
(
self
):
# type: () -> Pool
...
...
@@ -76,9 +80,22 @@ class Provider(SpecificationProvider):
elif
dependency
.
is_file
():
packages
=
self
.
search_for_file
(
dependency
)
else
:
constraint
=
dependency
.
constraint
# If we have already seen this dependency
# we take the most restrictive constraint
if
dependency
.
name
in
self
.
_constraints
:
current_constraint
=
self
.
_constraints
[
dependency
.
name
]
if
str
(
dependency
.
constraint
)
==
'*'
:
# The new constraint accepts anything
# so we take the previous one
constraint
=
current_constraint
self
.
_constraints
[
dependency
.
name
]
=
constraint
packages
=
self
.
_pool
.
find_packages
(
dependency
.
name
,
dependency
.
constraint
,
constraint
,
extras
=
dependency
.
extras
,
)
...
...
@@ -256,3 +273,32 @@ class Provider(SpecificationProvider):
0
if
d
.
allows_prereleases
()
else
1
,
0
if
d
.
name
in
conflicts
else
1
])
# UI
@property
def
output
(
self
):
return
self
.
_io
def
before_resolution
(
self
):
self
.
_io
.
write
(
'<info>Resolving dependencies</>'
)
if
self
.
is_debugging
():
self
.
_io
.
new_line
()
def
indicate_progress
(
self
):
if
not
self
.
is_debugging
():
self
.
_io
.
write
(
'.'
)
def
after_resolution
(
self
):
self
.
_io
.
new_line
()
def
debug
(
self
,
message
,
depth
):
if
self
.
is_debugging
():
debug_info
=
str
(
message
)
debug_info
=
'
\n
'
.
join
([
'<comment>:{}:</> {}'
.
format
(
str
(
depth
)
.
rjust
(
4
),
s
)
for
s
in
debug_info
.
split
(
'
\n
'
)
])
+
'
\n
'
self
.
output
.
write
(
debug_info
)
poetry/puzzle/solver.py
View file @
5d61ab7c
...
...
@@ -26,10 +26,8 @@ class Solver:
self
.
_io
=
io
def
solve
(
self
,
requested
,
fixed
=
None
):
# type: (...) -> List[Operation]
resolver
=
Resolver
(
Provider
(
self
.
_package
,
self
.
_pool
,
self
.
_io
),
UI
(
self
.
_io
)
)
provider
=
Provider
(
self
.
_package
,
self
.
_pool
,
self
.
_io
)
resolver
=
Resolver
(
provider
,
provider
)
base
=
None
if
fixed
is
not
None
:
...
...
poetry/semver/constraints/constraint.py
View file @
5d61ab7c
...
...
@@ -3,7 +3,6 @@ import operator
from
poetry.version
import
parse
as
parse_version
from
poetry.version
import
version_compare
from
..helpers
import
normalize_version
from
.base_constraint
import
BaseConstraint
...
...
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