-
Notifications
You must be signed in to change notification settings - Fork 251
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
replace clone to clone_shallow and copy only as much as you need attributes. #618
replace clone to clone_shallow and copy only as much as you need attributes. #618
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
@mtkennerly you have misunderstood this MR, it has nothing at all to do with git clone |
Ah, sorry, you're absolutely right. Carry on 😅 |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
Did you run a profiler to know if this fix the issue? |
@@ -481,7 +481,8 @@ def without_optional_dependency_groups(self: T) -> T: | |||
""" | |||
Returns a clone of the package without optional dependency groups. | |||
""" | |||
package = self.clone() | |||
package = self.clone_shallow() | |||
package._dependency_groups = package._dependency_groups.copy() |
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.
a little comment explaining why we are copying the package._depndency_groups wouldbe great
Superseded by #663. |
Resolves: python-poetry#8250
Description
This change was made under the assumption that if the tests pass, there should be no problem. However, just replacing the clone with a shallow copy caused several tests to fail, so I made "one level deeper" copies sufficient to fix those tests.
I understand that there is a trade-off with code maintainability regarding this change, so I would appreciate some feedback.
If we are to implement this while ensuring future changeability, I think we could solve this by creating code similar to Cow (Copy on Write).
Thanks.