waynerv / cookiecutter-pypackage

A tool for creating skeleton python project, built with popular develop tools and conform to best practice.
https://waynerv.github.io/cookiecutter-pypackage/
BSD 3-Clause "New" or "Revised" License
114 stars 70 forks source link

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

Open jerinpetergeorge opened 1 year ago

jerinpetergeorge commented 1 year ago

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 [ampedee@gmail.com]: jerinpetergeorge@gmail.com
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 commented 1 year ago

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