-
-
Notifications
You must be signed in to change notification settings - Fork 466
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
[WIP] Support add/remove dependency to the given project #318
Conversation
if cmd.project.is_some() && pyproject_toml.is_workspace_root() { | ||
let workspace = pyproject_toml.workspace().unwrap(); | ||
pyproject_toml = workspace.get_project(&cmd.project.unwrap())?.unwrap(); | ||
} | ||
let py_ver = match pyproject_toml.target_python_version() { | ||
Some(ver) => ver.format_simple(), | ||
None => "".to_string(), |
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.
Because I looked at it before for the --pyproject
arg work:
Inside the requirement code in this same file, apply_to_requirement
there is some logic about relative paths for path dependencies. That code uses the current working directory path as starting point. We might need to think about how that one should work together with this feature.
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 current messy way of adding local dependency is rooted in the limited support of pip-tools. I am looking for a proper way to make relative paths work properly. The main issue is that after adding dependencies for a specific project, lock and sync will fail due to the inability to find the path.
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 just saw this PR #321, 👍
rye/src/cli/add.rs
Outdated
let mut pyproject_toml = PyProject::discover()?; | ||
if cmd.project.is_some() && pyproject_toml.is_workspace_root() { | ||
let workspace = pyproject_toml.workspace().unwrap(); | ||
pyproject_toml = workspace.get_project(&cmd.project.unwrap())?.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.
It's possible to write this using if let or match to avoid all or most of the unwraps. if let Some(project) = cmd.project etc avoids one, for example.
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.
Thanks
Since there are still many problems with adding local dependencies, I'll close this PR for now. |
[WIP]