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

Update open process types #3076

Merged
merged 7 commits into from
Sep 18, 2024
Merged

Conversation

A5rocks
Copy link
Contributor

@A5rocks A5rocks commented Aug 31, 2024

This should resolve the issue mentioned in Gitter

Copy link

codecov bot commented Aug 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.60%. Comparing base (0090581) to head (1688da0).
Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3076   +/-   ##
=======================================
  Coverage   99.60%   99.60%           
=======================================
  Files         121      121           
  Lines       17882    17882           
  Branches     3214     3214           
=======================================
  Hits        17811    17811           
  Misses         50       50           
  Partials       21       21           
Files with missing lines Coverage Δ
src/trio/_subprocess.py 100.00% <100.00%> (ø)
src/trio/_tools/gen_exports.py 95.93% <100.00%> (ø)

@agronholm
Copy link
Contributor

The updated documentation makes no mention of PathLike – shouldn't that be fixed?

src/trio/_subprocess.py Outdated Show resolved Hide resolved
@A5rocks
Copy link
Contributor Author

A5rocks commented Aug 31, 2024

I figured it's fine to have more accurate documentation (type hint) and less accurate but clearer (what's written in the docstring). Both are visible in the built docs.

I can make them the same though.

@A5rocks
Copy link
Contributor Author

A5rocks commented Sep 1, 2024

Huh https://github.com/python-trio/trio/actions/runs/10649671109/job/29520147803#step:4:208 shouldn't be happening. I'll assume it's transient but it seems like some sort of pip bug probably? Nevermind, it's not transient. Weird.


OK it's because @actions/checkout is pulling in the merged version of this PR (I think?), which contains the test-requirements.txt changes I just merged. I'm not clear on why that's leading PyPy to fail. And I cannot reproduce this locally with the same version of PyPy on Windows...

Something I noticed while investigating caching is I'm not sure it's helping much. In fact I think we'd probably be better off without it -- the cache key seems to change every single commit which makes no sense!!

@TeamSpen210
Copy link
Contributor

The cache has been working a few days ago, this run for example. We'd definitely want it if possible. Could the problem be that the Cython build isn't using cache-dependency-path?

@A5rocks
Copy link
Contributor Author

A5rocks commented Sep 1, 2024

The cache has been working a few days ago, this run for example. We'd definitely want it if possible. Could the problem be that the Cython build isn't using cache-dependency-path?

It wasn't Cython, it was PyPy on Windows (specifically). It should be using the cache-dependency-path right because it has the same hash (c5182900c6da08ceac54233234be0232412d20dcd40abe0f886b892a46fd3c5e) within the commit for the run I linked. Maybe it's just using the hash from the current branch rather than what @actions/checkout pulls (which is the state were this PR merged)?


Here's my current thoughts: the action should only cache pip's cache directory: so there must be something bad there. However, as this run shows, it does actually look at the current test-requirements.txt file, presumably to get the hash.

Also, I'm struggling to understand why the "Setup python" step has a different hash in the cache key than the "Post Setup python" step in this run: https://github.com/python-trio/trio/actions/runs/10649416223/job/29519569640. (which I reran for debug logging and which... failed???)

@TeamSpen210
Copy link
Contributor

It's very mystifying. Looking at the code, the hash should be stored here, and then reloaded here, so it shouldn't be affected if the requirements file was say edited. But I was thinking maybe there could be an issue if we had another action using setup-python internally. Not sure what though.

@@ -304,7 +304,7 @@ def kill(self) -> None:


async def _open_process(
command: list[str] | str,
command: StrOrBytesPath | Sequence[StrOrBytesPath],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering, why is type var here called StrOrBytesPath? Wouldn't it be StrOrBytes, or is StrOrBytesPath special somehow?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it's typed as str | bytes | PathLike[str] | PathLike[bytes]?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading the docstring currently in place, I wasn't under the impression it supported pathlikes. If you could update that then, that would be great!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring atm distinguishes what is possible with shell=True and what isn't, but I think paths are fine either way. I can update the docstring though. (this also appears in the function signature Sphinx makes)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would seem to be for the best to mention that, yes. After that, I have no objections.

Copy link
Member

@CoolCat467 CoolCat467 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, I just have one question in a comment I made.

@A5rocks A5rocks merged commit 7d81c27 into python-trio:main Sep 18, 2024
38 checks passed
@A5rocks A5rocks deleted the update-open-process-types branch September 18, 2024 09:53
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.

5 participants