plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
243 stars 186 forks source link

Circular dependency between p.a.multilingual and Products.CMFPlone #3859

Closed gforcada closed 2 months ago

gforcada commented 10 months ago

As plone.app.multilingual is being moved to being a plone core add-on, CMFPlone should stop importing from it, right? 🤔

There are quite a few repositories were I can not enable the circular GHA due to this circular dependency being reported 😕

Any takers? 😄

mauritsvanrees commented 10 months ago

This is already fixed... in Plone 6.1. Making plone.app.multilingual a core add-on served two purposes:

  1. Not everyone needs this, so make the package optional (the Plone package on 6.1 will still pull it in).
  2. Fix a circular dependency between the two packages.

So on 6.1 this is fixed, but the circular dependency remains on 6.0. That is an open end that we did not tackle yet.

Some options:

If the last item works, that would be fastest, so worth a shot.

mauritsvanrees commented 10 months ago

Forget what I said. :-)

In 6.0 there is no problem. plone.app.multilingual 7.x does not depend on CMFPlone. Well: the code imports it, but we do not have it in install_requires and we let z3c.dependencychecker ignore it. This is the last option I mentioned.

The problem is on 6.1. And there it has long been solved, except for one thing: we need a release of CMFPlone and update the version on dist.plone.org/release/6.1-dev.

I will see if I can make an internal release. It still feels slightly too early for an alpha, with some more stuff that needs to be arranged, and it would take too much time now.

mauritsvanrees commented 10 months ago

We first need https://github.com/plone/Products.CMFPlone/pull/3861

mauritsvanrees commented 10 months ago

I have made internal releases of Plone and Products.CMFPlone and put them on https://dist.plone.org/release/6.1-dev/ and have updated the versions and constraints files there. So this should be solved now.

mauritsvanrees commented 10 months ago

Locally:

$ . .tox/circular/bin/activate
$ pip freeze | grep -i cmfplone
Products.CMFPlone==6.0.7

So the circular env does not seem to be using the constraints from 6.1-dev.

mauritsvanrees commented 10 months ago

Ah, adding constrain_package_deps = true in the circular tox env may help. See https://github.com/plone/meta/issues/168 But when I try this, it errors in a strange way:

$ tox -e circular
circular: install_deps> python -I -m pip install pipdeptree pipforester -c https://dist.plone.org/release/6.1-dev/constraints.txt
.pkg: _optional_hooks> python /Users/maurits/.local/pipx/venvs/tox/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_sdist> python /Users/maurits/.local/pipx/venvs/tox/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: get_requires_for_build_editable> python /Users/maurits/.local/pipx/venvs/tox/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
.pkg: build_editable> python /Users/maurits/.local/pipx/venvs/tox/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
circular: install_package_deps> python -I -m pip install BTrees Products.CMFCore Products.CMFPlone Products.GenericSetup Products.statusmessages plone.app.content plone.app.contentmenu plone.app.dexterity plone.app.event plone.app.i18n plone.app.layout plone.app.registry plone.app.uuid plone.app.vocabularies plone.app.z3cform plone.autoform plone.base plone.behavior plone.dexterity 'plone.i18n>=4.0.4' plone.indexer plone.locking plone.memoize plone.protect plone.registry plone.schemaeditor plone.supermodel plone.uuid plone.z3cform setuptools z3c.form z3c.relationfield zc.relation zope.browsermenu zope.intid zope.pagetemplate -c/Users/maurits/community/plone-coredev/6.1/src/plone.app.multilingual/.tox/circular/constraints.txt
Collecting BTrees
  Using cached BTrees-5.0-cp311-cp311-macosx_10_9_x86_64.whl (1.0 MB)
Collecting Products.CMFCore
  Obtaining dependency information for Products.CMFCore from https://files.pythonhosted.org/packages/48/b9/3b2e15bd2d4fb2f2b4ae7e8d3ac2d55c6a5f0a574bf747713dc07d9286d6/Products.CMFCore-3.2-py3-none-any.whl.metadata
  Using cached Products.CMFCore-3.2-py3-none-any.whl.metadata (36 kB)

The conflict is caused by:
    The user requested Products.CMFPlone
    The user requested (constraint) products-cmfplone==6.1.0a1.dev0

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: Cannot install Products.CMFPlone because these package versions have conflicting dependencies.
ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

circular: exit 1 (1.10 seconds) /Users/maurits/community/plone-coredev/6.1/src/plone.app.multilingual> python -I -m pip install BTrees Products.CMFCore Products.CMFPlone Products.GenericSetup Products.statusmessages plone.app.content plone.app.contentmenu plone.app.dexterity plone.app.event plone.app.i18n plone.app.layout plone.app.registry plone.app.uuid plone.app.vocabularies plone.app.z3cform plone.autoform plone.base plone.behavior plone.dexterity 'plone.i18n>=4.0.4' plone.indexer plone.locking plone.memoize plone.protect plone.registry plone.schemaeditor plone.supermodel plone.uuid plone.z3cform setuptools z3c.form z3c.relationfield zc.relation zope.browsermenu zope.intid zope.pagetemplate -c/Users/maurits/community/plone-coredev/6.1/src/plone.app.multilingual/.tox/circular/constraints.txt pid=62333
.pkg: _exit> python /Users/maurits/.local/pipx/venvs/tox/lib/python3.11/site-packages/pyproject_api/_backend.py True setuptools.build_meta __legacy__
  circular: FAIL code 1 (5.73 seconds)
  evaluation failed :( (5.90 seconds)

I don't see what the conflict would be.

mauritsvanrees commented 10 months ago

This seems to work:

cd .tox/circular
bin/pip install Products.CMFPlone -c https://dist.plone.org/release/6.1-dev/constraints.txt

But this not:

$ bin/pip install -e ../../ -c https://dist.plone.org/release/6.1-dev/constraints.txt
ERROR: Cannot install plone-app-multilingual 8.0.2.dev0 (from /Users/maurits/community/plone-coredev/6.1/src/plone.app.multilingual) because these package versions have conflicting dependencies.

The conflict is caused by:
    The user requested plone-app-multilingual 8.0.2.dev0 (from /Users/maurits/community/plone-coredev/6.1/src/plone.app.multilingual)
    The user requested (constraint) plone-app-multilingual==8.0.1

It could be that tox -e circular gets confused and presents an unhelpful error message, and here we see the real problem.

Don't tell me we need mxdev... I hope tox has some more options.

gforcada commented 10 months ago

I'm afraid so, that we would need mxdev for such cases, constrains.txt or the logic to use it, does not allow to override new versions with development ones, that's the whole point of mxdev, or?

A fancy generator of constraints files that take into account your development packages so that pip can install them properly.

Maybe is worth to bring the topic back to pip developers?

gforcada commented 10 months ago

Another solution would be to improve pipforester like https://github.com/collective/pipforester/issues/6

jensens commented 2 months ago

The PLIP was merged and is closed now, so I close this one.