question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[REQUEST] Update commitizen to support Jinja2's latest version for flaskv2.

See original GitHub issue

Description

Steps to reproduce

  1. Install flask.
  2. Install commitizen.

Commitizen with poetry breaks dependencies because commitizen requires Jinja2 lower than v3. Flaskv2 requires us to use of Jinja2 v3.

Current behavior downgrading commitizen does not seem to be working.

❯ poetry add commitizen@2.17.0 --dev

Updating dependencies
Resolving dependencies... (1.8s)

  SolverProblemError

  Because commitizen (2.17.0) depends on jinja2 (>=2.10.3,<3.0.0)
   and flask (2.0.1) depends on Jinja2 (>=3.0), commitizen (2.17.0) is incompatible with flask (2.0.1).
  And because no versions of flask match >2.0.1,<3.0.0, commitizen (2.17.0) is incompatible with Flask (>=2.0.1,<3.0.0).
  So, because XXX depends on both Flask (^2.0.1) and commitizen (2.17.0), version solving failed.

  at ~/.poetry/lib/poetry/puzzle/solver.py:241 in _solve
      237β”‚             packages = result.packages
      238β”‚         except OverrideNeeded as e:
      239β”‚             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240β”‚         except SolveFailure as e:
    β†’ 241β”‚             raise SolverProblemError(e)
      242β”‚ 
      243β”‚         results = dict(
      244β”‚             depth_first_search(
      245β”‚                 PackageNode(self._package, packages), aggregate_package_nodes
❯ poetry add commitizen@2.16.0 --dev

Updating dependencies
Resolving dependencies... (0.3s)

  SolverProblemError

  Because commitizen (2.16.0) depends on jinja2 (>=2.10.3,<3.0.0)
   and flask (2.0.1) depends on Jinja2 (>=3.0), commitizen (2.16.0) is incompatible with flask (2.0.1).
  And because no versions of flask match >2.0.1,<3.0.0, commitizen (2.16.0) is incompatible with Flask (>=2.0.1,<3.0.0).
  So, because XXX depends on both Flask (^2.0.1) and commitizen (2.16.0), version solving failed.

  at ~/.poetry/lib/poetry/puzzle/solver.py:241 in _solve
      237β”‚             packages = result.packages
      238β”‚         except OverrideNeeded as e:
      239β”‚             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240β”‚         except SolveFailure as e:
    β†’ 241β”‚             raise SolverProblemError(e)
      242β”‚ 
      243β”‚         results = dict(
      244β”‚             depth_first_search(
      245β”‚                 PackageNode(self._package, packages), aggregate_package_nodes
❯ poetry add commitizen@2.15.0 --dev

Updating dependencies
Resolving dependencies... (0.9s)

  SolverProblemError

  Because commitizen (2.15.0) depends on jinja2 (>=2.10.3,<3.0.0)
   and flask (2.0.1) depends on Jinja2 (>=3.0), commitizen (2.15.0) is incompatible with flask (2.0.1).
  And because no versions of flask match >2.0.1,<3.0.0, commitizen (2.15.0) is incompatible with Flask (>=2.0.1,<3.0.0).
  So, because XXX depends on both Flask (^2.0.1) and commitizen (2.15.0), version solving failed.

  at ~/.poetry/lib/poetry/puzzle/solver.py:241 in _solve
      237β”‚             packages = result.packages
      238β”‚         except OverrideNeeded as e:
      239β”‚             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240β”‚         except SolveFailure as e:
    β†’ 241β”‚             raise SolverProblemError(e)
      242β”‚ 
      243β”‚         results = dict(
      244β”‚             depth_first_search(
      245β”‚                 PackageNode(self._package, packages), aggregate_package_nodes
❯ poetry add commitizen@2.10.0 --dev

Updating dependencies
Resolving dependencies... (0.4s)

  SolverProblemError

  Because commitizen (2.10.0) depends on jinja2 (>=2.10.3,<3.0.0)
   and flask (2.0.1) depends on Jinja2 (>=3.0), commitizen (2.10.0) is incompatible with flask (2.0.1).
  And because no versions of flask match >2.0.1,<3.0.0, commitizen (2.10.0) is incompatible with Flask (>=2.0.1,<3.0.0).
  So, because XXX depends on both Flask (^2.0.1) and commitizen (2.10.0), version solving failed.

  at ~/.poetry/lib/poetry/puzzle/solver.py:241 in _solve
      237β”‚             packages = result.packages
      238β”‚         except OverrideNeeded as e:
      239β”‚             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240β”‚         except SolveFailure as e:
    β†’ 241β”‚             raise SolverProblemError(e)
      242β”‚ 
      243β”‚         results = dict(
      244β”‚             depth_first_search(
      245β”‚                 PackageNode(self._package, packages), aggregate_package_nodes
❯ poetry add commitizen@2.0 --dev

Updating dependencies
Resolving dependencies... (0.5s)

  SolverProblemError

  Because commitizen (2.0.0) depends on jinja2 (>=2.10.3,<3.0.0)
   and flask (2.0.1) depends on Jinja2 (>=3.0), commitizen (2.0.0) is incompatible with flask (2.0.1).
  And because no versions of flask match >2.0.1,<3.0.0, commitizen (2.0.0) is incompatible with Flask (>=2.0.1,<3.0.0).
  So, because XXX depends on both Flask (^2.0.1) and commitizen (2.0), version solving failed.

  at ~/.poetry/lib/poetry/puzzle/solver.py:241 in _solve
      237β”‚             packages = result.packages
      238β”‚         except OverrideNeeded as e:
      239β”‚             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240β”‚         except SolveFailure as e:
    β†’ 241β”‚             raise SolverProblemError(e)
      242β”‚ 
      243β”‚         results = dict(
      244β”‚             depth_first_search(
      245β”‚                 PackageNode(self._package, packages), aggregate_package_nodes

Desired behavior

We should be able to use commitizen with any version of flask or jinja2.

Environment

Currently, the only workaround is to remove flask and install commitizen before installing flask. This would result in use up using flask v1.1.4 instead of v2.0.1.

  • commitizen version: ❯ cz version 2.17.9
  • python version: ❯ python -V Python 3.9.4
  • operating system: ❯ python3 -c β€œimport platform; print(platform.system())” Darwin

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
woilecommented, Jun 21, 2021

Please check the PR if possible

0reactions
rlam3commented, Jun 25, 2021

Yes this works now.

@Woile Thank you!

Seems like I had to do the following to get it installed correctly in poetry.

poetry remove commitizen
poetry add commitizen --dev
Read more comments on GitHub >

github_iconTop Results From Across the Web

The commitizen command line utility. #BlackLivesMatter
Retrying failed commits. As of version 2.7.1, you may attempt to retry the last commit using the git cz --retry command. This can...
Read more >
Commitizen
Command-line utility to create commits with your rules. Defaults: Conventional commits Β· Display information about your commit rules (commands: schema, example,Β ...
Read more >
Changes β€” Flask Documentation (2.2.x)
Update Werkzeug dependency to >= 2.2. The app and request contexts are managed using Python context vars directly rather than Werkzeug's LocalStack ....
Read more >
Automate JavaScript project versioning with commitizen and ...
After we have configured standardised commits using commitizen and git-cz , we can now setup automate versioning, update CHANGELOG.md, and gitΒ ...
Read more >
Writing conventional commits with commitizen - Egghead.io
[00:31] The type here is how semantic release knows whether to update your minor version if you specify feature, or a patch version...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found