-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Pre-PLIP: autoinclude zcml, new style #3053
Comments
In coredev 5.2 with
|
For fun, this is the list of all packages of which the
|
See this thread on Twitter started by @jensens with an analysis of Plone startup time:
|
You get here dotted paths because in lots o cases projectname == dottedpath. But this is not mandatory, the dist name can be different from the dottedpath or it may contain several paths (look at the |
I was looking for a way to print which packages actually get auto included. I decided to put this in |
I wanted to try something, to see what kind of information we can get with
Get the interesting ones:
Show attributes and simple callables of a distribution:
Can we import these by project_name?
So
So importing
Let's look at the Zope dist:
So importing by project name indeed does not work for all distributions.
That is 18 packages, most of which do not have any zcml. So in a |
I just keep hoping that, given a distribution, |
BTW, it would also be useful if an entry point can signal that the Python code of a package needs to be loaded at startup, even when it has no zcml. The only way to make this happen when no zcml is involved, is to put the package in the special So what I am hoping we can do with an entry point, using a variant of the notation from the initial comment:
Note that currently you need to add a target:
There is code in Plone to only load the zcml of entry points that have target Also note that, as far as I know, only Plone uses Enough brain dump for today. :-) |
Okay, I have some initial code for a possible |
I improved some more. If anyone wants to try it out (please not on production...) I have updated the README. Especially see the section on installing with pip. Status:
I am also experimenting with Note that there is no |
See #3053 and https://github.com/plone/plone.autoinclude Work In Progress. Not for merging yet. Maybe in Plone 6.0.
See |
See #3053 and https://github.com/plone/plone.autoinclude Work In Progress. Not for merging yet. Maybe in Plone 6.0.
A lot of progress was made by @tschorr and me during the 'not an Alpine City Sprint' sprint. Mostly tests. With Biggest change to the actual code in Let me give some examples of entry points in An empty EntryPoint is completely ignored, you cannot find it with
So you must pass an option. And it must have a value, otherwise you get an error when pip or buildout installs it:
You can pass a target, like
Or when your package is called A and it has module B, you can specify a module name:
In this case you do not specify a target. In our code this is no problem: when we look for all entry points with a specific target ( In fact you cannot specify both a target and a module if you wanted to.
TODO:
|
Hmmm. What about making |
I wondered about this because you can e.g. specify multiple console script entry points. I've played with a different way of reading the entry maps in plone/plone.autoinclude#1 and I can read both target and module with my variant. I tried to keep the current semantics to keep the tests green. |
On second thought, instead of using ... but that API is only available since Python 3.8.7 :-( |
The way @tschorr reads the entry maps works, so we could indeed use both a target and module. I have merged it. We need a test package using that, but can be done later. |
I have released 1.0.0a1 of |
I have released version 1.0.0a2, which I tested in a customer project. I will close this 'pre-PLIP' in favour of a proper PLIP: #3339. |
Copied from the Alpine City Strategic Sprint 2020 doc:
Plone on pip
pip install Plone
will work with Plone 5.2.1. But z3c.autoinclude can fail when add-ons useincludeDependencies
in zcml. And buildout should get an option/extension to not install any Python packages anymore. Or we switch away from buildout to something else (Ansible?), but there are still all kinds of nice buildout recipes.Integrating and finishing https://github.com/datakurre/plonectl
Some initial work by Six Feet Up https://github.com/sixfeetup/dietplonedocker
Good example is the warehouse project how to deploy.
Ansible role should be updated too, to be able to run without buildout. Maybe we could create an even lighter version of ansible.plone_server role, which does just the Plone setup, nothing more.
Who:
Prediscussion for PLIP:
Discourage use of
z3c.autoinclude
: Problem here is:We want pip installed packages automatically picked up at Zope startup
Idea:
pkg_resources.iter_entry_points(group="z3c.autoinclude.plugin")
and then for each you can getentrypoint.dist
, which seems to give enough info about the package.Maybe try this out in a branch of CMFPlone, because that is where
z3c.autoinclude
is currently loaded, forconfigure.zcml
andoverrides.zcml
.The text was updated successfully, but these errors were encountered: