Skip to content

Fix pyodide tests#544

Merged
alcarney merged 2 commits into
openlawlibrary:mainfrom
alcarney:fix-pyodide
Jun 4, 2025
Merged

Fix pyodide tests#544
alcarney merged 2 commits into
openlawlibrary:mainfrom
alcarney:fix-pyodide

Conversation

@alcarney

@alcarney alcarney commented Jun 4, 2025

Copy link
Copy Markdown
Collaborator

Description (e.g. "Related to ...", etc.)

This PR should fix the pyodide test suite - as well as bumping the version of pyodide we test to the latest.

The issue came down to dependency resolution... (something that I think has bitten us before?). The version of attrs available by default in pyodide was too old relative to the version of cattrs being selected by micropip.

(cattrs was attempting to import attrs.NothingType which was only introduced in attrs v24.3.0)

I would have assumed that the version bound on attrs supplied by cattrs itself would have been taken into account when installing pygls under pyodide but that does not seem to be the case.

So instead, I have added an explicit dependency on attrs to pygls itself, with a minimum version bound that ensures attrs.NothingType is always available

Code review checklist (for code reviewer to complete)

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Commit messages are meaningful (see this for details)
  • Tests have been included and/or updated, as appropriate
  • Docstrings have been included and/or updated, as appropriate
  • Standalone docs have been updated accordingly

Automated linters

You can run the lints that are run on CI locally with:

poetry install --all-extras --with dev
poetry run poe lint

alcarney added 2 commits June 4, 2025 19:22
This PR should fix the pyodide test suite - as well as bumping the
version of pyodide we test to the latest.

The issue came down to dependency resolution... (something that I
think has bitten us before?). The version of `attrs` available by
default [1] in pyodide was too old relative to the version of `cattrs`
being selected by `micropip`.

(`cattrs` was attempting to import `attrs.NothingType` which was only
introduced in `attrs v24.3.0`)

I would have assumed that the version bound [2] on `attrs` supplied by
`cattrs` itself would have been taken into account when installing
`pygls` under pyodide but that does not seem to be the case.

So instead, I have added an explicit dependency on `attrs` to pygls
itself, with a minimum version bound that ensures `attrs.NothingType`
is always available

[1]: https://github.com/pyodide/pyodide/blob/28fcc1bf138732e62e7bbc926ea70a0f13149f54/packages/attrs/meta.yaml#L3
[2]: python-attrs/cattrs@d987382#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711R43
@alcarney

alcarney commented Jun 4, 2025

Copy link
Copy Markdown
Collaborator Author

Lint failure is just commitlint complaining about some of the urls I included in my commit message

footer's lines must not be longer than 100 characters [footer-max-line-length]

@alcarney alcarney requested a review from tombh June 4, 2025 18:54
@alcarney

alcarney commented Jun 4, 2025

Copy link
Copy Markdown
Collaborator Author

Thanks!

@alcarney alcarney merged commit 4ba2be6 into openlawlibrary:main Jun 4, 2025
17 of 18 checks passed
@alcarney alcarney deleted the fix-pyodide branch June 4, 2025 21:29
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

Successfully merging this pull request may close these issues.

2 participants