hdmf-dev / hdmf-docutils

Collection of CLIs, scripts and modules useful to generate HDMF/NWB schema documentation
Other
0 stars 3 forks source link

YAML error: "dump()" has been removed #83

Closed rly closed 1 year ago

rly commented 1 year ago

In ndx-hed, running the command:

sphinx-build -b linkcheck ./source ./test_build

results in:

Extension error:
Handler <function run_doc_autogen at 0x103403ba0> for event 'builder-inited' threw an exception (exception: 
"dump()" has been removed, use

  yaml = YAML(typ='unsafe', pure=True)
  yaml.dump(...)

instead of file "/Users/rly/mambaforge/envs/ndx-hed/lib/python3.11/site-packages/hdmf_docutils/doctools/rst.py", line 299

            return yaml.dump(clean_spec, default_flow_style=False)

)

The latest ruamel.yaml is 0.18.0 which removes the dump() function:

As announced, in 0.18.0, the old PyYAML functions have been deprecated. (scan, parse, compose, load, emit, serialize, dump and their variants (all, safe, roundtrip, etc)). If you only read this after your program has stopped working: I am sorry to hear that, but that also means you, or the person developing your program, has not tested with warnings on (which is the recommendation in PEP 565, and e.g. defaultin when using pytest).

Pip environment:

Package                       Version      Editable project location
----------------------------- ------------ --------------------------------
alabaster                     0.7.13
attrs                         23.1.0
Babel                         2.13.1
black                         23.9.1
cachetools                    5.3.2
certifi                       2023.7.22
cfgv                          3.4.0
chardet                       5.2.0
charset-normalizer            3.3.1
click                         8.1.7
codespell                     2.2.6
colorama                      0.4.6
contourpy                     1.1.1
coverage                      7.3.2
cycler                        0.12.1
distlib                       0.3.7
docutils                      0.18.1
filelock                      3.12.4
fonttools                     4.43.1
h5py                          3.10.0
hdmf                          3.10.0
hdmf-docutils                 0.4.5
identify                      2.5.30
idna                          3.4
imagesize                     1.4.1
iniconfig                     2.0.0
Jinja2                        3.1.2
jsonschema                    4.19.1
jsonschema-specifications     2023.7.1
kiwisolver                    1.4.5
MarkupSafe                    2.1.3
matplotlib                    3.8.0
mypy-extensions               1.0.0
ndx-hed                       0.1.0        /Users/rly/Documents/NWB/ndx-hed
networkx                      3.2
nodeenv                       1.8.0
numpy                         1.26.1
packaging                     23.2
pandas                        2.1.1
pathspec                      0.11.2
Pillow                        10.1.0
pip                           23.3.1
platformdirs                  3.11.0
pluggy                        1.3.0
pre-commit                    3.4.0
Pygments                      2.16.1
pynwb                         2.5.0
pyparsing                     3.1.1
pyproject-api                 1.6.1
pytest                        7.4.2
pytest-cov                    4.1.0
pytest-subtests               0.6.0
python-dateutil               2.8.2
pytz                          2023.3.post1
PyYAML                        6.0.1
referencing                   0.30.2
requests                      2.31.0
rpds-py                       0.10.6
ruamel.yaml                   0.18.2
ruamel.yaml.clib              0.2.8
ruff                          0.0.292
scipy                         1.11.3
setuptools                    68.2.2
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        7.2.6
sphinx-gallery                0.14.0
sphinx-rtd-theme              1.3.0
sphinxcontrib-applehelp       1.0.7
sphinxcontrib-devhelp         1.0.5
sphinxcontrib-htmlhelp        2.0.4
sphinxcontrib-jquery          4.1
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.6
sphinxcontrib-serializinghtml 1.1.9
tox                           4.11.3
tzdata                        2023.3
urllib3                       2.0.7
virtualenv                    20.24.6
wheel                         0.41.2
rly commented 1 year ago

dump now requires a stream and does not return a string by default. See this doc for a workaround: https://yaml.readthedocs.io/en/latest/example/#output-of-dump-as-a-string