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

Restore PyYAML 5.4.1 to avoid TypeError in webassets 0.12.1 #113

Merged
merged 1 commit into from
Oct 4, 2023

Conversation

danielbreves
Copy link
Contributor

The patch to bump pyyaml to 6.0.1 introduced in https://github.com/keitaroinc/docker-ckan/pull/108/files#diff-132f494f7fa90591cc8efc8b166716154979ee515aa16ab9fd614f82b92a9f07R64 is raising an error when running the CKAN 2.9 image. CKAN 2.9.9 requires webassets 0.12.1, which calls yaml.load() without a Loader. This generated a warning in pyyaml 5.4.1, but raises a TypeError in 6.x. Unfortunately, there's an issue building PyYAML < 6.0.1 from source because it's not compatible with Cython 3, so this PR follows the workaround suggested in yaml/pyyaml#736 to create a constraint file that limits the Cython version to one that should work and restores pyyaml to 5.4.1.

Traceback (most recent call last):
  File "/usr/bin/ckan", line 8, in <module>
    sys.exit(ckan())
  File "/usr/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 781, in main
    with self.make_context(prog_name, args, **extra) as ctx:
  File "/usr/lib/python3.8/site-packages/click/core.py", line 700, in make_context
    self.parse_args(ctx, args)
  File "/srv/app/src/ckan/ckan/cli/cli.py", line 116, in parse_args
    result = super(ExtendableGroup, self).parse_args(ctx, args)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 1212, in parse_args
    rest = Command.parse_args(self, ctx, args)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 1048, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 1630, in handle_parse_result
    value = invoke_param_callback(self.callback, ctx, self, value)
  File "/usr/lib/python3.8/site-packages/click/core.py", line 123, in invoke_param_callback
    return callback(ctx, param, value)
  File "/srv/app/src/ckan/ckan/cli/cli.py", line 126, in _init_ckan_config
    _add_ctx_object(ctx, value)
  File "/srv/app/src/ckan/ckan/cli/cli.py", line 135, in _add_ctx_object
    ctx.obj = CtxObject(path)
  File "/srv/app/src/ckan/ckan/cli/cli.py", line 57, in __init__
    self.app = make_app(self.config)
  File "/srv/app/src/ckan/ckan/config/middleware/__init__.py", line 56, in make_app
    load_environment(conf)
  File "/srv/app/src/ckan/ckan/config/environment.py", line 123, in load_environment
    p.load_all()
  File "/srv/app/src/ckan/ckan/plugins/core.py", line 161, in load_all
    unload_all()
  File "/srv/app/src/ckan/ckan/plugins/core.py", line 208, in unload_all
    unload(*reversed(_PLUGINS))
  File "/srv/app/src/ckan/ckan/plugins/core.py", line 236, in unload
    plugins_update()
  File "/srv/app/src/ckan/ckan/plugins/core.py", line 153, in plugins_update
    environment.update_config()
  File "/srv/app/src/ckan/ckan/config/environment.py", line 172, in update_config
    webassets_init()
  File "/srv/app/src/ckan/ckan/lib/webassets_tools.py", line 67, in webassets_init
    create_library(u'vendor', os.path.join(
  File "/srv/app/src/ckan/ckan/lib/webassets_tools.py", line 28, in create_library
    library = YAMLLoader(config_path).load_bundles()
  File "/usr/lib/python3.8/site-packages/webassets/loaders.py", line 162, in load_bundles
    obj = self.yaml.load(f) or {}
TypeError: load() missing 1 required positional argument: 'Loader'

cc @Filip3mac

CKAN 2.9.9 requires webassets 0.12.1, which calls yaml.load() without a Loader. This generated a warning in pyyaml 5.4.1, but raises a TypeError in 6.x.
@danielbreves
Copy link
Contributor Author

Fixes keitaroinc/ckan-helm#101

@JasminaPN JasminaPN assigned JasminaPN and stojanovskis1 and unassigned JasminaPN Oct 3, 2023
Copy link
Contributor

@stojanovskis1 stojanovskis1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@stojanovskis1 stojanovskis1 merged commit a3a699c into keitaroinc:master Oct 4, 2023
5 checks passed
@danielbreves danielbreves deleted the patch-1 branch October 12, 2023 23:53
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.

4 participants