diff --git a/CHANGELOG.md b/CHANGELOG.md index 4dd0c210..e55196b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,15 @@ Used to document all changes from previous releases and collect changes until the next release. +# Version 1.4.5 + +## Minor changes, updates and fixes. +- all usages of the unsafe `yaml.load` calls are replaced with `yaml.save_load`. This also prepares for Python 3.9 compatibility. See also issue #350 and pull request #356 for details. +- dtype tests now use both `assertRegexpMatches` and `assertRegex` depending on the Python version used to prepare for Python 3.9 compatibility while still keeping the Python 2 tests running. +- odml style tuple handling is refactored. Now lists of odml style tuples are properly saved to file and can be loaded again. If an invalid format is used to add an odml style tuple, more detailed exception messages are available. Also adds more odml style tuples tests. See issues #250, #353 and #354 for details. +- a deprecation warning is displayed when importing the odml module if a Python version <3.6 is used. +- introduces minor PEP8 fixes to all files and completes docstrings for full documentation. + # Version 1.4.4 ## Introduction of inline style sheet diff --git a/README.md b/README.md index 106f897a..a6f4c875 100644 --- a/README.md +++ b/README.md @@ -69,19 +69,17 @@ release notes](https://github.com/G-Node/python-odml/releases). # Dependencies -* Python 2.7 or 3.5 +* Python 3.6+ * Python packages: - * enum (version 0.4.4) * lxml (version 3.7.2) - * yaml (version 3.12) + * yaml (version >= 5.1) * rdflib (version >=4.2.2) * These packages will be downloaded and installed automatically if the ```pip``` method is used to install odML. Alternatively, they can be installed from the OS package manager. On Ubuntu, they are available as: - * python-enum * python-lxml * python-yaml * python-rdflib @@ -93,6 +91,14 @@ release notes](https://github.com/G-Node/python-odml/releases). * libxslt1-dev * lib32z1-dev +## Previous Python versions + +Python 2 has reached end of life. We will not keep any future versions of odml Python 2 compatible and also recommend using a Python version >= 3.6. If a Python version < 3.6 is a requirement, the following dependency needs to be installed as well: + +* pip install + * enum34 (version 0.4.4) +* apt install + * python-enum # Building from source diff --git a/doc/conf.py b/doc/conf.py index 1da48b8b..439cbb30 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -18,14 +18,15 @@ from distutils.version import LooseVersion as CheckVer -currdir = os.path.dirname(os.path.abspath(__file__)) -parent = pathlib.Path(currdir).parent -path = os.path.join(parent, "odml", "info.json") +_currdir = os.path.dirname(os.path.abspath(__file__)) +_parent = pathlib.Path(_currdir).parent +_path = os.path.join(_parent, "odml", "info.json") -with open(path) as infofile: - infodict = json.load(infofile) +with open(_path) as infofile: + _infodict = json.load(infofile) -version_str = infodict["VERSION"] +VERSION_STR = _infodict["VERSION"] +COPY_RIGHT = _infodict["COPYRIGHT"] # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -34,198 +35,199 @@ class DocStringInheritor(type): - """A variation on + """ + A variation on http://groups.google.com/group/comp.lang.python/msg/26f7b4fcb4d66c95 by Paul McGuire """ def __new__(meta, name, bases, clsdict): if not('__doc__' in clsdict and clsdict['__doc__']): for mro_cls in (mro_cls for base in bases for mro_cls in base.mro()): - doc=mro_cls.__doc__ + doc = mro_cls.__doc__ if doc: - clsdict['__doc__']=doc + clsdict['__doc__'] = doc break for attr, attribute in clsdict.items(): if not attribute.__doc__: for mro_cls in (mro_cls for base in bases for mro_cls in base.mro() if hasattr(mro_cls, attr)): - doc=getattr(getattr(mro_cls,attr),'__doc__') + doc = getattr(getattr(mro_cls, attr), '__doc__') if doc: - attribute.__doc__=doc + attribute.__doc__ = doc break return type.__new__(meta, name, bases, clsdict) + # -- General configuration ----------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc'] +extensions = ["sphinx.ext.autodoc", "sphinx_rtd_theme"] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8' +# source_encoding = 'utf-8' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'python-odml' -copyright = u'2011-2020, German Neuroinformatics Node (G-Node); based on work by Hagen Fritsch' +project = "python-odml" +copyright = COPY_RIGHT # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = "%s.%s" % (CheckVer(version_str).version[0], CheckVer(version_str).version[1]) +version = "%s.%s" % (CheckVer(VERSION_STR).version[0], CheckVer(VERSION_STR).version[1]) # The full version, including alpha/beta/rc tags. -release = version_str +release = VERSION_STR # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of documents that shouldn't be included in the build. -#unused_docs = [] +# unused_docs = [] # List of directories, relative to source directory, that shouldn't be searched # for source files. -exclude_trees = ['_build'] +exclude_trees = ["_build"] # The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. -html_theme = 'sphinxdoc' +# html_theme = "sphinxdoc" +html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_use_modindex = True +# html_use_modindex = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = '' +# html_file_suffix = '' # Output file base name for HTML help builder. -htmlhelp_basename = 'python-odmldoc' +htmlhelp_basename = "python-odmldoc" # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' +# latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' +# latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). -latex_documents = [ - ('index', 'python-odml.tex', u'python-odml Documentation', - u'Hagen Fritsch', 'manual'), -] +latex_documents = [('index', 'python-odml.tex', u'python-odml Documentation', + u'Hagen Fritsch', 'manual')] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # Additional stuff for the LaTeX preamble. -#latex_preamble = '' +# latex_preamble = '' # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_use_modindex = True +# latex_use_modindex = True diff --git a/doc/tutorial.rst b/doc/tutorial.rst index 1dae9bf8..aa038d7b 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -88,20 +88,22 @@ the project name `python-odml `_. Dependencies ------------ -The Python-odML library (version 1.4) runs under Python 2.7 or 3.5. +The Python-odML library (version 1.4+) runs under Python 3.6+. -Additionally, the Python-odML library depends on Enum, lxml, pyyaml and rdflib. +Additionally, the Python-odML library depends on the lxml, pyyaml and rdflib python packages. When the odML-Python library is installed via pip or the setup.py, these packages will be automatically downloaded and installed. Alternatively, they can be installed from the OS package manager. -On Ubuntu, the dependency packages are available as ``python-enum`` and -``python-lxml``. +On Ubuntu, the dependency packages are available as ``python-lxml``, ``python-yaml`` and ``python-rdflib``. Note that on Ubuntu 14.04, the latter package additionally requires the installation of ``libxml2-dev``, ``libxslt1-dev``, and ``lib32z1-dev``. +Python 2 has reached end of life. We will not keep any future versions of odml Python 2 compatible and also recommend using a Python version >= 3.6. If a Python version < 3.6 is a requirement, the following dependency needs to be installed as well: + +The ``enum34`` package with a ``pip`` installation or ``python-enum`` using the OS package manager. Installation... --------------- @@ -120,8 +122,8 @@ downloaded and installed. If you are not familiar with PyPI and pip, please have a look at the available online documentation. -Installation ------------- +... from source: +**************** To download the Python-odML library please either use git and clone the repository from GitHub:: diff --git a/odml/info.json b/odml/info.json index d624f88e..747c5fa9 100644 --- a/odml/info.json +++ b/odml/info.json @@ -1,5 +1,5 @@ { - "VERSION": "1.4.4", + "VERSION": "1.4.5", "FORMAT_VERSION": "1.1", "AUTHOR": "Hagen Fritsch, Jan Grewe, Christian Kellner, Achilleas Koutsou, Michael Sonntag, Lyuba Zehl", "COPYRIGHT": "(c) 2011-2020, German Neuroinformatics Node", @@ -8,7 +8,6 @@ "CLASSIFIERS": [ "Development Status :: 5 - Production/Stable", "Programming Language :: Python", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8",