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

[Bug]: Replace yaml.safe_load after update to ruamel.yaml #1007

Closed
rly opened this issue Dec 7, 2023 · 0 comments · Fixed by #1008
Closed

[Bug]: Replace yaml.safe_load after update to ruamel.yaml #1007

rly opened this issue Dec 7, 2023 · 0 comments · Fixed by #1008
Assignees
Labels
category: bug errors in the code or code behavior priority: medium non-critical problem and/or affecting only a small set of users

Comments

@rly
Copy link
Contributor

rly commented Dec 7, 2023

What happened?

ruamel.yaml.safe_load was deprecated years ago and finally removed in the latest version of ruamel.yaml. Running validate_hdmf_spec with that version installed causes an error.

Steps to Reproduce

Download nwb-schema repo from https://github.com/NeurodataWithoutBorders/nwb-schema
and run `validate_hdmf_spec core -m nwb.schema.json`

Traceback

Run validate_hdmf_spec core -m nwb.schema.json
  validate_hdmf_spec core -m nwb.schema.json
  shell: /usr/bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.12.0/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.0/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.0/x64
    Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.0/x64
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.0/x64
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.0/x64/lib
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.12.0/x64/bin/validate_hdmf_spec", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/hdmf/testing/validate_spec.py", line 52, in main
    validate_spec(ipath, args.metaschema)
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/hdmf/testing/validate_spec.py", line 35, in validate_spec
    instance = yaml.safe_load(f_nwb)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/ruamel/yaml/main.py", line 1105, in safe_load
    error_deprecation('safe_load', 'load', arg="typ='safe', pure=True")
  File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/ruamel/yaml/main.py", line 1039, in error_deprecation
    raise AttributeError(s, name=None)
AttributeError: 
"safe_load()" has been removed, use

  yaml = YAML(typ='safe', pure=True)
  yaml.load(...)

instead of file "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/hdmf/testing/validate_spec.py", line 35

    instance = yaml.safe_load(f_nwb)


### Operating System

macOS

### Python Executable

Conda

### Python Version

3.12

### Package Versions

_No response_
@rly rly mentioned this issue Dec 7, 2023
4 tasks
@rly rly self-assigned this Dec 7, 2023
@rly rly added category: bug errors in the code or code behavior priority: medium non-critical problem and/or affecting only a small set of users labels Dec 7, 2023
@rly rly closed this as completed in #1008 Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug errors in the code or code behavior priority: medium non-critical problem and/or affecting only a small set of users
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant