Skip to content

Commit

Permalink
Add a PyPy provider.
Browse files Browse the repository at this point in the history
Closes #76
  • Loading branch information
jsirois committed Aug 1, 2024
1 parent bb92f7f commit c6f5db9
Show file tree
Hide file tree
Showing 13 changed files with 527 additions and 157 deletions.
312 changes: 204 additions & 108 deletions lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions nox-support/check-reqs.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
mypy
nox
types-appdirs
types-beautifulsoup4
types-docutils
types-psutil
types-toml
Expand Down
20 changes: 13 additions & 7 deletions nox-support/check-reqs.windows-amd64.lock.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
mypy==1.10.1 \
--hash=sha256:3c4c2992f6ea46ff7fce0072642cfb62af7a2484efe69017ed8b095f7b39ef31 \
--hash=sha256:71d8ac0b906354ebda8ef1673e5fde785936ac1f29ff6987c7483cfbd5a4235a \
--hash=sha256:1f8f492d7db9e3593ef42d4f115f04e556130f2819ad33ab84551403e97dd4c0
mypy==1.11.1 \
--hash=sha256:64f4a90e3ea07f590c5bcf9029035cf0efeae5ba8be511a8caada1a4893f5525 \
--hash=sha256:0624bdb940255d2dd24e829d99a13cfeb72e4e9031f9492148f410ed30bcab54 \
--hash=sha256:f404a0b069709f18bbdb702eb3dcfe51910602995de00bd39cea3050b5772d08
nox==2024.4.15 \
--hash=sha256:6492236efa15a460ecb98e7b67562a28b70da006ab0be164e8821177577c0565 \
--hash=sha256:ecf6700199cdfa9e5ea0a41ff5e6ef4641d09508eda6edb89d9987864115817f
types-appdirs==1.4.3.5 \
--hash=sha256:337c750e423c40911d389359b4edabe5bbc2cdd5cd0bd0518b71d2839646273b \
--hash=sha256:83268da64585361bfa291f8f506a209276212a0497bd37f0512a939b3d69ff14
types-docutils==0.21.0.20240423 \
--hash=sha256:7f6e84ba8fcd2454c5b8bb8d77384d091a901929cc2b31079316e10eb346580a \
--hash=sha256:7716ec6c68b5179b7ba1738cace2f1326e64df9f44b7ab08d9904d32c23fc15f
types-beautifulsoup4==4.12.0.20240511 \
--hash=sha256:7ceda66a93ba28d759d5046d7fec9f4cad2f563a77b3a789efc90bcadafeefd1 \
--hash=sha256:004f6096fdd83b19cdbf6cb10e4eae57b10205eccc365d0a69d77da836012e28
types-docutils==0.21.0.20240724 \
--hash=sha256:bf51c6c488d23c0412f9b3ba10686fb1a6cb0b957ef04b45128d8a55c79ebb00 \
--hash=sha256:29ff7e27660f4fe76ea61d7e54d05ca3ce3b733ca9e8e8721e0fa587dbc10489
types-psutil==6.0.0.20240621 \
--hash=sha256:b02f05d2c4141cd5926d82d8b56e4292a4d8f483d8a3400b73edf153834a3c64 \
--hash=sha256:1be027326c42ff51ebd65255a5146f9dc57e5cf8c4f9519a88b3f3f6a7fcd00e
Expand Down Expand Up @@ -38,6 +41,9 @@ packaging==24.1 \
virtualenv==20.26.3 \
--hash=sha256:8cc4a31139e796e9a7de2cd5cf2489de1217193116a8fd42328f1bd65f434589 \
--hash=sha256:4c43a2a236279d9ea36a0d76f98d84bd6ca94ac4e0f4a3b9d46d05e10fea542a
types-html5lib==1.1.11.20240228 \
--hash=sha256:af5de0125cb0fe5667543b158db83849b22e25c0e36c9149836b095548bf1020 \
--hash=sha256:22736b7299e605ec4ba539d48691e905fd0c61c3ea610acc59922232dc84cede
colorama==0.4.6 \
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 \
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44
Expand Down
42 changes: 21 additions & 21 deletions nox-support/doc-reqs.windows-amd64.lock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ docutils==0.21.2 \
myst-parser==3.0.1 \
--hash=sha256:6457aaa33a5d474aca678b8ead9b3dc298e89c68e67012e73146ea6fd54babf1 \
--hash=sha256:88f0cb406cb363b077d176b51c476f62d60604d68a8dcdf4832e080441301a87
sphinx==7.3.7 \
--hash=sha256:413f75440be4cacf328f580b4274ada4565fb2187d696a84970c23f77b64d8c3 \
--hash=sha256:a4a7db75ed37531c05002d56ed6948d4c42f473a36f46e1382b0bd76ca9627bc
sphinx==7.4.7 \
--hash=sha256:c2419e2135d11f1951cd994d6eb18a1835bd8fdd8429f9ca375dc1f3281bd239 \
--hash=sha256:242f92a7ea7e6c5b406fdc2615413890ba9f699114a9c09192d7dfead2ee9cfe
sphinx-click==6.0.0 \
--hash=sha256:1e0a3c83bcb7c55497751b19d07ebe56b5d7b85eb76dd399cf9061b497adc317 \
--hash=sha256:f5d664321dc0c6622ff019f1e1c84e58ce0cecfddeb510e004cf60c2a3ab465b
Expand Down Expand Up @@ -57,24 +57,24 @@ requests==2.32.3 \
snowballstemmer==2.2.0 \
--hash=sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a \
--hash=sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1
sphinxcontrib-applehelp==1.0.8 \
--hash=sha256:cb61eb0ec1b61f349e5cc36b2028e9e7ca765be05e49641c97241274753067b4 \
--hash=sha256:c40a4f96f3776c4393d933412053962fac2b84f4c99a7982ba42e09576a70619
sphinxcontrib-devhelp==1.0.6 \
--hash=sha256:6485d09629944511c893fa11355bda18b742b83a2b181f9a009f7e500595c90f \
--hash=sha256:9893fd3f90506bc4b97bdb977ceb8fbd823989f4316b28c3841ec128544372d3
sphinxcontrib-htmlhelp==2.0.5 \
--hash=sha256:393f04f112b4d2f53d93448d4bce35842f62b307ccdc549ec1585e950bc35e04 \
--hash=sha256:0dc87637d5de53dd5eec3a6a01753b1ccf99494bd756aafecd74b4fa9e729015
sphinxcontrib-applehelp==2.0.0 \
--hash=sha256:4cd3f0ec4ac5dd9c17ec65e9ab272c9b867ea77425228e68ecf08d6b28ddbdb5 \
--hash=sha256:2f29ef331735ce958efa4734873f084941970894c6090408b079c61b2e1c06d1
sphinxcontrib-devhelp==2.0.0 \
--hash=sha256:aefb8b83854e4b0998877524d1029fd3e6879210422ee3780459e28a1f03a8a2 \
--hash=sha256:411f5d96d445d1d73bb5d52133377b4248ec79db5c793ce7dbe59e074b4dd1ad
sphinxcontrib-htmlhelp==2.1.0 \
--hash=sha256:166759820b47002d22914d64a075ce08f4c46818e17cfc9470a9786b759b19f8 \
--hash=sha256:c9e2916ace8aad64cc13a0d233ee22317f2b9025b9cf3295249fa985cc7082e9
sphinxcontrib-jsmath==1.0.1 \
--hash=sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178 \
--hash=sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8
sphinxcontrib-qthelp==1.0.7 \
--hash=sha256:e2ae3b5c492d58fcbd73281fbd27e34b8393ec34a073c792642cd8e529288182 \
--hash=sha256:053dedc38823a80a7209a80860b16b722e9e0209e32fea98c90e4e6624588ed6
sphinxcontrib-serializinghtml==1.1.10 \
--hash=sha256:326369b8df80a7d2d8d7f99aa5ac577f51ea51556ed974e7716cfd4fca3f6cb7 \
--hash=sha256:93f3f5dc458b91b192fe10c397e324f262cf163d79f3282c158e8436a2c4511f
sphinxcontrib-qthelp==2.0.0 \
--hash=sha256:b18a828cdba941ccd6ee8445dbe72ffa3ef8cbe7505d8cd1fa0d42d3f2d5f3eb \
--hash=sha256:4fe7d0ac8fc171045be623aba3e2a8f613f8682731f9153bb2e40ece16b9bbab
sphinxcontrib-serializinghtml==2.0.0 \
--hash=sha256:6e2cb0eef194e10c27ec0023bfeb25badbbb5868244cf5bc5bdc04e4464bf331 \
--hash=sha256:e9d912827f872c029017a53f0ef2180b327c3f7fd23c87229f7a8e8b70031d4d
click==8.1.7 \
--hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \
--hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de
Expand All @@ -87,9 +87,9 @@ uc-micro-py==1.0.3 \
mdurl==0.1.2 \
--hash=sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8 \
--hash=sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba
certifi==2024.6.2 \
--hash=sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56 \
--hash=sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516
certifi==2024.7.4 \
--hash=sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90 \
--hash=sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b
charset-normalizer==3.3.2 \
--hash=sha256:96b02a3dc4381e5494fad39be677abcb5e6634bf7b4fa83a6dd3112607547001 \
--hash=sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc \
Expand Down
4 changes: 2 additions & 2 deletions nox-support/lock.checksums
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"lock_checksum": "75eade5e4d981033ef344d7f351f830105d0d507277e719048998d59b881d4e1",
"requirements_checksum": "5ee5ab1e27ddf34d1d903f95dcdb9a4577cf73c83cd8bbcd449aaa9ac9d62f53"
"lock_checksum": "6cbbc6f77d7ec60ee96f041d119d7b3e70f254d5a46cddedfe4172a093093382",
"requirements_checksum": "559a46abe99f69bbe869289ed7118f232d62d8e422f18ea84c31a77f424920e0"
}
12 changes: 6 additions & 6 deletions nox-support/package-reqs.windows-amd64.lock.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ shiv==1.0.6 \
click==8.1.7 \
--hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \
--hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de
pip==24.1.1 \
--hash=sha256:efca15145a95e95c00608afeab66311d40bfb73bb2266a855befd705e6bb15a0 \
--hash=sha256:5aa64f65e1952733ee0a9a9b1f52496ebdb3f3077cc46f80a16d983b58d1180a
setuptools==70.2.0 \
--hash=sha256:b8b8060bb426838fbe942479c90296ce976249451118ef566a5a0b7d8b78fb05 \
--hash=sha256:bd63e505105011b25c3c11f753f7e3b8465ea739efddaccef8f0efac2137bac1
pip==24.2 \
--hash=sha256:2cd581cf58ab7fcfca4ce8efa6dcacd0de5bf8d0a3eb9ec927e07405f4d9e2a2 \
--hash=sha256:5b5e490b5e9cb275c879595064adce9ebd31b854e3e803740b72f9ccf34a45b8
setuptools==72.1.0 \
--hash=sha256:5a03e1860cf56bb6ef48ce186b0e557fdba433237481a9a625176c2831be15d1 \
--hash=sha256:8d243eff56d095e5817f796ede6ae32941278f542e0f941867cc05ae52b162ec
colorama==0.4.6 \
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 \
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44
6 changes: 3 additions & 3 deletions nox-support/test-reqs.windows-amd64.lock.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pytest==8.2.2 \
--hash=sha256:c434598117762e2bd304e526244f67bf66bbd7b5d6cf22138be51ff661980343 \
--hash=sha256:de4bb8104e201939ccdc688b27a89a7be2079b22e2bd2b07f806b6ba71117977
pytest==8.3.2 \
--hash=sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5 \
--hash=sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce
pytest-xdist==3.6.1 \
--hash=sha256:9ed4adfb68a016610848639bb7e02c9352d5d9f03d04809919e2dafc3be4cca7 \
--hash=sha256:ead156a4db231eec769737f57668ef58a2084a34b2e55c4a8fa20d861107300d
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
appdirs
beautifulsoup4
click
click-log
click_didyoumean
Expand Down
12 changes: 9 additions & 3 deletions requirements.windows-amd64.lock.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
appdirs==1.4.4 \
--hash=sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128 \
--hash=sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41
beautifulsoup4==4.12.3 \
--hash=sha256:b80878c9f40111313e55da8ba20bdba06d8fa3969fc68304167741bbf9e082ed \
--hash=sha256:74e3d1928edc070d21748185c46e3fb33490f22f52a3addee9aee0f4f7781051
click==8.1.7 \
--hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \
--hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de
Expand All @@ -25,15 +28,18 @@ psutil==6.0.0 \
tqdm==4.66.4 \
--hash=sha256:b75ca56b413b030bc3f00af51fd2c1a1a5eac6a0c1cca83cbb37a5c52abce644 \
--hash=sha256:e4d936c9de8727928f3be6079590e97d9abfe8d39a590be678eb5919ffc186bb
soupsieve==2.5 \
--hash=sha256:eaa337ff55a1579b6549dc679565eac1e3d000563bcb1c8ab0d0fefbc0c2cdc7 \
--hash=sha256:5663d5a7b3bfaeee0bc4372e7fc48f9cff4940b3eec54a6451cc5299f1097690
colorama==0.4.6 \
--hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 \
--hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44
anyio==4.4.0 \
--hash=sha256:c1b2d8f46a8a812513012e1107cb0e68c17159a7a594208005a57dc776e1bdc7 \
--hash=sha256:5aadc6a1bbb7cdb0bede386cac5e2940f5e2ff3aa20277e991cf028e0585ce94
certifi==2024.6.2 \
--hash=sha256:ddc6c8ce995e6987e7faf5e3f1b02b302836a0e5d98ece18392cb1a36c72ad56 \
--hash=sha256:3cd43f1c6fa7dedc5899d69d3ad0398fd018ad1a17fba83ddaf78aa46c747516
certifi==2024.7.4 \
--hash=sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90 \
--hash=sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b
httpcore==1.0.5 \
--hash=sha256:421f18bac248b25d310f3cacd198d55b8e6125c107797b609ff9b7a6ba7991b5 \
--hash=sha256:34a38e2f9291467ee3b44e89dd52615370e152954ba21721378a87b2960f7a61
Expand Down
10 changes: 5 additions & 5 deletions science/fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def require_password(auth_type: str) -> str:
return None


