-
Notifications
You must be signed in to change notification settings - Fork 56
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
Use glob_to_regex
from matrix_common
#174
Conversation
You'll probably want to update the README.md to mention the version requirement for the Synapse module. |
This PR doesn't change the version requirement (except maybe of Python 3.7, but I'm not sure about that) — |
When you wrote that "This function has moved to matrix-common since Synapse v1.50.0rc1", I assumed it meant that the function wasn't there previously. Did I misunderstand? |
Ah, I see. So if you install |
Removing my review -- I don't think I can do reviews for this project @reivilibre. |
I'm a bit unsure whether making Mjolnir import matrix-common is the right course of action here. matrix-common is supposed to be common utils between Synapse, Sydent and Sygnal, not a package that Synapse modules (as in, plug-in modules) can use to access these utils - that's supposed to be the module API. Mjolnir shouldn't have been importing |
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.
(as per my comment above)
It strikes me as very weird to expose a helper function that is basically completely unrelated to Synapse in the Module API.
The difference here is that we know As a note for completeness, with the right tooling we could have modules vendor their copy of
I see what you mean; though I would perhaps like to propose that it would be useful more generally as a library for Matrix.org developers — not suggesting we encourage third parties to use it. |
We already expose things like I agree that these would probably better fit into a library directed at providing helpers to make the lives of module developers easier. However, I seem to remember we made the explicit decision that matrix-common was to just be providing shared internal utils for Synapse, Sydent and Sygnal. Therefore I tend to consider accessing it from another project similar to if it was importing from Synapse's internals (ie, something it shouldn't do). I think we need to either decide to make matrix-common a general library any Python developer can use (ie for developing Synapse modules), or create a new library with this purpose. The main difference between the current state of things and this is that by declaring a library (whether it's matrix-common or a new one) safe to use outside of the Sy* projects, we clearly commit to some level of stability wrt its API.
I'm a bit uneasy with this proposal. In my opinion, we should have the same capabilities as any other developer when it comes to writing a module, rather than e.g. have our own internal lib others shouldn't use. This is one of the reasons we've been aiming at exposing things via |
The problem here is that I don't think this currently works out in practice. Putting it into Not saying that's the definite way we want to go for, but mostly raising it because no one way seems perfect — would like to see what the team thinks (again, not super fussed about one instance, but this is the kind of thing that tends to happen again and again and it'd be nice to have a clear-cut decision on what we're up to). |
I'm not sure about that. If there's a use case for it, I don't see why we wouldn't approve the PR.
That's my point though: currently it doesn't. afaict the current state of Let's consider a concrete example: one day we decide to move But let's imagine that later we introduce a critical security fix into matrix-common. Or we bump Synapse's dependency on matrix-common to a version that's more recent than the one the module has pinned. Suddenly the module developer needs to update the pin on the dependency immediately, otherwise their module is vulnerable or doesn't work at all. What's the path from there? There won't be any clear one in the state things currently are, because we don't expect people to be using it outside of the Sy* projects. We currently advertise and maintain matrix-common as "Common utilities for Synapse, Sydent and Sygnal". This, to me, means that if we need to make such a change we won't necessarily advertise it, because we are the ones maintaining all of the projects it's supposed to be used for, so we'll just deal with it and call it a day. Making it usable by a wider audience means that we need to commit to creating migration paths for projects outside of it's initial scope, think about how we ship security fixes (not just for Sy* but for the library as well), how we handle backwards compatibility layers that we don't necessarily use in Sy*, etc. To me the way we currently maintain and advertise matrix-common doesn't allow this kind of stability, because afaict we maintain and advertise it as an internal library other projects shouldn't use rather than a public-facing one. If we want to make matrix-common more than "Common utilities for Synapse, Sydent and Sygnal", we need to make an explicit decision about it, and change the way it's perceived both internally and externally. Saying people can just use it outside of Sy* would be the same as saying they can import stuff directly from e.g. Synapse's internals, in that it would be unstable and could break at any point, and fixing the breakage could be very non-trivial if you're not already familiar with the library or projects' code base (which most people aren't). imo this isn't a nice thing to do to people trying to develop things on Matrix/around our projects. |
I haven't fully followed the conversation in here, but I think having
Of those, I think the last two are more reasonable. |
So, what's the word? Should we move towards landing this? |
Yes we should probably move towards resolving this situation.
I think that's the best solution considering the current state of things. |
Closed in favor of #218 . |
This function has moved to matrix-common since Synapse v1.50.0rc1.
Fixes #173.
We should probably make a note on
matrix_common
that Mjolnir is using it, in case we ever need to know for compatibility reasons.