Conversation
8abce14 to
ece0206
Compare
e835f35 to
59221cc
Compare
| matrix.python_version != '3.6' && | ||
| matrix.python_version != '3.7' | ||
| - name: Build sdist and wheel | ||
| run: python -m build |
There was a problem hiding this comment.
This redesign of the build workflow could look unnecessary on first sight.
However, it will become justified in a follow-up PR, where I build vs. nightly wheels of major dependencies (numpy and blis). In order to do so, I had to build with --no-isolation, meaning that compiling from sdist later is no longer functional if you want to test that runtime dependencies are pulled in on install.
There was a problem hiding this comment.
This makes sense to me to change, python -m build is the standard and python setup.py ... is deprecated anyway.
| - name: Run tests without extras | ||
| run: | | ||
| python -m pytest --pyargs thinc -Werror --cov=thinc --cov-report=term | ||
| run: python -m pytest --pyargs thinc --cov=thinc --cov-report=term |
There was a problem hiding this comment.
-Werror moved to pyproject.toml
build-constraints.txt
Outdated
There was a problem hiding this comment.
Agreed, vestigial now that the repo uses cibuildwheel
There was a problem hiding this comment.
Removed a bunch of redundant dependencies. Now only test dependencies are left.
There was a problem hiding this comment.
I'd leave the dependencies needed for building too, in case someone wants to do a --no-build-isolation build. Also IMO a file named requirements.txt should include all needed dependencies.
There was a problem hiding this comment.
Also similar to below, even if it does reduce maintenance burden, the requirements files here are relatively strict for a reason and we shouldn't change that without explicit buy-in from upstream.
requirements.txt
Outdated
| typing_extensions>=3.7.4.1,<4.5.0; python_version < "3.8" | ||
| contextvars>=2.4,<3; python_version < "3.7" | ||
| # Explosion-provided test dependencies | ||
| ml-datasets>=0.2.0,<1 |
There was a problem hiding this comment.
Removed pin python_version < "3.11", as there was no strong reason for it.
The removal of the pin causes ml-datasets to run on many more CI os'es, which highlighted a lot of failures (as marked in the tests).
requirements.txt
Outdated
| # Test to_disk/from_disk against pathlib.Path subclasses | ||
| pathy>=0.3.5 | ||
| # Linters | ||
| flake8==5.0.4 |
There was a problem hiding this comment.
Moved pin from tests.yml
requirements.txt
Outdated
| pathy>=0.3.5 | ||
| # Linters | ||
| flake8==5.0.4 | ||
| mypy>=1.5.0,<1.6.0; platform_machine != "aarch64" |
There was a problem hiding this comment.
This is a bizarre pin which I did not investigate. This mypy version is extremely old and would need to be upgraded anyway, which is out of scope for this exercise.
setup.cfg
Outdated
| cymem>=2.0.2,<3 | ||
| preshed>=3.0.2,<4 | ||
| wasabi>=0.8.1,<2 | ||
| srsly>=2.4.0,<4 |
setup.cfg
Outdated
| wasabi>=0.8.1,<2 | ||
| srsly>=2.4.0,<4 | ||
| catalogue>=2.0.4,<3 | ||
| confection>=0.0.1,<2 |
There was a problem hiding this comment.
This enables confection git tip
ngoldbaum
left a comment
There was a problem hiding this comment.
I think this PR is changing more than it needs to - please try to keep these PRs as minimal as possible.
In particular, I don't think we should change the upper version pins without buy-in from upstream maintainers and a thorough understanding of why they're in there right now. I realize there are technical downsides to not relaxing the upper version pins. We only have a limited amount of attention from the explosion maintainers and I don't want them to get distracted by changes that they might perceive as unnecessary.
| numpy>=1.19.0,<3.0.0 | ||
| numpy>=1.21.0,<3.0.0 | ||
| pydantic>=2.0.0,<3.0.0 | ||
| packaging>=20.0 |
There was a problem hiding this comment.
I'd prefer not relaxing the upper version pins unless you need to and only then to relax them to the needed feature release.
The maintainers added these pins for a reason, IMO we need to leave them as-is unless we get explicit buy-in to remove them.
| [options] | ||
| zip_safe = false | ||
| include_package_data = true | ||
| python_requires = >=3.10,<3.15 |
There was a problem hiding this comment.
I'd leave the dependencies needed for building too, in case someone wants to do a --no-build-isolation build. Also IMO a file named requirements.txt should include all needed dependencies.
There was a problem hiding this comment.
Also similar to below, even if it does reduce maintenance burden, the requirements files here are relatively strict for a reason and we shouldn't change that without explicit buy-in from upstream.
pyproject.toml
Outdated
| "murmurhash>=1.0.2,<2", | ||
| "cymem>=2.0.2,<3", | ||
| "preshed>=3.0.2,<4", | ||
| "blis>=1.3.0,<2", |
There was a problem hiding this comment.
Can you keep the upper pins to be on a feature version? See the explanation below.
build-constraints.txt
Outdated
There was a problem hiding this comment.
Agreed, vestigial now that the repo uses cibuildwheel
| @pytest.mark.parametrize( | ||
| ("depth", "width", "vector_width", "nb_epoch"), [(2, 32, 16, 5)] | ||
| ) | ||
| @pytest.mark.xfail(reason="Flaky live download from the internet", strict=False) |
There was a problem hiding this comment.
won't strict=True cause a failure if the flaky download happens to work?
There was a problem hiding this comment.
correct, that's why I wrote strict=False.
There was a problem hiding this comment.
Why do we want the test to fail if the download succeeds?
There was a problem hiding this comment.
It won't fail, it does say strict=False.
There was a problem hiding this comment.
The test will XPASS if the download succeeds.
This is a textbook use case for
@pytest.mark.xfail(
exception=URLError, reason="Flaky live download from the internet", strict=False
)which would neatly single out the flakiness of the download phase and leave a hard fail if anything else raises.
However, ml-datasets obfuscates the URLError.
I've written explosion/ml-datasets#8 to address it (but it will need a follow-up clean-up here after the next ml-datasets release).
| @pytest.mark.xfail( | ||
| platform.system() == "Darwin", | ||
| reason="SSL: CERTIFICATE_VERIFY_FAILED", | ||
| strict=False, # Works on macos-15-intel Python 3.10, for some reason |
There was a problem hiding this comment.
Is saying "works" here a typo? If I'm reading this correctly the xfail says this always fails on macs.
There was a problem hiding this comment.
MacOS Intel Python 3.10 - always works
MacOS Intel Python 3.11 - always fails
MacOS Intel Python 3.12 - always fails
MacOS Intel Python 3.13 - always fails
MacOS ARM Python 3.10 - always fails
MacOS ARM Python 3.11 - always fails
MacOS ARM Python 3.12 - always fails
MacOS ARM Python 3.13 - always fails
I did not invest time to investigate why.
Pinpoint the one and only combination of CPU and Python that for some reason makes it work felt like overengineering it. Also, I have no evidence about what happens on local boxes (and I suspect behaviour may change depending on your OS version).
So I just relaxed the check and moved on. The test must pass on Linux and Windows, which is plenty for me. Everything else is a ml-datasets issue that shouldn't be dealt with here.
There was a problem hiding this comment.
So I'd delete the
strict=Truethen.
This looks fine as is, the code says strict=False (also higher up). I think from the comments you're misreading it?
There was a problem hiding this comment.
Oh, I'm sorry! Thank you. I'd just delete the strict=False. That's the default and I don't think that's being overridden in the pytest configuration.
There was a problem hiding this comment.
I think it's healthier to explicitly declare that this is the intended behaviour if someone later sets strict=True by default in the pytest config?
There was a problem hiding this comment.
Then xfail_strict should probably be set in the CI config to enforce that.
| - "*.md" | ||
| pull_request: | ||
| types: [opened, synchronize, reopened, edited] | ||
| branches: ["*"] |
There was a problem hiding this comment.
I'd say [main, v8.3.x] here as well.
There was a problem hiding this comment.
I routinely do pull requests against a staging branch of some sort on my local forks to verify that everything works AND produce a nice PR diff.
There was a problem hiding this comment.
I understand that, but you can always change that locally in your fork. When I work with CI I prefer to leave behind settings that reduce unnecessary electricity usage.
There was a problem hiding this comment.
The only case where this comes in to play is when someone deliberately opens a PR against a staging branch, at which point why wouldn't they want to run CI?
There was a problem hiding this comment.
Let's agree to disagree, it's not a big deal. I like to err on the side of reducing unnecessary CI use, that's all.
rgommers
left a comment
There was a problem hiding this comment.
The majority of changes look fine. I agree with @ngoldbaum's comment about avoiding this:
- In an effort to reduce the burden of maintenance, relax the upper constraint of most dependencies
- For the same reason, remove the upper constraint on Python version
Those kinds of changes are invariably controversial, and not necessary.
| preshed>=3.0.2,<3.1.0 | ||
| blis>=1.3.0,<1.4.0 | ||
| srsly>=2.4.0,<3.0.0 | ||
| srsly>=2.4.0,<3.1.0 |
| catalogue>=2.0.4,<2.1.0 | ||
| confection>=0.0.1,<1.0.0 | ||
| ml_datasets>=0.2.0,<0.3.0; python_version < "3.11" | ||
| confection>=0.0.1,<1.1.0 |
There was a problem hiding this comment.
Enables confection git tip
| confection>=0.0.1,<1.0.0 | ||
| ml_datasets>=0.2.0,<0.3.0; python_version < "3.11" | ||
| confection>=0.0.1,<1.1.0 | ||
| ml_datasets>=0.2.0,<0.3.0 |
There was a problem hiding this comment.
There was no strong reason to pin it only to Python 3.10.
The unpin makes ml-datasets tests run on more platforms, too, which highlighted a bunch of test fragility (see changes to tests/`).
| types-contextvars>=0.1.2; python_version < "3.7" | ||
| types-dataclasses>=0.1.3; python_version < "3.7" | ||
| importlib_resources; python_version < "3.7" | ||
| flake8==5.0.4 |
There was a problem hiding this comment.
pin moved from tests.yml
| types-dataclasses>=0.1.3; python_version < "3.7" | ||
| importlib_resources; python_version < "3.7" | ||
| flake8==5.0.4 | ||
| mypy>=1.5.0,<1.6.0; platform_machine != "aarch64" |
There was a problem hiding this comment.
I did not spend time to investigate this bizarre arch pin. This is a very old mypy version. The whole linters stack could use a proper refresh, which is out of scope for this PR.
| pydot | ||
| graphviz |
|
I revisited the pins as requested; this is ready for a second round of review. |
ngoldbaum
left a comment
There was a problem hiding this comment.
Thanks! All the remaining discussion is over quibbles. This looks good. Maybe add xfail_strict to the CI config if it's straightfoward but otherwise this is fine.
|
Set xfail_strict=True |
In an effort to reduce the burden of maintenance, relax the upper constraint of most dependenciesFor the same reason, remove the upper constraint on Python version