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
6c2dda23
Unverified
Commit
6c2dda23
authored
Apr 05, 2018
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve dependency resolution time by using cache control
parent
c8858956
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
2 deletions
+24
-2
CHANGELOG.md
+7
-0
poetry/repositories/pypi_repository.py
+10
-2
pyproject.toml
+7
-0
No files found.
CHANGELOG.md
View file @
6c2dda23
# Change Log
## [Unreleased]
### Changes
-
Improved dependency resolution time by using cache control.
## [0.7.1] - 2018-04-05
### Fixed
...
...
poetry/repositories/pypi_repository.py
View file @
6c2dda23
...
...
@@ -2,8 +2,10 @@ from pathlib import Path
from
typing
import
List
from
typing
import
Union
from
cachecontrol
import
CacheControl
from
cachecontrol.caches.file_cache
import
FileCache
from
cachy
import
CacheManager
from
requests
import
get
from
requests
import
session
from
poetry.locations
import
CACHE_DIR
from
poetry.packages
import
dependency_from_pep_508
...
...
@@ -21,6 +23,7 @@ class PyPiRepository(Repository):
def
__init__
(
self
,
url
=
'https://pypi.org/'
,
disable_cache
=
False
):
self
.
_url
=
url
self
.
_disable_cache
=
disable_cache
release_cache_dir
=
Path
(
CACHE_DIR
)
/
'cache'
/
'repositories'
/
'pypi'
self
.
_cache
=
CacheManager
({
'default'
:
'releases'
,
...
...
@@ -35,6 +38,11 @@ class PyPiRepository(Repository):
}
}
})
self
.
_session
=
CacheControl
(
session
(),
cache
=
FileCache
(
str
(
release_cache_dir
/
'_packages'
))
)
super
()
.
__init__
()
...
...
@@ -203,7 +211,7 @@ class PyPiRepository(Repository):
return
data
def
_get
(
self
,
endpoint
:
str
)
->
Union
[
dict
,
None
]:
json_response
=
get
(
self
.
_url
+
endpoint
)
json_response
=
self
.
_session
.
get
(
self
.
_url
+
endpoint
)
if
json_response
.
status_code
==
404
:
return
None
...
...
pyproject.toml
View file @
6c2dda23
...
...
@@ -32,6 +32,7 @@ requests-toolbelt = "^0.8.0"
jsonschema
=
"^2.6"
pyrsistent
=
"^0.14.2"
pyparsing
=
"^2.2"
cachecontrol
=
{
version
=
"^0.12.4"
,
extras
=
["filecache"]
}
# zipfile36 is needed for Python 3.4 and 3.5
zipfile36
=
{
version
=
"^0.1"
,
python
=
">=3.4 <3.6"
}
...
...
@@ -39,6 +40,12 @@ zipfile36 = { version = "^0.1", python = ">=3.4 <3.6" }
# The typing module is not in the stdlib in Python 3.4
typing
=
{
version
=
"^3.6"
,
python
=
"~3.4"
}
# cachecontrol dependencies are badly set
# and do not appear in PyPI JSON API
# So we set them here
msgpack-python
=
"^0.5"
lockfile
=
"^0.12"
[tool.poetry.dev-dependencies]
pytest
=
"^3.4"
pytest-cov
=
"^2.5"
...
...
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