Skip to content

Commit

Permalink
Rename repodata -> lockfile (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanking13 authored Feb 20, 2025
1 parent a764b1e commit 9f63157
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
8 changes: 4 additions & 4 deletions micropip/_compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
compatibility_layer = CompatibilityNotInPyodide


REPODATA_INFO = compatibility_layer.repodata_info
LOCKFILE_INFO = compatibility_layer.lockfile_info

REPODATA_PACKAGES = compatibility_layer.repodata_packages
LOCKFILE_PACKAGES = compatibility_layer.lockfile_packages

fetch_bytes = compatibility_layer.fetch_bytes

Expand All @@ -38,8 +38,8 @@


__all__ = [
"REPODATA_INFO",
"REPODATA_PACKAGES",
"LOCKFILE_INFO",
"LOCKFILE_PACKAGES",
"fetch_bytes",
"fetch_string_and_headers",
"loadedPackages",
Expand Down
8 changes: 4 additions & 4 deletions micropip/_compat/_compat_in_pyodide.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
loadDynlibsFromPackage,
)

REPODATA_PACKAGES = pyodide_js._api.repodata_packages.to_py()
REPODATA_INFO = pyodide_js._api.repodata_info.to_py()
LOCKFILE_PACKAGES = pyodide_js._api.lockfile_packages.to_py()
LOCKFILE_INFO = pyodide_js._api.lockfile_info.to_py()
except ImportError:
if IN_BROWSER:
raise
Expand Down Expand Up @@ -72,6 +72,6 @@ async def fetch_string_and_headers(

to_js = to_js

repodata_info = REPODATA_INFO
lockfile_info = LOCKFILE_INFO

repodata_packages = REPODATA_PACKAGES
lockfile_packages = LOCKFILE_PACKAGES
4 changes: 2 additions & 2 deletions micropip/_compat/_compat_not_in_pyodide.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ def to_js(
) -> Any:
return obj

repodata_info = {}
lockfile_info = {}

repodata_packages = {}
lockfile_packages = {}
4 changes: 2 additions & 2 deletions micropip/_compat/compatibility_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class loadedPackages(ABC):
def to_py():
pass

repodata_info: dict[str, str]
lockfile_info: dict[str, str]

repodata_packages: dict[str, dict[str, Any]]
lockfile_packages: dict[str, dict[str, Any]]

@staticmethod
@abstractmethod
Expand Down
4 changes: 2 additions & 2 deletions micropip/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pathlib import Path
from sysconfig import get_config_var, get_platform

from ._compat import REPODATA_PACKAGES
from ._compat import LOCKFILE_PACKAGES
from ._vendored.packaging.src.packaging.requirements import (
InvalidRequirement,
Requirement,
Expand Down Expand Up @@ -222,7 +222,7 @@ def fix_package_dependencies(
List of extras for this package.
"""
if package_name in REPODATA_PACKAGES:
if package_name in LOCKFILE_PACKAGES:
# don't check things that are in original repository
return

Expand Down
8 changes: 4 additions & 4 deletions micropip/package_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ async def install(
# Install built-in packages
if pyodide_packages:
# Note: branch never happens in out-of-browser testing because in
# that case REPODATA_PACKAGES is empty.
# that case LOCKFILE_PACKAGES is empty.
await asyncio.ensure_future(
self.compat_layer.loadPackage(
self.compat_layer.to_js(
Expand Down Expand Up @@ -272,8 +272,8 @@ def list_packages(self) -> PackageDict:
if name in packages:
continue

if name in self.compat_layer.repodata_packages:
version = self.compat_layer.repodata_packages[name]["version"]
if name in self.compat_layer.lockfile_packages:
version = self.compat_layer.lockfile_packages[name]["version"]
source_ = "pyodide"
if pkg_source != "default channel":
# Pyodide package loaded from a custom URL
Expand All @@ -298,7 +298,7 @@ def freeze(self) -> str:
``lockFileURL`` of :js:func:`~globalThis.loadPyodide`.
"""
return freeze_lockfile(
self.compat_layer.repodata_packages, self.compat_layer.repodata_info
self.compat_layer.lockfile_packages, self.compat_layer.lockfile_info
)

def add_mock_package(
Expand Down
6 changes: 3 additions & 3 deletions micropip/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from urllib.parse import urlparse

from . import package_index
from ._compat import REPODATA_PACKAGES
from ._compat import LOCKFILE_PACKAGES
from ._utils import (
best_compatible_tag_index,
check_compatible,
Expand Down Expand Up @@ -207,9 +207,9 @@ async def _add_requirement_from_pyodide_lock(self, req: Requirement) -> bool:
Find requirement from pyodide-lock.json. If the requirement is found,
add it to the package list and return True. Otherwise, return False.
"""
locked_package = REPODATA_PACKAGES.get(req.name)
locked_package = LOCKFILE_PACKAGES.get(req.name)
if locked_package and req.specifier.contains(
REPODATA_PACKAGES[req.name]["version"], prereleases=True
LOCKFILE_PACKAGES[req.name]["version"], prereleases=True
):
version = locked_package["version"]
self.pyodide_packages.append(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,11 @@ async def test_load_binary_wheel1(
@pytest.mark.skip_refcount_check
@run_in_pyodide(packages=["micropip"])
async def test_load_binary_wheel2(selenium_standalone_micropip):
from pyodide_js._api import repodata_packages
from pyodide_js._api import lockfile_packages

import micropip

await micropip.install(repodata_packages.regex.file_name)
await micropip.install(lockfile_packages.regex.file_name)
import regex # noqa: F401


Expand Down

0 comments on commit 9f63157

Please sign in to comment.