From cc3ea0b3029f9494590a291ac2746712cbf5bea0 Mon Sep 17 00:00:00 2001 From: svalouch Date: Fri, 26 Nov 2021 12:37:19 +0100 Subject: [PATCH] Release v0.0.3 --- CHANGELOG.md | 10 +++++++-- docs/CHANGELOG.md | 1 + docs/api.rst | 3 +++ docs/conf.py | 10 +++++---- docs/guide.rst | 4 ++-- docs/index.rst | 8 +------- docs/requirements.txt | 3 --- setup.py | 9 ++++++--- src/simplezfs/zfs.py | 47 ++++++++++++++----------------------------- 9 files changed, 42 insertions(+), 53 deletions(-) create mode 120000 docs/CHANGELOG.md delete mode 100644 docs/requirements.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index abc0ab3..7517380 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. ## Release 0.0.4 - Unreleased -## Release 0.0.3 - Unreleased +## Release 0.0.3 - 2021-11-26 **Features** @@ -24,6 +24,12 @@ All notable changes to this project will be documented in this file. - Fix pytest deprecation warning -## Release 0.0.2 +## Release 0.0.2 - 2020-11-03 + +**Bugfixes** + +- `PropertySource` now propertly handles `inherited` properties which specify the dataset they inherit their value from. + +## Release 0.0.1 - 2020-10-07 It spawned like this out of thin air. diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md new file mode 120000 index 0000000..04c99a5 --- /dev/null +++ b/docs/CHANGELOG.md @@ -0,0 +1 @@ +../CHANGELOG.md \ No newline at end of file diff --git a/docs/api.rst b/docs/api.rst index 877cded..03926d5 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -8,6 +8,9 @@ Enumerations .. autoclass:: simplezfs.types.DatasetType :members: +.. autoclass:: simplezfs.types.PEHelperMode + :members: + .. autoclass:: simplezfs.types.PropertySource :members: diff --git a/docs/conf.py b/docs/conf.py index eb1b0d8..6b9c3dc 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -10,10 +10,11 @@ # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) +import os +# -- Read-the-docs specifics ------------------------------------------------- + +on_rtd = os.environ.get('READTHEDOCS') == 'True' # -- Project information ----------------------------------------------------- @@ -22,7 +23,7 @@ copyright = '2019-2020, Andreas Gonschorek, Stefan Valouch' author = 'Andreas Gonschorek, Stefan Valouch' # The full version, including alpha/beta/rc tags -release = '0.0.2' +release = '0.0.3' # -- General configuration --------------------------------------------------- @@ -34,6 +35,7 @@ extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx_autodoc_typehints', + 'recommonmark', ] # Add any paths that contain templates here, relative to this directory. diff --git a/docs/guide.rst b/docs/guide.rst index 0016934..6e79789 100644 --- a/docs/guide.rst +++ b/docs/guide.rst @@ -171,8 +171,8 @@ return information about the internal states (like ``creation`` time). .. note:: The python library does not validate the names of native properties, as these are subject to change with the ZFS version and it would mean that the library needs an update every time a new ZFS version changes some of - these. Thus, it relies on validating the input for syntax based on the ZFS documentation of the ZFS on Linux - (ZoL) project and ZFS telling it that it did not like a name. + these. Thus, it relies on validating the input for syntax based on the ZFS documentation of the OpenZFS + project and ZFS telling it that it did not like a name. A word on metadata/user properties ---------------------------------- diff --git a/docs/index.rst b/docs/index.rst index a1178cb..39c459f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,11 +23,5 @@ At the time of writing, the ``native``-API has not been implemented. properties_metadata testing api + CHANGELOG - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/docs/requirements.txt b/docs/requirements.txt deleted file mode 100644 index 0708084..0000000 --- a/docs/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -Sphinx>=2.0 -sphinx-autodoc-typehints -sphinx-rtd-theme diff --git a/setup.py b/setup.py index 9323719..72e2a3e 100644 --- a/setup.py +++ b/setup.py @@ -27,20 +27,23 @@ setup( platforms='any', python_requires='>=3.6', - # install_requires=[ - # ], + install_requires=[ + 'typing_extensions ; python_version < "3.8"', + ], extras_require={ 'tests': [ - 'flake8', 'mypy', + 'pylint', 'pytest', 'pytest-cov', + 'pytest-pylint', ], 'docs': [ 'Sphinx>=2.0', 'sphinx-autodoc-typehints', 'sphinx-rtd-theme', + 'recommonmark>=0.5.0', ], }, diff --git a/src/simplezfs/zfs.py b/src/simplezfs/zfs.py index ffc4a44..44445b2 100644 --- a/src/simplezfs/zfs.py +++ b/src/simplezfs/zfs.py @@ -93,8 +93,6 @@ class ZFS: @metadata_namespace.setter def metadata_namespace(self, namespace: str) -> None: ''' - Sets a new metadata namespace - :todo: validate! ''' self._metadata_namespace = namespace @@ -102,15 +100,12 @@ class ZFS: @property def pe_helper(self) -> Optional[PEHelperBase]: ''' - Returns the pe_helper, which may be None if not set. + Returns or changes the privilege escalation (PE) helper. A value of ``None`` means none set. ''' return self._pe_helper @pe_helper.setter def pe_helper(self, helper: Optional[PEHelperBase]) -> None: - ''' - Sets the privilege escalation (PE) helper. Supply ``None`` to unset it. - ''' if helper is None: log.debug('PE helper is None') self._pe_helper = helper @@ -119,12 +114,15 @@ class ZFS: @property def use_pe_helper(self) -> bool: ''' - Returns whether the privilege escalation (PE) helper should be used. If the helper has not been set, this - property evaluates to ``False``. + Returns or sets whether the privilege escalation (PE) helper should be used. If the helper has not been set, + reading the property returns ``False``. .. deprecated:: 0.0.3 - Use :func:`~simplezfs.zfs.pe_helper_mode` instead. Returns whether the helper mode is **not** set to - ``PEHelperMode.DO_NOT_USE`` if the helper is set. + Use :func:`~simplezfs.zfs.ZFS.pe_helper_mode` instead. Returns whether the helper mode is **not** set to + ``PEHelperMode.DO_NOT_USE`` if the helper is set. If set to ``False``, sets the mode to + :attr:`~simplezfs.types.PEHelperMode.DO_NOT_USE`, ``True`` sets it to + :attr:`~simplezfs.types.PEHelperMode.USE_IF_REQUIRED` unless it is already set to + :attr:`~simplezfs.types.PEHelperMode.USE_PROACTIVE`, in which case it will do nothing. This property will be removed in 0.0.4! ''' @@ -135,16 +133,6 @@ class ZFS: # TODO remove this in 0.0.4 @use_pe_helper.setter def use_pe_helper(self, use: bool) -> None: - ''' - Enable or disable using the privilege escalation (PE) helper. - - .. deprecated:: 0.0.3 - Use :func:`~simplezfs.zfs.pe_helper_mode` instead. If set to ``False``, sets the mode to - ``PEHelperMode.DO_NOT_USE``, ``True`` sets to ``PEHelperMode.USE_IF_NEEDED`` unless it is set to - ``PEHelperMode.USE_PROACTIVE`` already, in which case it will do nothing. - - This property will be removed in 0.0.4! - ''' if use: if self.pe_helper_mode == PEHelperMode.DO_NOT_USE: self.pe_helper_mode = PEHelperMode.USE_PROACTIVE @@ -157,8 +145,8 @@ class ZFS: @property def pe_helper_mode(self) -> PEHelperMode: ''' - Returns whether the privilege escalation (PE) helper should be used and when. If the helper has not been set, - this property evaluates to ``False``. + Returns or sets whether the privilege escalation (PE) helper should be used and when. If the helper has not + been set, this property evaluates to ``False``. .. versionadded:: 0.0.3 ''' @@ -168,11 +156,6 @@ class ZFS: @pe_helper_mode.setter def pe_helper_mode(self, mode: PEHelperMode) -> None: - ''' - Sets the privilege escalation (PE) helper mode. - - .. versionadded:: 0.0.3 - ''' self._pe_helper_mode = mode def dataset_exists(self, name: str) -> bool: @@ -424,7 +407,7 @@ class ZFS: no default has been set, format the key using ``namespace:key``. :return: Info about the newly created dataset. :raises ValidationError: If validating the parameters failed. - :raises DatasetNotFOund: If the dataset can't be found. + :raises DatasetNotFound: If the dataset can't be found. ''' return self.create_dataset( f'{dataset}@{name}', @@ -477,7 +460,7 @@ class ZFS: parameter for ``zfs create``. :return: Info about the newly created dataset. :raises ValidationError: If validating the parameters failed. - :raises DatasetNotFOund: If the parent dataset can't be found and ``recursive`` is `False`. + :raises DatasetNotFound: If the parent dataset can't be found and ``recursive`` is `False`. ''' if mountpoint is not None: if properties is None: @@ -510,10 +493,10 @@ class ZFS: .. note:: - Please read the note in :func:`~simplezfs.ZFS.create_filesystem` for permission handling for filesystems. + Please read the note in :func:`~simplezfs.zfs.ZFS.create_fileset` for permission handling for filesystems. Generally, if the user does not have permission to set certain properties, the dataset may or may not have - been created but is missing the properties. It is up to the user of the library to clean up after - catching a :class:`+simplezfs.exceptions.PermissionError`. + been created but is missing the properties. It is up to the user of the library to clean up after catching a + :class:`~simplezfs.exceptions.PermissionError`. :param name: Name of the new volume (complete path in the ZFS hierarchy). :param size: The size (in `bytes`) for the new volume.