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

Running makejinja in alpine docker container results in error #192

Closed
CubicrootXYZ opened this issue Sep 1, 2024 · 3 comments
Closed

Running makejinja in alpine docker container results in error #192

CubicrootXYZ opened this issue Sep 1, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@CubicrootXYZ
Copy link

Describe the bug

Running makejinja in an alpine docker container results in AttributeError: 'Converter' object has no attribute '_structure_list'

To Reproduce
Steps to reproduce the behavior:

  1. Use the following Dockerfile to build an image with docker build -t jinjatest .:
    FROM python:3.9-alpine
    
    WORKDIR /app
    
    RUN pip install makejinja
    
  2. Run docker run -it jinjatest makejinja

Expected behavior

Help menu appearing.

Additional Information

Full output:

$ docker run -it jinjatest makejinja
Traceback (most recent call last):
  File "/usr/local/bin/makejinja", line 5, in <module>
    from makejinja.cli import makejinja_cli
  File "/usr/local/lib/python3.9/site-packages/makejinja/__init__.py", line 1, in <module>
    from . import config, loader
  File "/usr/local/lib/python3.9/site-packages/makejinja/config.py", line 5, in <module>
    import typed_settings as ts
  File "/usr/local/lib/python3.9/site-packages/typed_settings/__init__.py", line 6, in <module>
    from ._core import default_loaders, load, load_settings
  File "/usr/local/lib/python3.9/site-packages/typed_settings/_core.py", line 11, in <module>
    from .attrs import METADATA_KEY
  File "/usr/local/lib/python3.9/site-packages/typed_settings/attrs/__init__.py", line 21, in <module>
    from .hooks import auto_convert
  File "/usr/local/lib/python3.9/site-packages/typed_settings/attrs/hooks.py", line 98, in <module>
    auto_convert = make_auto_converter(default_converter())
  File "/usr/local/lib/python3.9/site-packages/typed_settings/converters.py", line 40, in default_converter
    register_strlist_hook(converter, ":")
  File "/usr/local/lib/python3.9/site-packages/typed_settings/converters.py", line 109, in register_strlist_hook
    (is_sequence, converter._structure_list),
AttributeError: 'Converter' object has no attribute '_structure_list'
@CubicrootXYZ CubicrootXYZ added the bug Something isn't working label Sep 1, 2024
@mirkolenz
Copy link
Owner

Hi! The error you are facing is an issue with makejinja's dependency typed-settings. It uses cattrs without an upper version bound, and with the release of cattrs v24, this error is thrown. It is already fixed upstream (https://gitlab.com/sscherfke/typed-settings/-/merge_requests/40), but these changes are yet to be published in an official release.

Also please note that the Docker base image python:3.9-alpine will get you an outdated version of makejinja. Since about a year or so, we only support Python 3.11 and up, so you will likely want to use a newer Python version.

We even provide an official Docker image (https://github.com/mirkolenz/makejinja/pkgs/container/makejinja) that you can directly pull and run. The image should also be unaffected by the changes to cattrs because we pin all dependencies in a lock-file. More instructions can be found in makejinja's README.

Hope this helps! If so, feel free to close the issue 😄

@mirkolenz
Copy link
Owner

typed-settings v24.5.0 has just been released and contains the fix for cattrs v24.

@CubicrootXYZ
Copy link
Author

Thanks a lot for the detailed explanation, I can confirm it working with python 3.11. I appreciated your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants