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

Pin markupsafe for Jinja2 workaround #1804

Merged
merged 2 commits into from
Mar 1, 2022
Merged

Conversation

ebeahan
Copy link
Member

@ebeahan ebeahan commented Mar 1, 2022

Recently, Markupsafe released version 2.1.0, and the change now causes versions of Jinja2 2.x to throw an exception when running the generator script:

ImportError: cannot import name 'soft_unicode' from 'markupsafe'

A more recent version of Jinja2 resolves the issue: #1782.

Bumping a dependency to the next major for previous ECS releases feels excessive. However, new installs and CI for any backport to an older branch will fail without a fix.

The following branches will have markupsafe==2.0.1 pinned in their requirements files:

  • 8.0 -> 8.0.1 will be released including the fix.
  • 1.12
  • 1.11
  • 1.10
  • 1.9
  • 1.8
  • 1.7
  • 1.6

Branches pre-1.6. did not use Jinja2 as a dependency, so they are not affected.

@ebeahan ebeahan self-assigned this Mar 1, 2022
@ebeahan ebeahan requested a review from kgeller March 1, 2022 17:39
@ebeahan ebeahan merged commit 8a2318b into elastic:8.0 Mar 1, 2022
@ebeahan ebeahan deleted the fix/pin-markupsafe branch March 1, 2022 20:51
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)

# Conflicts:
#	CHANGELOG.next.md
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)

# Conflicts:
#	scripts/requirements.txt
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)

# Conflicts:
#	CHANGELOG.next.md
#	scripts/requirements.txt
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)

# Conflicts:
#	scripts/requirements.txt
@ebeahan
Copy link
Member Author

ebeahan commented Mar 1, 2022

💚 All backports created successfully

Status Branch Result
1.12
1.11
1.10
1.9
1.8
1.7
1.6

Questions ?

Please refer to the Backport tool documentation

ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)

# Conflicts:
#	CHANGELOG.next.md
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)

# Conflicts:
#	CHANGELOG.next.md
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)

# Conflicts:
#	CHANGELOG.next.md
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)

# Conflicts:
#	CHANGELOG.next.md
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)

# Conflicts:
#	scripts/requirements.txt
ebeahan added a commit to ebeahan/ecs that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)

# Conflicts:
#	scripts/requirements.txt
ebeahan added a commit that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)
ebeahan added a commit that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)
ebeahan added a commit that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)
ebeahan added a commit that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)
ebeahan added a commit that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)
ebeahan added a commit that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)
ebeahan added a commit that referenced this pull request Mar 1, 2022
* pin markupsafe version

* add changelog

(cherry picked from commit 8a2318b)
chosak added a commit to chosak/wagtail that referenced this pull request Apr 4, 2022
MarkupSafe release 2.10 [0] removed method `soft_unicode`. Jinja2
version 2.11.3 doesn't put an upper bound on its MarkupSafe dependency
[1], so pulls in this changed version of MarkupSafe.

The Wagtail tests specify a Jinja2 version >=2.11,<3.0, so they try
to import Jinja2 2.11.3 and MarkupSafe 2.1.1. These versions are
incompatible due to the removal of `soft_unicode`, producing this
error:

> ImportError: cannot import name 'soft_unicode' from 'markupsafe'

This fails CI, for example [2].

This change adds an upper bound to Wagtail's import of MarkupSafe,
which allows the tests to pass.

Relevant MarkupSafe issue discussing the deprecation: [3]
Comparable project choosing to similarly pin MarkupSafe: [4]

[0] https://markupsafe.palletsprojects.com/en/2.1.x/changes/#version-2-1-0
[1] https://github.com/pallets/jinja/blob/cf215390d4a4d6f0a4de27e2687eed176878f13d/setup.py#L53
[2] https://github.com/wagtail/wagtail/runs/5793338719?check_suite_focus=true
[3] pallets/markupsafe#286
[4] elastic/ecs#1804
chosak added a commit to chosak/wagtail that referenced this pull request Apr 4, 2022
MarkupSafe release 2.1.0 [0] removed method `soft_unicode`. Jinja2
version 2.11.3 doesn't put an upper bound on its MarkupSafe dependency
[1], so pulls in this changed version of MarkupSafe.

The Wagtail tests specify a Jinja2 version >=2.11,<3.0, so they try
to import Jinja2 2.11.3 and MarkupSafe 2.1.1. These versions are
incompatible due to the removal of `soft_unicode`, producing this
error:

> ImportError: cannot import name 'soft_unicode' from 'markupsafe'

This fails CI, for example [2].

This change adds an upper bound to Wagtail's import of MarkupSafe,
which allows the tests to pass.

Relevant MarkupSafe issue discussing the deprecation: [3]
Comparable project choosing to similarly pin MarkupSafe: [4]

[0] https://markupsafe.palletsprojects.com/en/2.1.x/changes/#version-2-1-0
[1] https://github.com/pallets/jinja/blob/cf215390d4a4d6f0a4de27e2687eed176878f13d/setup.py#L53
[2] https://github.com/wagtail/wagtail/runs/5793338719?check_suite_focus=true
[3] pallets/markupsafe#286
[4] elastic/ecs#1804
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

Successfully merging this pull request may close these issues.

2 participants