Skip to content

Conversation

@charliermarsh
Copy link
Member

Summary

This PR un-reverts #16861 by resolving extensionless sources with a different strategy: we return an Extensionless variant, then infer the type when we read the file and parse the contents immediately after, thereby avoiding multiple reads.

@charliermarsh charliermarsh added the enhancement New feature or improvement to existing functionality label Nov 28, 2025
@charliermarsh charliermarsh marked this pull request as ready for review November 28, 2025 22:50
@codspeed-hq
Copy link

codspeed-hq bot commented Nov 29, 2025

CodSpeed Performance Report

Merging #16889 will degrade performances by 28.44%

Comparing charlie/extentionless (7554291) with charlie/source-cache (44e8062)1

Summary

❌ 1 regression
✅ 5 untouched

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Mode Benchmark BASE HEAD Change
Simulation resolve_warm_airflow 785.4 ms 1,097.4 ms -28.44%

Footnotes

  1. No successful run was found on charlie/source-cache (d5dad4e) during the generation of this report, so d63e56f was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

// If it's not a PEP 723 script, assume it's a `requirements.txt` file.
let requirements_txt =
RequirementsTxt::parse_str(&content, &path, &*CWD, client_builder, cache)
.await?;
Copy link
Member

Choose a reason for hiding this comment

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

We should special case the error message, asking the user to specify a format manually, as we defaulted to requirements.txt and that failed.

$ uv pip install -r .editorconfig 
error: Couldn't parse requirement in `.editorconfig` at position 102
  Caused by: no such comparison operator "=", must be one of ~= == != <= >= < > ===
root = true
     ^^^^^^
$ uv pip install -r uv.lock
error: Couldn't parse requirement in `uv.lock` at position 0
  Caused by: no such comparison operator "=", must be one of ~= == != <= >= < > ===
version = 1
        ^^^

Copy link
Member

Choose a reason for hiding this comment

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

There's not a way for them to specify the format though, right?

Copy link
Member

Choose a reason for hiding this comment

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

We use the filename only, but currently there's no indication that this fails because we're trying to parse anything that doesn't look like a pylock.toml as requirements.txt

Copy link
Member

Choose a reason for hiding this comment

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

I think the hint would just be "We tried to parse this as a requirements.txt because it doesn't have an supported extension"?

For uv.lock, see #16192

Copy link
Member

Choose a reason for hiding this comment

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

That would be a good hint

@zanieb zanieb merged commit f0f5b66 into charlie/source-cache Dec 2, 2025
101 of 102 checks passed
@zanieb zanieb deleted the charlie/extentionless branch December 2, 2025 09:22
zanieb pushed a commit that referenced this pull request Dec 2, 2025
This PR un-reverts #16861 by resolving extensionless sources with a
different strategy: we return an `Extensionless` variant, then infer the
type when we read the file and parse the contents immediately after,
thereby avoiding multiple reads.
zanieb added a commit that referenced this pull request Dec 2, 2025
Duplicate of #16889 since I merged it without realizing it was stacked.

Co-authored-by: Charlie Marsh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants