-
Notifications
You must be signed in to change notification settings - Fork 846
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
PyPI package release plan for plugins? #425
Comments
Also, where to actually store the code: here or individual repositories. |
Just linking this here since it's slightly related and would make this easier: getpelican/pelican#1488 |
|
Also see #39 |
Anyone who wants to help make this a reality is encouraged to post a comment on this related issue: https://bitbucket.org/pypa/pypi/issues/238/request-for-new-pypi-trove-classifier-for |
It's take a bit, but trove classifiers for PyPI have now been added! |
Adding my two cents: it would be much nicer for the end user to have versioned plugins that are install-able from pypi. |
No promises, but hoping to rally the community and solicit help to implement this for 5.0.
|
…rs/add-jackdewinter docs: add jackdewinter as a contributor
I'd be so happy with modularizing this and importing individual plugins even though there would be the extra bloat of the unused projects. For years my practice has been copy-pasting pieces, which isnt maintainable. @justinmayer you can ping me to help if you need assigning sections of the codebase etc. :D |
maybe this PR (#1215) will help get us going? I'm attempting to do the initial steps of @ionelmc's and @moorepants suggestions (versions / CI / pypi installation) and allow folks to install |
Thanks for helping on this issue ! |
I think the first step is to move each plugin into its own repository (if not already). I don't think it is a good idea to have a pip installable mega distribution, because you have to lock each plugin at a specific version for the collection. This will be problematic if a user wants to specify specific versions of different plugins. If you want a mega distribution you need to work out how to pin versions for each plugin in a compatible set. |
ah I see @moorepants. we should do the more long goal thing with so many people using this project. I'll close my PR and help with the splitting apart. I wrote one of the liquid tag plugins ( |
Question about breaking things off. I'm going to do such for that old plugin I mentioned the other day, but what about helping with plugins I didnt write? Should I break it off, and then make a transfer offer to or if I register it with PyPI, should I add one of you, such as Justin as a maintainer? or maybe just best to skip that and let y'all handle that... |
It was suggested in getpelican/pelican#1488 to use https://github.com/pelican-plugins
Currently all the Pypi packages with classifier Framework::Pelican::Plugins seem to have been uploaded by individuals. Maybe an account could be created on Pypi and linked to the GitHub team @getpelican/moderators ? Then some Travis CI pipelines could be configured to publish packages with a token linked to this shared account. What do you think @getpelican/reviewers ? |
I had some thoughts about PyPi installable plugin structure for a while. This issue looks like a good place to share for comments. The organization from this comment (https://github.com/pelican-plugins) is better for this. Instead of installing plugins haphazardly, namespace packages sounds appealing. We could make A standard metadata for a plugin that is accessible when imported would be good. Nothing complicated: name, version, short description, supported |
How do we get access to push a plugin to https://github.com/pelican-plugins? I've converted render_math to a standalone repo: https://github.com/moorepants/render_math and can transfer the repo. |
One tip. If you clone this repo you can do this:
to retain the git history of that plugin. You just change the directory from |
I would like to take this opportunity to thank everyone who has stepped up to discuss, participate, and help enhance Pelican’s modularity. The recent influx of people volunteering to work on this endeavor is exciting, motivating, and deeply appreciated. Bravo! 👏 @avaris: I like your excellent suggestion regarding plugin structure. What changes, if any, would need to be made to Pelican core to support native namespace packages? @moorepants: I’d be happy to ensure you (and anyone else who wants it) have access to a new Speaking of structure, I think now is the perfect time to talk about other standard conventions we might want to codify before beginning the process of adding plugin repositories to the new I’d like to suggest taking that one step further… For some time now I have been thinking about creating a @ionelmc, @nebulousdog, and others have raised the question of how to handle release management. My strong preference would be for plugin packages to be automatically published to PyPI. It just so happens that I developed a solution that does exactly that, AutoPub, which is currently deployed for Pelican core and which has already auto-published multiple Pelican releases with aplomb. 🎉 So to answer the question of how to handle PyPI user accounts in this new scenario… At a minimum, adding the autopub PyPI user account as an Owner for any Pelican plugin package registered on PyPI would ensure that anyone with a commit bit for that plugin’s repository would be able to publish new package version releases simply by tapping the “Merge Pull Request” button. 🚀 What does everyone think about these ideas so far? |
Those ideas sound great. I support them all. I would like to suggest that we allow plugins to migrate now even if they don't necessarily fit a future template; we can always update them later. The efforts should be in parallel (migrating plugins and developing the infrastructure templates/tools/etc), otherwise it will slow any momentum to have to wait on various infrastructure to develop. Also migrating some plugins will help us understand what infrastructure is needed and what might constitute best practices. At the minimum we can prune a plugins directory, push that directory to the plugin org as a new repo, and replace the directory in this repo with a submodule link. That would keep everything the way it is but start the separation. Then PRs can be opened on the new repos to turn it into a proper tested package. The conda-forge community has a beautiful, mostly automated, system in place for submitting on a per repo basis with a common testing, linting, and publishing system. Ideas and even some tools could be used to do something similar for this collection of plugin repositories. |
great! That was the main clunky thing I was seeing in my attempt at creating a minimum structure. I haven't used |
Since I posted my comment yesterday, I've been working on a CookieCutter template, the initial version of which I just pushed: https://github.com/getpelican/cookiecutter-pelican-plugin It is still very bare-bones, but it's a start. To test it out, install CookieCutter and then:
If you don't want to install CookieCutter, but you have Pipx installed, you can run CookieCutter dynamically via:
You can use CLI context arguments to override the defaults specified in
|
When plugins are moved over to https://github.com/pelican-plugins, what do we think the standard naming convention should be for plugins? My inclination is to use dashes instead of underscores, only using underscores when they are necessary (e.g., for Python package names). To use the Render Math plugin as an example, the current CookieCutter template generates the following values:
So other than source-code-level names, everything consistently uses dashes, including the What does everyone think? |
If all of the plugins are turned into packages of a python distribution, then the distribution could be a new name that follows a new guideline, but the package name should probably stay as it was for backwards compatibility sake. So render math would work like this:
You can require that the package name matches the distribution name for new packages, but I would be very hesitant about breaking everyone's pelican config files. |
re #425 (comment): I think this looks good. Besides directories being named with underscores, are there any other exceptions? How does the ideal import look like? |
If the namespace idea can become reality, actual import would look like: import pelican.plugins.render_math We can do some magic in If people want to switch, they need to move from this collective repo to individually installing plugins. Some adjustment is already needed in that case, so I'm OK with having people modify their settings a bit. |
Random thought… Could Pelican core be modified to discover plugins within the |
Yes, it is possible. I made a simple example for testing. See: https://github.com/avaris/namespace_plugins So, people would manage plugins by installing/uninstalling them? Sounds good. We would still need |
Take a look at how pytest does the plugins (setuptools entrypoints discovery). Tho plugin ordering and blacklisting is tricky. Regarding the plugin cookiecutter - I'd just fork an existing cookiecutter template and avoid solving again all the packaging and boilerplate (I hope you find one with a src layout 😆) |
@ionelmc: I know it's been a long time since you originally submitted this issue. Thanks for chiming in! 😁 I actually referred to your PyLibrary template and corresponding Nameless repository when putting together my initial plugin template draft. Seeing such a detailed example was extremely helpful, so many thanks for all your work in those repositories! As a general practice, I often prefer to start with an empty slate and add bits incrementally as needed, which is why I didn't fork an existing template. For example, I wanted to experiment with Poetry and pyproject.toml, CI systems besides Travis, et cetera. And it can take time to understand the underlying rationale and purpose when you're looking at an existing template, and what all the various bits are for (such as I've read the long |
@avaris said:
I think perhaps the This has the side benefit of potentially allowing for plugin load ordering in a future version of Pelican. @avaris reminded me that plugins are currently supported via Blinker, which does not support ordering. If we ever switch to another plugin mechanism that supports ordering, we could load them in the specified order, use plugin loading priorities, et cetera. |
I think auto-discovery of plugins is good, but it's probably also helpful to have a mechanism to explicitly either enable or disable plugins. This will also make the transition easier, as plugins that haven't been moved to the new namespace will remain supported as well. Another advantage: Good form is to use a virtual environment, but on Windows I don't have to worry about breaking the system Python so I sometimes get a little lazy. Under the current setup (with an explicitly defined plugin list), I can generate three different Pelican sites (each with a different set of plugins) without having to much around with virtual environments. I do like the idea of proposing a namespace for plugins, as I expect a couple would organically develop otherwise; hopefully an "official" namespace will help avoid confusion. However, namespace plugins are a little esoteric (just from lack of common use) and so I worry a little about them breaking in unfamiliar ways. Particularly, I worry a little about having the plugin namespace be within |
@MinchinWeb: I'm not very familiar with namespace packages nor do I comprehend the potential threat model, so I'm going to let others address that concern. |
I made a number of changes to the Pelican plugin template and then, as an initial experiment, I used that template to set up the Simple Footnotes plugin at its new home. There is still plenty of work left to do here, including auto-publishing to PyPI, but it's a decent start. I also created a new repository for the Render Math plugin, as well as an initial issue to track migrating the work @moorepants has generously performed on that plugin over to the new shared repository: pelican-plugins/render-math#1 |
In the spirit of Hacktoberfest, some Pelican maintainers will be participating in a Pelican sprint this Sunday. One of the goals will be to help move this packaged plugin release plan forward, so please come join us! https://blog.getpelican.com/sprint-2019-fall.html |
As I think about this, I think the "threat" is someone will accidentally put something in the How does one go about moving plugins to the new organization? I have several plugins I maintain that I'd be happy to move over. |
To my previous comment, it seems that I would have to have the ability to create repos to transfer it to the organization (help page). The repos I would transfer:
|
If I understand it correctly, the cookiecutter template is intended for new plugins, not for transferring old ones, correct? Do we want to transfer all plugins tomorrow regardless of how up-to-date they are (and sort that out afterwards), or do we want to be more selective and ensure that all the plugins which we transfer work correctly? |
@MinchinWeb True, there are some "threats" to break
Yes, you can't put anything else inside I mean, if you accidentally override Having a |
@MinchinWeb: Many thanks for reaching out. Let's start with MinchinWeb/minchin.pelican.jinja_filters. I just created pelican-plugins/jinja-filters and sent you an invitation. Once you accept it, you should be able to push those 16 commits into the new repository. Once that's completed, we can move on to the others. Sound good? 😸 |
@oulenz said:
I intended it for both for new plugins as well as a model for how we might re-format existing plugins, benefiting from the consistency that comes from applying a shared set of best practices. So to take the Simple Footnotes plugin as an example, after importing the relevant commits from the legacy monolithic repository, I applied all of the enhancements and formatting conventions that would have been present had I generated the plugin from the template.
The latter. I would much rather take our time and feel good about the state of each plugin as we add them. |
In case others find it useful, I've used to following steps to transfer the more-categories plugin. (Replace -1. Choose a local directory where you want pelican plugins to reside (distinct from the directory containing the old pelican-plugins repository).
|
Don't forget adding the AGPL license too. That is only in the top level of the pelican-plugins repo. |
Thanks, I've edited the list. (I guess new templates are free to choose a different license.) |
If you mean new plugins, yes. I would think so. Maybe there should be a recommended license though, to help ensure compatibility with pelican (if that's needed). We'll have to maintain the AGPL license for any that are copied into new repos. |
For the record, there is a very detailed article on how to migrate Pelican plugins to their own independent packages at: https://blog.getpelican.com/namespace-plugin-migration.html |
Just putting this here.
Things to care about:
The text was updated successfully, but these errors were encountered: