-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
introduce sync
command and deprecate install --sync
#9801
Conversation
969c737
to
df241e7
Compare
Deploy preview for website ready! ✅ Preview Built with commit 2812a1a. |
is it possible adding this to v1, too? |
No, I do not think so. We will probably only do another 1.x release if there is a critical issue and we will not include new features in that case. |
@radoering a point of note here; we have until now avoided or tried to avoid cases where we have 2 ways to do the same thing via the CLI. This definitely breaks that model (we actually might have already broken it). I do not have a strong opinion on this as long as the underlying code is clearly an alias and documented as such. Wanted to note this here and want to make sure this is intentional. |
df241e7
to
575ffb8
Compare
Agreed.
It stems from the wish of some users that I added a note with some additional information to the docs. |
I have to disagree. If this is to be just an alias, I don't see a reason to make this change. Splitting the behavior makes more sense to me. |
@Secrus I do not disagree. My point, to be clearer is, if we are duplicating functionality I am not (personally) strongly opposed to a clearly documented alias. If we were splitting functionality, that is perfectly fine too, as long as we deprecate/remove the original. Whatever we choose, we just need to be clear on what and why.
@radoering If it were up-to me, I would just enforce virtual environments and be done with it. But I am sure some containers-don't-need-venv-footgun-warriors will be up in arms. I am surprised the system-site-packages case is impacted, as we should not be touching those packages at all. But then again, I guess detection is not always the easiest. As I write this, I am weirdly becoming more opposed to the "sync" as a new command idea. I much rather have All that said, I am open to see what the consensus between the rest of the maintainers is and go with it. |
575ffb8
to
d6b43ff
Compare
d6b43ff
to
60d4c4b
Compare
60d4c4b
to
e9673f0
Compare
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.
LGTM
sync
commandsync
command and deprecate install --sync
Just to check if Sourcery had noticed the missing implementation (or if it can extract the info from my comment or somewhere else 😉): |
@sourcery-ai review |
Reviewer's Guide by SourceryThis pull request introduces the Sequence diagram: Package synchronization before and after changessequenceDiagram
participant User
participant Poetry
participant Environment
rect rgb(200, 200, 200)
Note over User,Environment: Before (using install --sync)
User->>Poetry: poetry install --sync
Poetry->>Environment: Install packages from lock file
Poetry->>Environment: Remove untracked packages
end
rect rgb(200, 255, 200)
Note over User,Environment: After (using new sync command)
User->>Poetry: poetry sync
Poetry->>Environment: Install packages from lock file
Poetry->>Environment: Remove untracked packages
end
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @radoering - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
" deprecated and slated for removal in the next minor release" | ||
" after June 2025, use the" |
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.
suggestion: Consider moving the deprecation date to a configuration constant
Hardcoded dates in strings make future updates more difficult and error-prone. Consider moving this to a constant or configuration value.
Suggested implementation:
# Date after which the --sync option will be removed in the next minor release
SYNC_OPTION_DEPRECATION_DATE = "June 2025"
def handle(self) -> int:
from poetry.core.masonry.utils.module import ModuleOrPackageNotFoundError
" deprecated and slated for removal in the next minor release"
f" after {self.SYNC_OPTION_DEPRECATION_DATE}, use the"
Note: If there are other parts of the codebase that need to reference this deprecation date, you might want to consider moving the constant to a more central location, such as a constants.py
file or a configuration module. The exact location would depend on your project's structure and conventions.
Pull Request Check List
As suggested in #9136 (comment). Still not sure about it and how much duplication in the docs would be needed.
Closes #9855
Summary by Sourcery
Introduce the
sync
command to synchronize the project's environment with the lock file. Deprecate theinstall --sync
option in favor of the new command.New Features:
sync
command to synchronize the project's environment with the lock file, ensuring that the installed packages match the lock file.Tests:
sync
command.