microsoft / playwright-python

Python version of the Playwright testing and automation library.
https://playwright.dev/python/
Apache License 2.0
11.92k stars 916 forks source link

[Feature]: relax greenlet dependency version requirements in pyproject.toml #2666

Open mistercrunch opened 1 day ago

mistercrunch commented 1 day ago

🚀 Feature Request

First! Thanks for an awesome project/library. We use playwright in apache/superset and clearly it has simplified running end-to-end tests on multiple browsers and headless-browser workloads like taking screenshots / thumbs. Grateful for much sanity in the headless browser space.

I was wondering it it would make sense for you all to relax the [currently] pinned dependencies for the library. Currently playwright forces a certain version of greenlet (3.1.1) https://github.com/microsoft/playwright-python/blob/main/pyproject.toml#L16, which conflicts with other reqs in our repository, and prevents us from upgrading greenlet to a newer version while using playwright with other libs that need other versions of greenlet.

For the CLI functionality it's not an issue, but somehow we also import the lib and use it in our modules too, so given python's lack of support for diamond dependencies it's creating a conflict.

Anyhow, the standard practice is to relax deps to ranges in your package metadata, say greenlet>=3.1.1, and to use pip-compile or uv to pin dependencies, usually in a requirements.txt, that can be used in CI to get deterministic outcomes, and can be bumped periodically. Though I understand there may be good reasons for you all to pin directly in pyproject.toml (?)

Anyhow, happy to help too. I almost opened a PR but I'm not familiar with CI scripts and other automation you may have.

Example

pip install playwright

Motivation

People will be able to use playwright in combination with other libraries that have library range restrictions for greenlet that fall outside of 3.1.1

mxschmitt commented 1 day ago

Happy to relax it. Do you mind creating a PR? Looks like it was filed before in https://github.com/microsoft/playwright-python/issues/2190.

This requires changing the meta.yaml and pyproject.toml.

mistercrunch commented 14 hours ago

https://github.com/microsoft/playwright-python/pull/2669