Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into pyodidegh-175-const…
Browse files Browse the repository at this point in the history
…raints-wheels-first
  • Loading branch information
bollwyvl committed Jan 30, 2025
2 parents 92baa16 + 27791c1 commit d45f62d
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 14 deletions.
13 changes: 8 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ concurrency:
group: main-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
FORCE_COLOR: 3

jobs:
test:
runs-on: ${{ matrix.os }}
Expand All @@ -19,12 +22,12 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
pyodide-version: ["0.27.0a2"]
pyodide-version: ["0.27.2"]
test-config: [
# FIXME: recent version of chrome gets timeout
{runner: selenium, runtime: chrome, runtime-version: "125" },
{runner: selenium, runtime: node, runtime-version: "22" },
]
# FIXME: recent version of chrome gets timeout
{ runner: selenium, runtime: chrome, runtime-version: "125" },
{ runner: selenium, runtime: node, runtime-version: "22" },
]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
default_language_version:
python: "3.12"

exclude: (^micropip/externals|^tests/vendored|^tests/test_data)
exclude: (^micropip/_vendored|^tests/vendored|^tests/test_data)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v5.0.0"
Expand Down
File renamed without changes.
Empty file removed micropip/externals/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion micropip/package_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

from ._compat import HttpStatusError, fetch_string_and_headers
from ._utils import is_package_compatible, parse_version
from ._vendored.mousebender.simple import from_project_details_html
from ._vendored.packaging.src.packaging.utils import InvalidWheelFilename
from ._vendored.packaging.src.packaging.version import InvalidVersion, Version
from .externals.mousebender.simple import from_project_details_html
from .types import DistributionMetadata
from .wheelinfo import WheelInfo

Expand Down
11 changes: 9 additions & 2 deletions micropip/wheelinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,15 @@ def from_url(cls, url: str) -> "WheelInfo":
See https://www.python.org/dev/peps/pep-0427/#file-name-convention
"""
parsed_url = urlparse(url)
if parsed_url.scheme == "":
url = "file:///" + url
if not parsed_url.scheme:
parsed_url = ParseResult(
scheme="file",
netloc=parsed_url.netloc,
path=parsed_url.path,
params=parsed_url.params,
query=parsed_url.query,
fragment=parsed_url.fragment,
)
file_name = Path(parsed_url.path).name
name, version, build, tags = parse_wheel_filename(file_name)
return WheelInfo(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ build-backend = "setuptools.build_meta"
write_to = "micropip/_version.py"

[tool.ruff]
exclude = ["micropip/externals"]
exclude = ["micropip/_vendored/"]
line-length = 120
lint.select = [
"B", # bugbear
Expand Down
6 changes: 4 additions & 2 deletions tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ async def myfunc():

fetch_response_mock.string.side_effect = myfunc

@patch("micropip._compat_in_pyodide.pyfetch", return_value=fetch_response_mock)
@patch(
"micropip._compat._compat_in_pyodide.pyfetch", return_value=fetch_response_mock
)
async def call_micropip_install(pyfetch_mock):
try:
await micropip.install("pyodide-micropip-test", credentials="include")
Expand All @@ -319,7 +321,7 @@ async def test_load_binary_wheel1(

@pytest.mark.skip_refcount_check
@run_in_pyodide(packages=["micropip"])
async def test_load_binary_wheel2(selenium):
async def test_load_binary_wheel2(selenium_standalone_micropip):
from pyodide_js._api import repodata_packages

import micropip
Expand Down
3 changes: 1 addition & 2 deletions tests/test_transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ def test_parse_wheel_url1(protocol, path):
url = protocol + path
wheel = WheelInfo.from_url(url)

check_url = url if protocol else "file:///" + path
assert wheel.name == "snowballstemmer"
assert str(wheel.version) == "2.0.0"
assert wheel.sha256 is None
assert wheel.filename == SNOWBALL_WHEEL
assert wheel.url == check_url
assert wheel.url == url
assert wheel.tags == frozenset(
{Tag("py2", "none", "any"), Tag("py3", "none", "any")}
)
Expand Down

0 comments on commit d45f62d

Please sign in to comment.