-
Notifications
You must be signed in to change notification settings - Fork 7
Zope 6.0: Getting ZMS initialized #436
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
Conversation
Currently ignored in dockerignore and then bind mounted via docker compose
IMPORTANT: $instance/etc/ needs a new zcml-file for initalizing the ZMS "package" Ref: Zope changed pkg_resources-namespace zopefoundation/Zope@b465923
More Registration Issues: Shared/DCProducts.SQLAlchemyDA may fall into registration issues and not be able to import Shared libraries. The
and add the line to each files: __import__('pkg_resources').declare_namespace(__name__)HINT: this fix [1] may not be necessary if at least [2] is available.
import sys, types, os;p = os.path.join('/home/zope/venv/lib/python3.13/site-packages', *('Shared',));importlib = __import__('importlib.util');__import__('importlib.machinery');m = sys.modules.setdefault('Shared', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('Shared', [os.path.dirname(p)])));m = m or sys.modules.setdefault('Shared', types.ModuleType('Shared'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p)
import sys, types, os;p = os.path.join('/home/zope/venv/lib/python3.13/site-packages', *('Shared', 'DC'));importlib = __import__('importlib.util');__import__('importlib.machinery');m = sys.modules.setdefault('Shared.DC', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('Shared.DC', [os.path.dirname(p)])));m = m or sys.modules.setdefault('Shared.DC', types.ModuleType('Shared.DC'));mp = (m or []) and m.__dict__.setdefault('__path__',[]);(p not in mp) and mp.append(p);m and setattr(sys.modules['Shared'], 'DC', m)The root cause is that Products.ZSQLMethods (which provides Shared.DC.ZRDB]) was installed in site-packages, but the namespace package mechanism wasn't properly merging the site-packages location with the editable Zope source installation. Now both locations are correctly included in Shared.DC.path allowing ZRDB to be imported successfully. |
prepare merge
prepare merge
Removed Python-Packages entry from workspace configuration.
|
INFO: PR "Adding pyproject.toml #302" is merged into this PR |
|
Wie sollte es funktionieren: Mit pep 420 native Namespace Packages, sollten alle namespace Pakete nur noch als Ordner vorliegen. Es fallen alle Der Wir haben jetzt den komplizierteren Fall das wir noch editable Pakete haben. Hier hat das installierende Paket (für uns |
Although setuptools seems appropriate for Zope 5+, if the [build-system] block of pyprojecr.toml is removed the behaviour will be the same. Lines 94 to 95 in 2d743d1
|
This fixes import of editable zms install, being discoverable by pkgutils.iter_modules()
2d743d1 to
6a36343
Compare
Adapt docker build to the src layout, and also switch to uv now that this is possible for much faster docker build times
ZMS6: Reorganized ZMS Source Data into src-FolderRef: https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/ Adding a new container-folder IMPORTANT NOTE: ./pip uninstall zms
./pip install -e ../src/zms/.
|
d7164e3 to
9ff9099
Compare
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.
The modified dockerfile https://github.com/zms-publishing/ZMS/blob/7c06fe11ffd1c853762ee01566c5c3f9344f8f8b/docker/variants/alpine/dockerfile lets ZMS6 (this branch) run on Py3.14.2 and latest Zope6
Cave: Source-Update ZMS5->6 in editable-mode does not workBecause of the path-reorganisation a updating the code in editable-mode by a simple
For evaluation just add an src-update to the existing dockerfile for ZMS5: https://github.com/zms-publishing/ZMS/blob/main/docker/variants/alpine/dockerfile # Update ZMS-src with ZMS6-branch from GitHub
RUN cd /home/zope/venv/src/zms/ && \
git fetch origin && \
git checkout -b zope6_pkg_registering && \
git pull origin zope6_pkg_registeringSolution: Code-Update by pip-installIn an existing Zope5-environment the ZMS-Code can be updated to ZMS6 by a pip install ; the compatibility flags ( pip install -e git+https://github.com/zms-publishing/ZMS.git@zope6_pkg_registering#egg=ZMS |
|
PR is replaced by #450 |

HINT: PR is replaced by #450
Since the code-change zopefoundation/Zope@b465923 Zope changed
pkg_resources-namespace and thusProducts.zmsdoes not get initialized anymore when installed in--editablemode.Installing--editable with pip-parameter
--use-pep517With pip ≥ 21.3 and setuptools ≥ 64.0.0. Zope will find the init-path for ZMS:
pip install --use-pep517 --config-settings editable_mode=compat -e git+https://github.com/zms-publishing/ZMS.git@main#egg=ZMSRef: 955d8ba
Otherwise the initialize-path can be set explizit via zope-configuration-file:
Registering ZMS via $INSTANCE/etc/site.zcml
Adding just one new line
into the Zope instance's
./etc/site.zcmlwill do the same job for registering the ZMS package to Zope 6.This variant does not need a reinstall of ZMS if the initial installation of ZMS installed Zope 5.13 in editable mode and the updated by git. Using this way of registering ZMS leads to a (harmless) doubled init of ZMS when downgrading to Zope5 (this can be simply fixed by commenting the line)