Skip to main content

venusianconfiguration

This package (venusianconfiguration) provides venusian based Python configuration syntax for zope.configuration as an alternative to zcml. This package does not replace zope.configuration like grok used to do, but just provides generic Python bindings for existing zope.configuration directives. So, venusianconfiguration is more an alternative to grok than it is to zope.configuration.

The current status of this package can be described as already in internal use, but maybe not yet ready for the community.

https://travis-ci.org/datakurre/collective.venusianconfig.png

The good:

from venusianconfiguration import configure

configure.i18n.registerTranslations(directory='locales')

@configure.browser.page.klass(
    name='hello-world', for_=Interface,
    permission='zope2.View')
class HelloWorld(BrowserView):
    def __call__(self):
        return u'Hello world!'

@configure.plone.behavior.provides(
    title=_(u'My behavior),
    description=_(u'Enables magic'))
class IMyBehavior(model.Schema):
    custom_field = schema.TextLine()
alsoProvides(IMyBehavior, IFormFieldProvider)

The bad:

from venusianconfiguration import scan
from venusianconfiguration import configure

from mypackage import browser
scan(browser)

import zcmlpackage
configure.include(package=zcmlpackage)

import otherpypackage
configure.include(package=otherpypackage, file='configure.py')

import mypackage.submodule
configure.include(package=mypackage.submodule,
                  file='configure.py')

The ugly:

zope.configuration is mostly syntax-agnostic, but unfortunately ZCML has been the only implemented syntax for it and we have also used to call its ZCML-specific API directly (e.g. in test fixtures and in z3c.autoinclude).

Therefore a new zope.configuration syntax cannot be introduced outside zope.configuration without monkeypatching…

venusianconfiguration works by monkeypatching the processxmlfile method in zope.configuration’s ZCML-support to accept also Python files pass those to venusianconfiguration to process.

To support z3c.autoinclude, venusianconfiguration also monkeypatches z3c.autoincludes’s includePluginsDirective and includePluginsOveridesDirective (includeDependencies-directive is considered evil and is intentionally left unsupported).

So, three monkeypatches in total for zcml-free configuration.

Usage

[instance]
recipe = plone.recipe.zope2instance
...
eggs =
    ...
    venusianconfiguration
zope-conf-additional =
    # Enable venuasianconfiguration monkeypatches
    %import venusianconfiguration

For more examples, look into the demo-package included in the sources.

Troubleshooting

Because the configuration now written in Python, your add-on must have its namespaces packages properly defined in its setup.py. E.g. add-on called my.product would have following namespace package definition:

setup(
    ...
    namespace_packages=['my'],
    ...
 )

Even there’s no ZCML, the add-on must be registered to be configured. This can be done by adding the usual z3c.autoinclude-entrypoint into add-on’s setup.py:

setup(
    ...
    entry_points="""
    # -*- Entry points: -*-
    [z3c.autoinclude.plugin]
    target = plone
    """
)

An alternative would be to add the package into the zcml-option of your Plone instance’s buildout-part for plone.recipe.zope2instance:

[instance]
recipe=plone.recipe.zope2instance
...
zcml = my.product

Changelog

1.1.2 (2021-09-01)

  • Fix issue where PEP 320 hook failed on Plone 5.2 because dummy component.xml was returned as string instead of bytes [datakurre]

1.1.1 (2018-11-07)

  • Add faceted namespace [datakurre]

1.1.0 (2018-01-17)

  • Drop z3c.autoinclude plugin entrypoint for plone to fix issues with where z3c.autoinclude included wrong packages on and pip-installed Plone. This will disable the experimental ZCML directives from meta.zcml to be loaded by default with Plone. [datakurre]

1.0.2 (2017-12-21)

  • Fix issue where default configuration directive being mutable caused unexpected behavior [datakurre]

1.0.1 (2016-09-21)

  • Fix issue where zope.deferredimported module was not recognized as module [datakurre]

1.0.0 (2016-04-19)

  • First release.

Metadata

Release files for venusianconfiguration 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for venusianconfiguration 1.1.2
File Size Uploaded
venusianconfiguration-1.1.2.tar.gz 13.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for venusianconfiguration 1.1.2
File Interpreter ABI Platform
venusianconfiguration-1.1.2-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 23.4 kB

Release files / venusianconfiguration-1.1.2.tar.gz

Download URL venusianconfiguration-1.1.2.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2c63f18390b71ba2e34d095bb7274204b418e44b9a824804746cff3f399843d3
BLAKE2b-256 checksum
How to use checksums
2c947dab90aebb095b4a8a91d097160bf961b67530f48ba9a5c360e2b83bbcd2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1.post20210326 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.10

Release files / venusianconfiguration-1.1.2-py2.py3-none-any.whl

Download URL venusianconfiguration-1.1.2-py2.py3-none-any.whl
Size 9.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e9b0bb14f0b511c36c2534d2cf24a32e6401c810a1bd1c1784386828cc16c482
BLAKE2b-256 checksum
How to use checksums
8ebfd619716d51faa7da1d728601e1e850bb31fcae2242c1efc3721940246339
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.3.1.post20210326 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.10

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.2

3 release files

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page