-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add support for unnamed local directory requirements #2571
Conversation
77611ea
to
81e1ded
Compare
// Attempt to read a `setup.py` from the directory. | ||
if let Ok(setup_py) = fs_err::read_to_string(path.join("setup.py")) { | ||
static SETUP_PY_NAME: Lazy<Regex> = | ||
Lazy::new(|| Regex::new(r#"name\s*[=:]\s*['"](?P<name>[^'"]+)['"]"#).unwrap()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\cc @BurntSushi - Here I want to match setup(name="foo")
-like calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not think frontends are supposed to use build backend–specific heuristics to retrieve metadata.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with it. These are just heuristics to support non-spec compliant requirement definitions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not run prepare_metadata_for_build_wheel()
and use the metadata from there like pip does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to pay that cost here when all we need is the project name (which is far less to ask than the project metadata). I'll consider it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll look into how challenging it would be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The project name is part of the Core metadata spec just like Requires-Dist
or anything else, but I understand. Thanks for looking into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it's possible for a build backend to exist that isn't setuptools or poetry and doesn't use PEP 621 metadata.
c5e8a94
to
2d5f4df
Compare
81e1ded
to
aac789c
Compare
2d5f4df
to
2c9c748
Compare
aac789c
to
6e118c9
Compare
2c9c748
to
b2ad283
Compare
6e118c9
to
87b4a1e
Compare
Summary
For example:
cargo run pip install .
The strategy taken here is to attempt to extract the package name from the distribution without executing the PEP 517 build steps. We could choose to do that in the future if this proves lacking, but it adds complexity.
Part of: #313.