This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Don't require setuptools_rust
at runtime
#13952
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix a bug introduced in v1.68.0 where Synapse would require `setuptools_rust` at runtime, even though the package is only required at build time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,17 @@ def _is_dev_dependency(req: Requirement) -> bool: | |
) | ||
|
||
|
||
def _should_ignore_runtime_requirement(req: Requirement) -> bool: | ||
# This is a build-time dependency. Irritatingly, `poetry build` ignores the | ||
# requirements listed in the [build-system] section of pyproject.toml, so in order | ||
# to support `poetry install --no-dev` we have to mark it as a runtime dependency. | ||
# Workaround this by ignoring it here. (It might be slightly cleaner to put | ||
# `setuptools_rust` in a `build` extra or similar, but . But for now I' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. some words have gotten lost here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤦 Guh, I think this is a sign I need to eat. Thanks, will amend |
||
if req.name == "setuptools_rust": | ||
return True | ||
return False | ||
|
||
|
||
class Dependency(NamedTuple): | ||
requirement: Requirement | ||
must_be_installed: bool | ||
|
@@ -77,7 +88,7 @@ def _generic_dependencies() -> Iterable[Dependency]: | |
assert requirements is not None | ||
for raw_requirement in requirements: | ||
req = Requirement(raw_requirement) | ||
if _is_dev_dependency(req): | ||
if _is_dev_dependency(req) or _should_ignore_runtime_requirement(req): | ||
continue | ||
|
||
# https://packaging.pypa.io/en/latest/markers.html#usage notes that | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should we link to a poetry bug here?
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.
python-poetry/poetry#6154 I guess would be this and is linked to someplace else, so probably OK not to.
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 wasn't 100% sure if this is considered a bug by poetry's authors, but the issue is a good point of reference---I'll gladly add it