def _configured_client(url: Url, headers: Mapping[str, str] | None = None) -> httpx.Client:
def configured_client(url: Url, headers: Mapping[str, str] | None = None) -> httpx.Client:
headers = dict(headers) if headers else {}
auth = _configure_auth(url) if "Authorization" not in headers else None
return httpx.Client(follow_redirects=True, headers=headers, auth=auth)
Expand All @@ -96,7 +96,7 @@ def _fetch_to_cache(
match cache_result:
case Missing(work=work):
with (
_configured_client(url, headers).stream("GET", url) as response,
configured_client(url, headers).stream("GET", url) as response,
work.open("wb") as cache_fp,
):
for data in response.iter_bytes():
Expand Down Expand Up @@ -128,7 +128,7 @@ def _maybe_expected_digest(
case Fingerprint(_):
return ExpectedDigest(fingerprint=fingerprint, algorithm=algorithm)
case Url(url):
with _configured_client(url, headers) as client:
with configured_client(url, headers) as client:
return ExpectedDigest(
fingerprint=Fingerprint(client.get(url).text.split(" ", 1)[0].strip()),
algorithm=algorithm,
Expand All @@ -147,7 +147,7 @@ def _expected_digest(
if expected_digest:
return expected_digest

with _configured_client(url, headers) as client:
with configured_client(url, headers) as client:
return ExpectedDigest(
fingerprint=Fingerprint(client.get(f"{url}.{algorithm}").text.split(" ", 1)[0].strip()),
algorithm=algorithm,
Expand All @@ -167,7 +167,7 @@ def fetch_and_verify(
match cache_result:
case Missing(work=work):
click.secho(f"Downloading {url} ...", fg="green")
with _configured_client(url, headers) as client:
with configured_client(url, headers) as client:
expected_digest = _expected_digest(
url, headers, fingerprint, algorithm=digest_algorithm
)
Expand Down
4 changes: 2 additions & 2 deletions science/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
from science.dataclass.reflect import FieldInfo, dataclass_info
from science.errors import InputError
from science.model import Provider
from science.providers.pypy import PyPy
from science.providers.python_build_standalone import PythonBuildStandalone

_BUILTIN_PROVIDER_TYPES = (PythonBuildStandalone,)

_BUILTIN_PROVIDER_TYPES: tuple[type[Provider], ...] = (PythonBuildStandalone, PyPy)

ConfigDataclass = TypeVar("ConfigDataclass", bound=Dataclass)

Expand Down
Loading

0 comments on commit c6f5db9

Please sign in to comment.