diff options
-rw-r--r-- | .appveyor.yaml | 30 | ||||
-rw-r--r-- | CHANGES | 13 | ||||
-rw-r--r-- | LICENSE | 2 | ||||
-rw-r--r-- | README.rst | 22 | ||||
-rw-r--r-- | __init__.py | 6 | ||||
-rw-r--r-- | _doc/_static/pypi.svg | 2 | ||||
-rw-r--r-- | _doc/dumpcls.ryd | 2 | ||||
-rw-r--r-- | _test/test_comments.py | 4 | ||||
-rw-r--r-- | constructor.py | 1 | ||||
-rw-r--r-- | emitter.py | 7 | ||||
-rw-r--r-- | setup.py | 30 |
11 files changed, 64 insertions, 55 deletions
diff --git a/.appveyor.yaml b/.appveyor.yaml deleted file mode 100644 index 4f53ba4..0000000 --- a/.appveyor.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# based on: https://packaging.python.org/guides/supporting-windows-using-appveyor/ - -environment: - matrix: - - PYTHON: C:\Python27 - - PYTHON: C:\Python27-x64 - - PYTHON: C:\Python35 - - PYTHON: C:\Python35-x64 - - PYTHON: C:\Python36 - - PYTHON: C:\Python36-x64 - - PYTHON: C:\Python37 - - PYTHON: C:\Python37-x64 - -install: - - | - %PYTHON%\python.exe -m pip install --upgrade -q pip wheel setuptools - %PYTHON%\python.exe -m pip list --format columns - -# only used when compiling (for Python with C extensions this is done in the after_test) -build: off - -test_script: - - echo Skipped for now - -after_test: - - | - %PYTHON%\python.exe setup.py bdist_wheel - -artifacts: - - path: dist\* @@ -1,3 +1,16 @@ +[0, 16, 13]: 2021-03-05 + - fix for issue 359: could not update() CommentedMap with keyword arguments + (reported by `Steve Franchak <https://sourceforge.net/u/binaryadder/>`__) + - fix for issue 365: unable to dump mutated TimeStamp objects + (reported by Anton Akmerov <https://sourceforge.net/u/akhmerov/>`__) + - fix for issue 371: unable to addd comment without starting space + (reported by 'Mark Grandi <https://sourceforge.net/u/mgrandi>`__) + - fix for issue 373: recursive call to walk_tree not preserving all params + (reported by `eulores <https://sourceforge.net/u/eulores/>`__) + - a None value in a flow-style sequence is now dumped as `null` instead + of `!!null ''` (reported by mcarans on + `StackOverlow <https://stackoverflow.com/a/66489600/1307905>`__) + [0, 16, 12]: 2020-09-04 - update links in doc @@ -1,6 +1,6 @@ The MIT License (MIT) - Copyright (c) 2014-2020 Anthon van der Neut, Ruamel bvba + Copyright (c) 2014-2021 Anthon van der Neut, Ruamel bvba Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -4,12 +4,19 @@ ruamel.yaml ``ruamel.yaml`` is a YAML 1.2 loader/dumper package for Python. -:version: 0.16.12 -:updated: 2020-09-04 +:version: 0.16.13 +:updated: 2021-03-05 :documentation: http://yaml.readthedocs.io :repository: https://sourceforge.net/projects/ruamel-yaml/ :pypi: https://pypi.org/project/ruamel.yaml/ +*The 0.16.13 release is the last that will tested to be working on Python 2.7. +The 0.17 series will still be tested on Python 3.5, but the 0.18 will not. The +0.17 series will also stop support for the old PyYAML functions, so a `YAML()` instance +will need to be created.* + +*Please adjust your dependencies accordingly if necessary.* + Starting with version 0.15.0 the way YAML files are loaded and dumped is changing. See the API doc for details. Currently existing @@ -54,9 +61,18 @@ ChangeLog .. should insert NEXT: at the beginning of line for next key (with empty line) -NEXT: +0.16.13 (2021-03-05): - fix for issue 359: could not update() CommentedMap with keyword arguments (reported by `Steve Franchak <https://sourceforge.net/u/binaryadder/>`__) + - fix for issue 365: unable to dump mutated TimeStamp objects + (reported by Anton Akmerov <https://sourceforge.net/u/akhmerov/>`__) + - fix for issue 371: unable to addd comment without starting space + (reported by 'Mark Grandi <https://sourceforge.net/u/mgrandi>`__) + - fix for issue 373: recursive call to walk_tree not preserving all params + (reported by `eulores <https://sourceforge.net/u/eulores/>`__) + - a None value in a flow-style sequence is now dumped as `null` instead + of `!!null ''` (reported by mcarans on + `StackOverlow <https://stackoverflow.com/a/66489600/1307905>`__) 0.16.12 (2020-09-04): - update links in doc diff --git a/__init__.py b/__init__.py index 5bd0d3d..7964157 100644 --- a/__init__.py +++ b/__init__.py @@ -7,8 +7,8 @@ if False: # MYPY _package_data = dict( full_package_name='ruamel.yaml', - version_info=(0, 16, 12), - __version__='0.16.12', + version_info=(0, 16, 13), + __version__='0.16.13', author='Anthon van der Neut', author_email='a.van.der.neut@ruamel.eu', description='ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of comments, seq/map flow style, and map key order', # NOQA @@ -16,7 +16,7 @@ _package_data = dict( since=2014, extras_require={ ':platform_python_implementation=="CPython" and python_version<="2.7"': ['ruamel.ordereddict'], # NOQA - ':platform_python_implementation=="CPython" and python_version<"3.9"': ['ruamel.yaml.clib>=0.1.2'], # NOQA + ':platform_python_implementation=="CPython" and python_version<"3.10"': ['ruamel.yaml.clib>=0.1.2'], # NOQA 'jinja2': ['ruamel.yaml.jinja2>=0.2'], 'docs': ['ryd'], }, diff --git a/_doc/_static/pypi.svg b/_doc/_static/pypi.svg index 89b8585..7bce1f4 100644 --- a/_doc/_static/pypi.svg +++ b/_doc/_static/pypi.svg @@ -1 +1 @@ -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="86" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="86" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h33v20H0z"/><path fill="#007ec6" d="M33 0h53v20H33z"/><path fill="url(#b)" d="M0 0h86v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="175" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="230">pypi</text><text x="175" y="140" transform="scale(.1)" textLength="230">pypi</text><text x="585" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">0.16.12</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.16.12</text></g> </svg> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="86" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="86" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h33v20H0z"/><path fill="#007ec6" d="M33 0h53v20H33z"/><path fill="url(#b)" d="M0 0h86v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="175" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="230">pypi</text><text x="175" y="140" transform="scale(.1)" textLength="230">pypi</text><text x="585" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">0.16.13</text><text x="585" y="140" transform="scale(.1)" textLength="430">0.16.13</text></g> </svg> diff --git a/_doc/dumpcls.ryd b/_doc/dumpcls.ryd index 6a5e86c..929d5f5 100644 --- a/_doc/dumpcls.ryd +++ b/_doc/dumpcls.ryd @@ -40,7 +40,7 @@ The tag ``!User`` originates from the name of the class. You can specify a different tag by adding the attribute ``yaml_tag``, and explicitly specify dump and/or load *classmethods* which have to be called -``from_yaml`` resp. ``from_yaml``:: +``to_yaml`` resp. ``from_yaml``:: --- !python | import sys diff --git a/_test/test_comments.py b/_test/test_comments.py index 31ab2a6..79acfc8 100644 --- a/_test/test_comments.py +++ b/_test/test_comments.py @@ -307,8 +307,8 @@ class TestComments: """ d = round_trip_load(x) assert d.mlget(['a', 1, 'd', 'f'], list_ok=True) == 196 - with pytest.raises(AssertionError): - d.mlget(['a', 1, 'd', 'f']) == 196 + # with pytest.raises(AssertionError): + # d.mlget(['a', 1, 'd', 'f']) == 196 class TestInsertPopList: diff --git a/constructor.py b/constructor.py index ddd2915..3b16fe5 100644 --- a/constructor.py +++ b/constructor.py @@ -1728,6 +1728,7 @@ class RoundTripConstructor(SafeConstructor): delta = datetime.timedelta(hours=tz_hour, minutes=tz_minute) if values['tz_sign'] == '-': delta = -delta + # shold check for NOne and solve issue 366 should be tzinfo=delta) if delta: dt = datetime.datetime(year, month, day, hour, minute) dt -= delta @@ -206,6 +206,8 @@ class Emitter(object): self.scalar_after_indicator = True # write a scalar on the same line as `---` + self.alt_null = 'null' + @property def stream(self): # type: () -> Any @@ -799,6 +801,11 @@ class Emitter(object): if isinstance(self.event, ScalarEvent): if self.style is None: self.style = self.choose_scalar_style() + if self.event.value == '' and self.style == "'" and \ + tag == 'tag:yaml.org,2002:null' and self.alt_null is not None: + self.event.value = self.alt_null + self.analysis = None + self.style = self.choose_scalar_style() if (not self.canonical or tag is None) and ( (self.style == "" and self.event.implicit[0]) or (self.style != "" and self.event.implicit[1]) @@ -323,17 +323,17 @@ class NameSpacePackager(object): self.command = None self.python_version() self._pkg = [None, None] # required and pre-installable packages - if ( - sys.argv[0] == 'setup.py' - and sys.argv[1] == 'install' - and '--single-version-externally-managed' not in sys.argv - ): - if os.environ.get('READTHEDOCS', None) == 'True': - os.system('pip install .') - sys.exit(0) - if not os.environ.get('RUAMEL_NO_PIP_INSTALL_CHECK', False): - print('error: you have to install with "pip install ."') - sys.exit(1) + if sys.argv[0] == 'setup.py' and sys.argv[1] == 'install': + debug('calling setup.py', sys.argv) + if '-h' in sys.argv: + pass + elif '--single-version-externally-managed' not in sys.argv: + if os.environ.get('READTHEDOCS', None) == 'True': + os.system('pip install .') + sys.exit(0) + if not os.environ.get('RUAMEL_NO_PIP_INSTALL_CHECK', False): + print('error: you have to install with "pip install ."') + sys.exit(1) # If you only support an extension module on Linux, Windows thinks it # is pure. That way you would get pure python .whl files that take # precedence for downloading on Linux over source with compilable C code @@ -799,8 +799,8 @@ class NameSpacePackager(object): try: tmp_dir = tempfile.mkdtemp(prefix='tmp_ruamel_') bin_file_name = 'test' + self.pn(target['name']) - print('test compiling', bin_file_name) file_name = os.path.join(tmp_dir, bin_file_name + '.c') + print('test compiling', file_name, '->', bin_file_name, end=' ') with open(file_name, 'w') as fp: # write source fp.write(c_code) # and try to compile it @@ -824,15 +824,17 @@ class NameSpacePackager(object): except CompileError: debug('compile error:', file_name) print('compile error:', file_name) - continue + raise except LinkError: debug('link error', file_name) print('link error', file_name) - continue + raise + print('OK') self._ext_modules.append(ext) except Exception as e: # NOQA debug('Exception:', e) print('Exception:', e) + sys.exit(1) if sys.version_info[:2] == (3, 4) and platform.system() == 'Windows': traceback.print_exc() finally: |