Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all transitive dependencies are installed #204

Open
samuelcolvin opened this issue Feb 8, 2025 · 2 comments
Open

Not all transitive dependencies are installed #204

samuelcolvin opened this issue Feb 8, 2025 · 2 comments

Comments

@samuelcolvin
Copy link
Contributor

samuelcolvin commented Feb 8, 2025

micropip doesn't install some required transitive dependencies. (related to #201)

This is my current workaround for adding extra required transitive dependencies, maybe it's helpful in working out what's wrong?

def _add_extra_dependencies(dependencies: list[str]) -> list[str]:
    """Add extra dependencies we know some packages need.

    Workaround for micropip not installing some required transitive dependencies.

    pygments seems to be required to get rich to work properly, ssl is required for FastAPI and HTTPX.
    See also https://github.com/pyodide/micropip/issues/201#issuecomment-2645794486.
    """
    extras = []
    for d in dependencies:
        if d.startswith(('logfire', 'rich')):
            extras.append('pygments')
        elif d.startswith(('fastapi', 'httpx', 'pydantic_ai')):
            extras.append('ssl')

        if d.startswith('pydantic_ai'):
            extras.append('typing_extensions>=4.12')

        if len(extras) == 3:
            break

    return dependencies + extras

See pydantic/pydantic.run#44.

@samuelcolvin samuelcolvin changed the title Not all transitive dependencies in installed Not all transitive dependencies are installed Feb 9, 2025
@ryanking13
Copy link
Member

        if d.startswith(('logfire', 'rich')):
            extras.append('pygments')

Yes, I think we need to add pygments and markdown-it-py to a dependency in rich recipe.

elif d.startswith(('fastapi', 'httpx', 'pydantic_ai')):
    extras.append('ssl')

ssl is a Python stdlib, but it is unvendored (optional) in Pyodide, because it is very big because of the openssl. I think we can add a recipe for those packages and specify ssl as a requirement explicitly.

if d.startswith('pydantic_ai'):
    extras.append('typing_extensions>=4.12')

I think you need to update the typing_extensions version in Pyodide.

@hoodmane
Copy link
Member

But why does httpx need ssl with Pyodide? I'm pretty sure @joemarshall didn't intend it to be required so we should try to fix it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants