Skip to content
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

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

Closed
gforcada opened this issue Oct 15, 2023 · 10 comments
Closed

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

gforcada opened this issue Oct 15, 2023 · 10 comments

Comments

@gforcada
Copy link
Sponsor Member

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
Copy link
Sponsor Member

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:

  • Give up on trying to find and fix circular imports in 6.0. Change the circular imports check in plone/meta to use the 6.1 versions. But then plone/meta may need to be smart enough to see if a package branch is being used on 6.0 or on 6.1.
  • On the plone.app.multilingual 7.x branch remove Products.CMFPlone from the dependencies. This will cause z3c.dependencychecker to complain, so add it to the ignores.

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

@mauritsvanrees
Copy link
Sponsor Member

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
Copy link
Sponsor Member

We first need #3861

@mauritsvanrees
Copy link
Sponsor Member

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
Copy link
Sponsor Member

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
Copy link
Sponsor Member

Ah, adding constrain_package_deps = true in the circular tox env may help. See plone/meta#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
Copy link
Sponsor Member

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
Copy link
Sponsor Member Author

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
Copy link
Sponsor Member Author

Another solution would be to improve pipforester like collective/pipforester#6

mauritsvanrees added a commit to plone/plone.app.multilingual that referenced this issue Oct 19, 2023
With standard pip, we cannot both install ourselves in editable mode *and* use a constraints file that has a pin for our package.
With mxdev, we ignore this single pin.
See plone/Products.CMFPlone#3859 (comment)
gforcada pushed a commit to plone/plone.app.multilingual that referenced this issue Dec 22, 2023
With standard pip, we cannot both install ourselves in editable mode *and* use a constraints file that has a pin for our package.
With mxdev, we ignore this single pin.
See plone/Products.CMFPlone#3859 (comment)
gforcada pushed a commit to plone/plone.app.multilingual that referenced this issue Dec 22, 2023
With standard pip, we cannot both install ourselves in editable mode *and* use a constraints file that has a pin for our package.
With mxdev, we ignore this single pin.
See plone/Products.CMFPlone#3859 (comment)
mister-roboto pushed a commit to plone/buildout.coredev that referenced this issue Jan 7, 2024
Branch: refs/heads/master
Date: 2023-12-22T23:02:16+01:00
Author: Gil Forcada Codinachs (gforcada) <gil.gnome@gmail.com>
Commit: plone/plone.app.multilingual@3c685cd

Configuring with plone/meta

Files changed:
A .flake8
A .github/workflows/meta.yml
A news/dd37b9f9.internal
M .editorconfig
M .gitignore
M .meta.toml
M .pre-commit-config.yaml
M pyproject.toml
M tox.ini
Repository: plone.app.multilingual

Branch: refs/heads/master
Date: 2023-12-22T23:02:17+01:00
Author: Gil Forcada Codinachs (gforcada) <gil.gnome@gmail.com>
Commit: plone/plone.app.multilingual@ad61fdd

cleanup: remove options on setup.cfg

Files changed:
M setup.cfg
Repository: plone.app.multilingual

Branch: refs/heads/master
Date: 2023-12-22T23:02:17+01:00
Author: Gil Forcada Codinachs (gforcada) <gil.gnome@gmail.com>
Commit: plone/plone.app.multilingual@a294930

fix: adjust dependencies

Files changed:
M .meta.toml
M pyproject.toml
M setup.py
Repository: plone.app.multilingual

Branch: refs/heads/master
Date: 2023-12-22T23:02:17+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.app.multilingual@9fce2c8

Tox: use 6.1-dev constraints.

Files changed:
M tox.ini
Repository: plone.app.multilingual

Branch: refs/heads/master
Date: 2023-12-22T23:02:17+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.app.multilingual@e10287b

Removed duplicate Products.CMFPlone from install_requires.

Files changed:
M setup.py
Repository: plone.app.multilingual

Branch: refs/heads/master
Date: 2023-12-22T23:02:18+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.app.multilingual@3af60fb

Use mxdev in tox.

With standard pip, we cannot both install ourselves in editable mode *and* use a constraints file that has a pin for our package.
With mxdev, we ignore this single pin.
See plone/Products.CMFPlone#3859 (comment)

Files changed:
A mx.ini
A requirements.txt
M tox.ini
Repository: plone.app.multilingual

Branch: refs/heads/master
Date: 2023-12-22T23:05:11+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.app.multilingual@c8f77f5

Meta: extra git ignores and check-manifest ignores.

Applied and configured with latest plone/meta.
Afterwards, manually removed these lines from a few tox envs:

```
use_develop = true
skip_install = false
constrain_package_deps = true
```

And use 6.1-dev.

Files changed:
M .editorconfig
M .github/workflows/meta.yml
M .gitignore
M .meta.toml
M .pre-commit-config.yaml
M pyproject.toml
M tox.ini
Repository: plone.app.multilingual

Branch: refs/heads/master
Date: 2023-12-22T23:05:11+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.app.multilingual@58d1c52

Restore mxdev.

Files changed:
M tox.ini
Repository: plone.app.multilingual

Branch: refs/heads/master
Date: 2024-01-07T22:11:42+01:00
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org>
Commit: plone/plone.app.multilingual@6689689

Merge pull request #419 from plone/config-with-default-template-5bc28a6f

Config with default template

Files changed:
A .flake8
A .github/workflows/meta.yml
A mx.ini
A news/dd37b9f9.internal
A requirements.txt
M .editorconfig
M .gitignore
M .meta.toml
M .pre-commit-config.yaml
M pyproject.toml
M setup.cfg
M tox.ini
@jensens
Copy link
Sponsor Member

jensens commented Jun 12, 2024

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

@jensens jensens closed this as completed Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants