Loading CHANGELOG.md +7 −0 Original line number Diff line number Diff line # Change Log ## [Unreleased] ### Changes - Improved dependency resolution time by using cache control. ## [0.7.1] - 2018-04-05 ### Fixed Loading poetry/repositories/pypi_repository.py +10 −2 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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', Loading @@ -36,6 +39,11 @@ class PyPiRepository(Repository): } }) self._session = CacheControl( session(), cache=FileCache(str(release_cache_dir / '_packages')) ) super().__init__() def find_packages(self, Loading Loading @@ -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 Loading pyproject.toml +7 −0 Original line number Diff line number Diff line Loading @@ -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" } Loading @@ -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" Loading Loading
CHANGELOG.md +7 −0 Original line number Diff line number Diff line # Change Log ## [Unreleased] ### Changes - Improved dependency resolution time by using cache control. ## [0.7.1] - 2018-04-05 ### Fixed Loading
poetry/repositories/pypi_repository.py +10 −2 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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', Loading @@ -36,6 +39,11 @@ class PyPiRepository(Repository): } }) self._session = CacheControl( session(), cache=FileCache(str(release_cache_dir / '_packages')) ) super().__init__() def find_packages(self, Loading Loading @@ -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 Loading
pyproject.toml +7 −0 Original line number Diff line number Diff line Loading @@ -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" } Loading @@ -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" Loading