-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
@@ -221,3 +230,5 @@ def _check_requirement(dependency_string): | |||
import sys | |||
|
|||
sys.stdout.writelines(req + "\n" for req in list_requirements()) | |||
|
|||
check_requirements(dev=True) |
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.
Does something run this module at some point? When is this used?
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.
No, currently nothing runs the module at this point, but this way, python -m synapse.python_dependencies
can be suggested by someone from the synapse team to be ran by developers to check if their dependencies are alright, or if one of them is the wrong version.
@@ -0,0 +1 @@ | |||
Fixes the way synapse distinguishes between runtime and developer dependencies. |
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.
We should use the same newsfragment as the PR that regressed this so that they'll show up together in the changelog.
deps_needed = [] | ||
errors = [] | ||
|
||
if for_feature: | ||
reqs = CONDITIONAL_REQUIREMENTS[for_feature] | ||
reqs = CONDITIONAL_REQUIREMENTS.get(for_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.
Why this change? It seems unrelated?
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.
if for_feature
is not a key in CONDITIONAL_REQUIREMENTS
, it'll raise a KeyError
, i think the right logic then is to return a default empty list
This is so that when check_requirements
is called with a dependency list that does not exist anymore, any time in the future, it should not return a cryptic error, should i revert this?
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.
generally this feels overengineered to me. I don't really see why we need to complicate python_dependencies
with this stuff rather than just putting the dev dependencies in setup.py.
well, perhaps you could clarify what they are. I feel like we've discussed this, asked you to take a different approach, and now you've ignored our requests and presented us with your own implementation without explaining how it works and why it is superior. |
# We exclude lint and test as those are developer requirements | ||
ALL_RUNTIME_REQUIREMENT_COMPONENTS = set(CONDITIONAL_REQUIREMENTS.keys()) - { | ||
"lint", | ||
"test", | ||
} | ||
|
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.
@richvdh This change filters out all developer dependencies from all conditional dependencies, by only excluding lint
and test
, and then flattening the resulting dependencies into a single set
.
I could change this to be only a set with {"lint", "test"}
, as this piece is only used in one part later on.
if for_feature is None: | ||
# Check if the optional runtime dependencies are up to date. We allow them to not be | ||
# installed. | ||
OPTS = sum(CONDITIONAL_REQUIREMENTS.values(), []) # type: List[str] | ||
OPTS = set().union( | ||
*( | ||
set(reqs) | ||
for key, reqs in CONDITIONAL_REQUIREMENTS.items() | ||
if key in ALL_RUNTIME_REQUIREMENT_COMPONENTS or dev | ||
) | ||
) # type: Set[str] |
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.
@richvdh this is two compounded changes;
- Change
OPTS
to be a flattened set, to deduplicate any elements, and have potential faster iteration. - if
dev == False
, only check default (runtime) dependencies, ifdev == True
, also check development dependencies, this is useful as an addition in__main__
down below, which doesdev=True
, making an invocation of the file (python -m synapse.python_dependencies
) automatically also check those development dependencies.
I left some comments doing exactly that last part, sorry for my abrasive changes, I thought this was a rational change overall. |
Some extra context, Lines 94 to 95 in b29a9bd
Lines 103 to 104 in b29a9bd
Adding the following to it would split the concern of "dependency notation" between # Make `pip install matrix-synapse[all]` install all the optional dependencies.
CONDITIONAL_REQUIREMENTS["all"] = list(ALL_OPTIONAL_REQUIREMENTS)
CONDITIONAL_REQUIREMENTS["lint"] = ["isort==5.0.3", "black==19.10b0", "flake8-comprehensions", "flake8"] The synapse codebase wants to define dependencies in |
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.
ok so to summarise, I think you are saying you want to put it in python_dependencies
because that is where existing dependencies are listed and you don't want to split them up.
my counterpoint is: this complicates python_dependencies
, making it harder to understand. Additionally I would say that python_dependencies
is explicitly for runtime dependencies, and having other dependencies elsewhere is reasonable.
I don't particularly want to debate this any further. If you'd like to update this PR to change setup.py
instead, that would be great. Otherwise I can revert the PR that caused the regression. Thank you.
Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.Fixes #8365
Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>