-
Notifications
You must be signed in to change notification settings - Fork 5.7k
[FEATURE] Contrib repository #1912
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
Comments
@Bibo-Joshi Move fast and break things ¯_(ツ)_/¯ Let the community figure it out. We're just here for moderation, I'm pretty sure we're going to find lots and lots of people who are gonna take care of such a repo that lives from the community contributions. Just do it™. I think the community will figure it out on their own if we say "we expect you to follow the same guidelines as the main repo (read: high test coverage, clean code), but apart from that, go wild, this is everybodys' playground". With that said, it might still be beneficial to find a single, responsible "core maintainer" for the repo though. |
Maybe the |
There is a way to install additional dependencies with |
That sounds reasonable. We could still have |
@Bibo-Joshi I'm just against anything that would mean the maintainers and contributers would have extra work trying to maintain contrib stuff. |
@Eldinnie Well, the idea of the contrib package is to have a place for code that comes with a label "might not be maintained, use at your own risk". That's why in my suggested a modular architeture, i.e. each contribution can be used, while others can be buggy as hell. as to the current state of the contrib folder: currently it only contains stuff for packaging ptb as debian package |
Just a spontanuous idea: a midway between a full blown contrib repo and "just link in the wiki".
Of course we can't control if people completely change their contrib-stuff after being added to the list, but this would probably be enough of a hurdle for this not to happen … We can still go over the list e.g. once a year and kick out stuff that seems have been reworked in a way that doesn't agree with our code standards. |
@Bibo-Joshi
I like your idea to start making a template already. Just restrict it to the bare minimum (I took your list and shorten it):
NO TESTS. NO CODE COVERAGE |
Replying to your points below, but first I would like to suggest that the concept of a monorepo could also be nice for this use case.
How about renaming the existing
You mean
I'm wondering if every sub-project could also have a dedicated Examples:
Automated linting, style, and type checks are a way to keep idiots out and the quality high. Might be a good idea to only allow contributions that pass rigorous automated checks...
✋
No tests? That sounds crazy. No coverage alright, that's fine. |
I wouldn't rename
Good catch. Lets use underscore.
Whatever. Every contribution can be done differently, according to the need.
I see your point, but I don't want to waste time on that. At least not at the start, I want to get this contrib repo going already.
I have no objection.
You're probably right. Meaning each module would have to come with its own tests. |
Some minor comments: Package name:
Modularity: If we go for "one repo, multiple files", we might end up with situations like this:
Now there is no commit I can checkout to have both A and B in a working status. This would not be the case, when everyone would host their on contrib, as proposed here. Ofc having everything in one place has many upsides and I'm willing to accept this downside. Just felt like it should point it out … |
Closing, as ptbcontrib is now online and we can pick up any discussion there. |
This is kind of a meta issue, but I felt like it's more appropriate and convenient to discuss it here than in the dev chat.
Disclaimer
I know, that this is quite a wall of text. Still, I'd appreciate any feedback, both from the maintainers/developers and the users/potential contributers perspective. I'm sure that I haven't covered everything and that there are other, more elegant solutions to the problems I list, which I simply don't see.
The Problem
We have sometimes have feature requests/PRs that are reasonable for some applications but kind of too specific for a general purpose library.
Examples (from my point of view) are #854 (
extract_url
helper) #1861 (forward messages by "copying" them), #1702 (handler for inline menus based on CH. There are also older approaches to that), maybe #1911 as well (read descriptions from CommandHandlers and use them withBot.set_my_commands
)Right now, we have mostly have to reject those, because we simply don't have the resources to maintain those contributions.
Parts of the code snippets section in the wiki also fall into this category.
Proposal: Contribution Repository
The idea of a contribution repository has been discussed in the dev chat before. The general idea is to add a repository
python-telegram-bot-contrib/plugins
or whatever, where such "reasonable but out of scope" features can be collected.Personally, I find the idea appealing. That way we can give users a way of exchanging pieces of code that may be usefull for others and also have some "experimental" features that we don't want to have to maintain.
Alternatives:
We already have a
/contrib
directory in the main repo. However opening this to the contributions described above will probably hard to tell "important" prs/issues from contribution-ones. Also the git-log will likely become messy and we might be pressured into releasing quicker than we want to.A low-effort alternative would be to add a wiki page to just gather links to such things. Everyone could maintain their own plugin and add a link it there. While this means nearly no maintainance work, this also means that the listed resources most likely will come with a lower code standard and will probably not have a uniform integration interface (see below)
Problems
If we decide that a contrib repo is a good thing to have, there are some issues to think about
Shipping
How do we install the contrib repo?
pip
. But how often? Contributers will likely expect a contrib package to be released much more frequently than ptb. Do we release after every commit? Once a month?pip
can do that, so that's not really an issue. This seem unsatisfactory at first glance. On the other hand, people installing from a contrib repo should (should!) know their way around PTB and Python in general. Also it takes away a lot of maintainance work. The Changelog could be a separete one for every contribution and be updated on the fly.Architecture
The contrib repo should be designed such that all features are separated from each other. So if one feature is buggy, the others will still work. My suggestion would be to have every contribution in a single file/module, so we could do stuff like
Integration with PTB
This one is a real problem in my eyes. We'll want to make it simple to use the contrib repo with PTB, while making little to no changes with PTB itself. Let's assume we have installed the contrib repo as
telegram-contrib
package. There are different situations:Additional functions, handlers, ect. We can just import them like
and be done with it
Additions to existing classes, e.g. Add extract_urls-helper #854 and #1861 would make sense as class methods of
Message
. This is a bit trickier, sinceMessage.de_json
is called on receiving updates. One could go forUpdater(..., use_contrib_message=True)
or something. However that poses two difficulties:Message
to use. Using both would become a hassle.Another approach could be to do
and then
Kind of hacky, but it could do the trick.
Edit: Past v13 this will play poorly with type hinting …
Then there is stuff, that not like a "standalone" thing, but only really makes sense when integrated in the whole architecture of ptb, like Roles #1789. This could surely be done as described as above, but that could become ugly quickly…
Maintainance
Who will be maintainer and developer in this repo? Contributions should be reviewed (even if not as thoroughly as with PTB), so I guess merging would be the job of the PTB maintainers.
However, answering to issues related to their own contributions could be understood as the responsibility of the contributers themself, so one could argue that every contributer should be promoted to developer.
In any way, it would be a good idea to have someone as developer, who is not actively involved in the main repo, imho.
Where to draw the line?
Pretty much linked with the maintainance question. Who decides, what is goes intro contribution and what goes into PTB? What is general purpose, what isn't?
Documentation
I'd suggest to host documentation for the contrib repo on rtd independently from PTB. Using just the wiki is also a vailable way, but using only the wiki we don't really have a way to enforce contributers to document their features. The docs don't have to be as polished as the ones for PTB, but they should state what a feature can and cannot do and what known issues are.
A Changelog could be kept for every feature separately, which would be especially usefull in the "install from master" option described above.
The text was updated successfully, but these errors were encountered: