cookiecutter-pypackage icon indicating copy to clipboard operation
cookiecutter-pypackage copied to clipboard

ImportError: cannot import name 'contextfunction' from 'jinja2'

Open jerinpetergeorge opened this issue 2 years ago • 1 comments

  • Date you used Cookiecutter PyPackage: 2023-01-03
  • Cookiecutter version used, if any:
  • Python version, if any: Python 3.8 (GH Action environment)
  • Operating System: Ubuntu 18.04 (GH Action environment)

Description

Created the package with default options, this is how I made the package,

╰─λ cookiecutter https://github.com/waynerv/cookiecutter-pypackage.git                                                                                                                                                   0 (0.021s) < 12:27:18
You've downloaded /home/jpg/.cookiecutters/cookiecutter-pypackage before. Is it okay to delete and re-download it? [yes]: yes
project_name [Python Boilerplate]: Django App Conf
project_slug [django-app-conf]: 
pkg_name [django_app_conf]: 
project_short_description [Skeleton project created by Cookiecutter PyPackage]: 
full_name [Xie Wei]: Jerin Peter George
email [[email protected]]: [email protected]
github_username [waynerv]: jerinpetergeorge
version [0.1.0]: 
Select command_line_interface:
1 - Click
2 - No command-line interface
Choose from 1, 2 [1]: 
Select open_source_license:
1 - MIT
2 - BSD-3-Clause
3 - ISC
4 - Apache-2.0
5 - GPL-3.0-only
6 - Not open source
Choose from 1, 2, 3, 4, 5, 6 [1]: 
Select docstrings_style:
1 - google
2 - numpy
3 - pep257
Choose from 1, 2, 3 [1]: 
use_mypy [y]:  
install_precommit_hooks [y]: 

Then, I pushed the code to GH (without running the tox or anything on my local machine). But, the CI has failed with the following error message ( see the full error log) -

ImportError: cannot import name 'contextfunction' from 'jinja2'

I expect the CI to be completed without any errors.

jerinpetergeorge avatar Jan 03 '23 07:01 jerinpetergeorge

This issue got resolved by adding jinja2 = {version = "<3.1.0", optional = true} to the pyproject.toml. Not sure if that is the best way to avoid the issue

jerinpetergeorge avatar Jan 03 '23 08:01 jerinpetergeorge