From 14e18cef73421e0ecb2f99fc731fafc6822fb16f Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 16 Jan 2022 14:42:18 +0100 Subject: [PATCH 01/21] Bumped version to v0.3.6. --- pySVModel/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pySVModel/__init__.py b/pySVModel/__init__.py index 1b445412..ea000294 100644 --- a/pySVModel/__init__.py +++ b/pySVModel/__init__.py @@ -44,7 +44,7 @@ __email__ = "Paebbels@gmail.com" __copyright__ = "2021-2022, Patrick Lehmann" __license__ = "Apache License, Version 2.0" -__version__ = "0.3.5" +__version__ = "0.3.6" @export From c721103da4b7806c7559e737dabe1d98504b0e32 Mon Sep 17 00:00:00 2001 From: umarcor Date: Sun, 16 Jan 2022 20:36:03 +0100 Subject: [PATCH 02/21] ci/Params: override python_version_list, since 3.6 was deprecated in pyTooling/Actions --- .github/workflows/Pipeline.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index ea442d7a..2a6e51ea 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -12,6 +12,7 @@ jobs: uses: pyTooling/Actions/.github/workflows/Parameters.yml@r0 with: name: pySVModel + python_version_list: "3.6 3.7 3.8 3.9 3.10" UnitTesting: uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@r0 @@ -119,15 +120,18 @@ jobs: with: package: ${{ fromJson(needs.Params.outputs.params).artifacts.package }} remaining: | + ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-ubuntu-3.6 ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-ubuntu-3.7 ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-ubuntu-3.8 ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-ubuntu-3.9 ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-ubuntu-3.10 + ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-windows-3.6 ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-windows-3.7 ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-windows-3.8 ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-windows-3.9 ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-windows-3.10 ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-msys2-3.9 + ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.6 ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.7 ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.8 ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.9 From 9dbec4d3ba1684da85dc954f2231ec0ca3cddc8b Mon Sep 17 00:00:00 2001 From: umarcor Date: Sun, 16 Jan 2022 20:38:01 +0100 Subject: [PATCH 03/21] doc: cleanup extensions --- doc/_extensions/.gitempty | 0 doc/_extensions/autoapi/__init__.py | 27 --- doc/_extensions/autoapi/apinode.py | 353 ---------------------------- doc/_extensions/autoapi/sphinx.py | 209 ---------------- doc/conf.py | 25 +- 5 files changed, 2 insertions(+), 612 deletions(-) delete mode 100644 doc/_extensions/.gitempty delete mode 100644 doc/_extensions/autoapi/__init__.py delete mode 100644 doc/_extensions/autoapi/apinode.py delete mode 100644 doc/_extensions/autoapi/sphinx.py diff --git a/doc/_extensions/.gitempty b/doc/_extensions/.gitempty deleted file mode 100644 index e69de29b..00000000 diff --git a/doc/_extensions/autoapi/__init__.py b/doc/_extensions/autoapi/__init__.py deleted file mode 100644 index 52a5a3f9..00000000 --- a/doc/_extensions/autoapi/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (C) 2015 Carlos Jenkins -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -from __future__ import unicode_literals, absolute_import -from __future__ import print_function, division - -from .apinode import __doc__, APINode # noqa - -__author__ = 'Carlos Jenkins' -__email__ = 'carlos@jenkins.co.cr' -__version__ = '1.3.1' - -__all__ = ['APINode'] diff --git a/doc/_extensions/autoapi/apinode.py b/doc/_extensions/autoapi/apinode.py deleted file mode 100644 index 9fbee1af..00000000 --- a/doc/_extensions/autoapi/apinode.py +++ /dev/null @@ -1,353 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (C) 2015 Carlos Jenkins -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -""" -Module that provides the module tree node :class:`APINode`. - -This class will load the module identified by ``name`` and recursively build a -tree with all it's submodules and subpackages. In the process, each node -analyze and fetch the public API of that module. - -``name`` can be any node, like the root package, or any subpackage or submodule -and a tree will be built from there. ``name`` must follow the standard -"dot notation" for importing a module. - -This class will not assume any special naming, or perform any complex analysis -to determine what must be in the public interface. This is because it is not -only a difficult problem, but it involves analyzing deeply the namespace of the -module which can be quite expensive. - -In general it is very difficult to determine in a module namespace what -elements are private or public declared locally, private or public but declared -in another module and brought into the module local namespace -(``from x import y``), third party library, Python standard library, etc. At -the end, any algorithm that tries to determine this will eventually fail to -meet the requirements or expectations of the developer, leaving false positives -or removing elements expected to be present in the public API. - -For example, a common scenario is that some modules, specially package entry -points ``__init__.py``, can be setup to expose the public API of their sibling -modules, possible causing several objects to be identified as part of the -public API of both modules. - -Because of this the approach taken by this module follows the rule in PEP20 -"Explicit is better than implicit". In consequence, the node will consider -elements as public if they are explicitly listed in the ``__api__`` or -``__all__`` variables. It is up to the developer to list the elements that must -be published in the public API. - -``__api__`` is a special variable introduced by this module, and it exists for -situation were for whatever reason the developer don't want to list in the -``__all__`` variable an element that needs to be published in the public API. - -This class will extract all elements identified in ONE of those listings (not -the union), with ``__api__`` having the precedence. If none of those variables -exists in the module then it will be assumed that no public API exists for that -module and no futher actions will be taken. - -If any of those variables exists this class will iterate all elements listed in -them and will catalog them in four categories: - -- Functions. -- Exceptions. -- Classes. -- Variables. - -Being Variables the default if it cannot be determined that an element belongs -to any of other categories. -""" - -from __future__ import unicode_literals, absolute_import -from __future__ import print_function, division - -from logging import getLogger -from traceback import format_exc -from importlib import import_module -from pkgutil import iter_modules -from inspect import isclass, isfunction -from collections import OrderedDict - - -log = getLogger(__name__) - - -class APINode(object): - """ - Tree node class for module instrospection. - - :param str name: Name of the module to build the tree from. It must follow - the "dot notation" of the import mechanism. - :param dict directory: Directory to store the index of all the modules. - If None, the default, the root node will create one a pass it to the - subnodes. - - **Attributes:** - - :var name: Name of the current module. - :var subname: Last part of the name of this module. For example if name is - ``my.module.another`` the subname will be ``another``. - :var directory: Directory of the tree. This is a :py:class:`OrderedDict` - that will register all modules name with it's associated node - :class:`APINode`. All nodes of a tree share this index and thus - the whole tree can be queried from any node. - :var module: The loaded module. - :var subnodes: A list of :class:`APINode` with all child submodules - and subpackages. - :var subnodes_failed: A list of submodules and subpackages names that - failed to import. - - **Public API categories:** - - :var functions: A :py:class:`OrderedDict` of all functions found in the - public API of the module. - :var classes: A :py:class:`OrderedDict` of all classes found in the - public API of the module. - :var exceptions: A :py:class:`OrderedDict` of all exceptions found in the - public API of the module. - :var variables: A :py:class:`OrderedDict` of all other elements found in - the public API of the module. - - In all categories the order on which the elements are listed is preserved. - """ - - def __init__(self, name, directory=None): - self.module = import_module(name) - self.name = name - self.subname = name.split('.')[-1] - - self.functions = OrderedDict() - self.classes = OrderedDict() - self.exceptions = OrderedDict() - self.variables = OrderedDict() - self.api = OrderedDict(( - ('functions', self.functions), - ('classes', self.classes), - ('exceptions', self.exceptions), - ('variables', self.variables), - )) - - self.subnodes = [] - self.subnodes_failed = [] - - self.directory = OrderedDict() - if directory is not None: - self.directory = directory - - self._relevant = None - - # Now that all node public attributes exists and module was imported - # register itself in the directory - self.directory[self.name] = self - - # Check if package and iterate over subnodes - if hasattr(self.module, '__path__'): - for _, subname, ispkg in iter_modules( - self.module.__path__, self.module.__name__ + '.'): - log.info('Recursing into {}'.format(subname)) - - try: - subnode = APINode(subname, self.directory) - self.subnodes.append(subnode) - except: # Overbroad exception handling on purpose - log.error('Failed to import {}'.format(subname)) - log.debug(format_exc()) - self.subnodes_failed.append(subname) - - # Fetch all public objects - public = OrderedDict() - for public_key in ['__api__', '__all__']: - if not hasattr(self.module, public_key): - continue - - for obj_name in getattr(self.module, public_key): - if not hasattr(self.module, obj_name): - log.warning( - 'Module {} doesn\'t have a element {}'.format( - self.name, obj_name - ) - ) - continue - public[obj_name] = getattr(self.module, obj_name) - break - - # Categorize objects - for obj_name, obj in public.items(): - if isclass(obj): - if issubclass(obj, Exception): - self.exceptions[obj_name] = obj - continue - self.classes[obj_name] = obj - continue - if isfunction(obj): - self.functions[obj_name] = obj - continue - self.variables[obj_name] = obj - - # Flag to mark if this branch is relevant - # For self._relevant, None means undertermined - if self.is_root(): - self.is_relevant() - - def has_public_api(self): - """ - Check if this node has a public API. - - :rtype: bool - :return: True if any category has at least one element. - """ - return any(self.api.values()) - - def is_leaf(self): - """ - Check if the current node is a leaf in the tree. - - A leaf node not necessarily is a module, it can be a package without - modules (just the entry point ``__init__.py``). - - :rtype: bool - :return: True if no other subnodes exists for this node. - """ - return not self.subnodes - - def is_root(self): - """ - Check if the current node is the root node. - - :rtype: bool - :return: True if the current node is the root node. - """ - for key in self.directory.keys(): - return key == self.name - raise Exception('Empty directory!') - - def is_relevant(self): - """ - Check if this branch of the tree is relevant. - - A branch is relevant if the current node has a public API or if any of - its subnodes is relevant (in order to reach relevant nodes). - - Relevancy is determined at initialization by the root node. - - :rtype: bool - :return: True if the current node is relevant. - """ - if self._relevant is not None: - return self._relevant - - relevant = False - if self.has_public_api() or \ - any(s.is_relevant() for s in self.subnodes): - relevant = True - - self._relevant = relevant - - return self._relevant - - def depth(self): - """ - Get the depth of the current node in the tree. - - :rtype: int - :return: The depth of the node. For example, for node ``my.add.foo`` - the depth is 3. - """ - return len(self.name.split('.')) - - def get_module(self, name): - """ - Get a module node by it's name. - - This is just a helper that does lookup on the directory index. - - :rtype: :class:`APINode` or None - :return: The module node identified by ``name`` in the tree. ``None`` - if the name doesn't exists. - """ - return self.directory.get(name, None) - - def walk(self): - """ - Traverse the tree top-down. - - :return: This method will yield tuples ``(node, [leaves])`` for each - node in the tree. - """ - if self.is_leaf(): - raise StopIteration() - - yield (self, [n for n in self.subnodes if n.is_leaf()]) - - for subnode in [n for n in self.subnodes if not n.is_leaf()]: - for step in subnode.walk(): - yield step - - def __iter__(self): - return self.walk - - def tree(self, level=0, fullname=True): - """ - Pretty print the subtree at the current node. - - For example, for the module ``confspec``: - - :: - - confspec - confspec.manager [c] - confspec.options [c] - confspec.providers [c, v] - confspec.providers.dict [c] - confspec.providers.ini [c] - confspec.providers.json [c] - confspec.utils [f] - confspec.validation [f] - - The tags at the right of the name shows what kind of elements are - present in the public interfaces of those modules. - - :param int level: Indentation level. - :param bool fullname: Plot the full name of the module or just it's - subname. - """ - name = [(' ' * level)] - if fullname: - name.append(self.name) - else: - name.append(self.subname) - - tags = [] - for tag, category in zip(['f', 'c', 'e', 'v'], self.api.values()): - if category: - tags.append(tag) - if tags: - name.append(' [{}]'.format(', '.join(tags))) - - output = [''.join(name)] - for subnode in self.subnodes: - output.append(subnode.tree(level=level + 1, fullname=fullname)) - return '\n'.join(output) - - def __str__(self): - return self.tree() - - def __repr__(self): - return self.name - - -__all__ = ['APINode'] -__api__ = [] diff --git a/doc/_extensions/autoapi/sphinx.py b/doc/_extensions/autoapi/sphinx.py deleted file mode 100644 index e7ec50d0..00000000 --- a/doc/_extensions/autoapi/sphinx.py +++ /dev/null @@ -1,209 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Copyright (C) 2015 Carlos Jenkins -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -""" -Glue for Sphinx API. -""" - -from __future__ import unicode_literals, absolute_import -from __future__ import print_function, division - -from inspect import getdoc -from logging import getLogger -from traceback import format_exc -from os.path import join, dirname, abspath, exists -from os import environ - -from jinja2.sandbox import SandboxedEnvironment -from sphinx.util.osutil import ensuredir -from sphinx.jinja2glue import BuiltinTemplateLoader - -from . import __version__ -from .apinode import APINode - - -log = getLogger(__name__) - - -def handle_exception(func): - """ - Utility decorator to report all exceptions in module without making Sphinx - to die. - """ - def wrapper(app): - try: - func(app) - except Exception: - app.warn( - 'Unhandled exception in autoapi module: \n{}'.format( - format_exc() - ) - ) - - # Preserve docstring - if hasattr(func, '__doc__'): - wrapper.__doc__ = func.__doc__ - - return wrapper - - -def filter_summary(obj): - """ - Jinja2 filter that allows to extract the documentation summary of an - object. - """ - try: - doc = getdoc(obj) - if doc is None: - return 'Undocumented.' - - summary = doc.split('\n').pop(0) - summary.replace('\\', '\\\\') # Escape backslash in RST - return summary - except: - log.error( - 'AutoApi failed to determine autosummary for obj: {}'.format(obj) - ) - log.error(format_exc()) - - return 'AutoApi: Unable to determine summary.' - - -def get_template_env(app): - """ - Get the template environment. - - .. note:: - - Template should be loaded as a package_data using - :py:function:`pkgutil.get_data`, but because we want the user to - override the default template we need to hook it to the Sphinx loader, - and thus a file system approach is required as it is implemented like - that. - """ - template_dir = [join(dirname(abspath(__file__)), 'templates')] - template_loader = BuiltinTemplateLoader() - template_loader.init(app.builder, dirs=template_dir) - template_env = SandboxedEnvironment(loader=template_loader) - template_env.filters['summary'] = filter_summary - return template_env - - -@handle_exception -def builder_inited(app): - """ - autoapi Sphinx extension hook for the ``builder-inited`` event. - - This hook will read the configuration value ``autoapi_modules`` and render - the modules described in it. - - See http://sphinx-doc.org/extdev/appapi.html#event-builder-inited - """ - # Get modules to build documentation for - modules = app.config.autoapi_modules - if not modules: - return - - # Overwrite all files in an ReadTheDocs environment when the first builder runs (pickle) - overrideDefault = True - if (environ.get('READTHEDOCS') == "True"): - #if (app.buildername != "pickle"): - overrideDefault = False - - # Get template environment - template_env = get_template_env(app) - - print("===============================") - print("overrideDefault set to: {0!s}".format(overrideDefault)) - print("===============================") - - for module, overrides in modules.items(): - - # Get options - options = { - 'prune': False, - 'override': overrideDefault, - 'template': 'module', - 'output': module - } - if overrides: - options.update(overrides) - - # Get template - template = template_env.get_template( - 'autoapi/{}.rst'.format(options['template']) - ) - - # Build API tree - tree = APINode(module) - - # Gather nodes to document - if options['prune']: - nodes = [ - node for node in tree.directory.values() - if node.is_relevant() - ] - else: - nodes = tree.directory.values() - - if not nodes: - continue - - # Define output directory - out_dir = join(app.env.srcdir, options['output']) - ensuredir(out_dir) - - # Iterate nodes and render them - for node in nodes: - out_file = join(out_dir, node.name + app.config.source_suffix[0]) - - # Skip file if it override is off and it exists - if not options['override'] and exists(out_file): - continue - - # Consider only subnodes that are relevant if prune is enabled - subnodes = node.subnodes - if options['prune']: - subnodes = [ - subnode for subnode in node.subnodes - if subnode.is_relevant() - ] - - # Write file - with open(out_file, 'w') as fd: - fd.write( - template.render( - node=node, - subnodes=subnodes - ) - ) - - -def setup(app): - """ - autoapi Sphinx extension setup. - - See http://sphinx-doc.org/extdev/tutorial.html#the-setup-function - """ - # autodoc is required - app.setup_extension('sphinx.ext.autodoc') - app.add_config_value('autoapi_modules', {}, True) - app.connect(str('builder-inited'), builder_inited) - return {'version': __version__} - - -__all__ = ['builder_inited', 'setup'] diff --git a/doc/conf.py b/doc/conf.py index 0da0f093..72bf1e74 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -14,7 +14,6 @@ sys_path.insert(0, abspath('.')) sys_path.insert(0, abspath('..')) sys_path.insert(0, abspath('../pySVModel')) -#sys_path.insert(0, abspath('_extensions')) # ============================================================================== @@ -154,7 +153,6 @@ ] - # ============================================================================== # Extensions # ============================================================================== @@ -169,32 +167,13 @@ 'sphinx.ext.mathjax', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode', -# 'sphinx.ext.duration', - -# SphinxContrib extensions -# 'sphinxcontrib.actdiag', -# 'sphinxcontrib.seqdiag', -# 'sphinxcontrib.textstyle', -# 'sphinxcontrib.spelling', -# 'changelog', - -# BuildTheDocs extensions -# 'btd.sphinx.autoprogram', -# 'btd.sphinx.graphviz', -# 'btd.sphinx.inheritance_diagram', - # Other extensions -# 'DocumentMember', + 'autoapi.sphinx', 'sphinx_fontawesome', 'sphinx_autodoc_typehints', - -# local extensions (patched) - 'autoapi.sphinx', - -# local extensions -# 'DocumentMember' ] + # ============================================================================== # Sphinx.Ext.InterSphinx # ============================================================================== From 89f18bd2879760890aaa5c0f66243f0519309d04 Mon Sep 17 00:00:00 2001 From: umarcor Date: Mon, 17 Jan 2022 01:19:41 +0100 Subject: [PATCH 04/21] doc: rm _templates --- doc/_templates/.gitempty | 0 doc/_templates/autoapi/module.rst | 144 ----------------------------- doc/_templates/autoapi/script.rst | 149 ------------------------------ doc/conf.py | 3 - 4 files changed, 296 deletions(-) delete mode 100644 doc/_templates/.gitempty delete mode 100644 doc/_templates/autoapi/module.rst delete mode 100644 doc/_templates/autoapi/script.rst diff --git a/doc/_templates/.gitempty b/doc/_templates/.gitempty deleted file mode 100644 index e69de29b..00000000 diff --git a/doc/_templates/autoapi/module.rst b/doc/_templates/autoapi/module.rst deleted file mode 100644 index 8ded38ea..00000000 --- a/doc/_templates/autoapi/module.rst +++ /dev/null @@ -1,144 +0,0 @@ -{{ node.name }} -=={{ '=' * node.name|length }}== - -.. automodule:: {{ node.name }} - -{##} -{%- block modules -%} -{%- if subnodes %} - -.. #----------------------------------- -{##} -**Submodules** - -.. toctree:: -{% for item in subnodes %} - {{ item.name }} -{%- endfor %} -{##} -{%- endif -%} -{%- endblock -%} -{##} -.. currentmodule:: {{ node.name }} -{##} - -.. #----------------------------------- -{##} -{%- if node.variables %} -**Variables** -{##} -{% for item, obj in node.variables.items() -%} -- :py:data:`{{ item }}` -{% endfor -%} -{%- endif -%} - - -{%- if node.exceptions %} -{##} -**Exceptions** -{##} -{% for item, obj in node.exceptions.items() -%} -- :py:exc:`{{ item }}`: - {{ obj|summary }} - -{% endfor -%} -{%- endif -%} - - -{%- if node.classes %} -{##} -**Classes** -{##} -{% for item, obj in node.classes.items() -%} -- :py:class:`{{ item }}`: - {{ obj|summary }} - -{% endfor -%} -{%- endif -%} - - -{%- if node.functions %} -{##} -**Functions** -{##} -{% for item, obj in node.functions.items() -%} -- :py:func:`{{ item }}`: - {{ obj|summary }} - -{% endfor -%} -{%- endif -%} - - -{%- block variables -%} -{%- if node.variables %} -{% for item, obj in node.variables.items() %} -.. autodata:: {{ item }} - :annotation: - - .. code-block:: guess - - {{ obj|pprint|indent(6) }} -{##} -{%- endfor -%} -{%- endif -%} -{%- endblock -%} - - -{%- block exceptions -%} -{%- if node.exceptions %} - -.. #----------------------------------- - -{% for item in node.exceptions %} -.. autoexception:: {{ item }} - :members: - :private-members: - :inherited-members: - :undoc-members: -{##} - .. rubric:: Inheritance - .. inheritance-diagram:: {{ item }} -{##} - .. rubric:: Members -{##} -{%- endfor -%} -{%- endif -%} -{%- endblock -%} - - -{%- block classes -%} -{%- if node.classes %} - -.. #----------------------------------- - -{% for item in node.classes %} -.. autoclass:: {{ item }} - :members: - :private-members: - :undoc-members: - :inherited-members: -{##} - .. rubric:: Inheritance - .. inheritance-diagram:: {{ item }} - :parts: 1 -{##} - .. rubric:: Members -{##} -{%- endfor -%} -{%- endif -%} -{%- endblock -%} - - -{%- block functions -%} -{%- if node.functions %} - -.. #----------------------------------- - -**Functions** - -{% for item in node.functions %} -.. autofunction:: {{ item }} -{##} -{%- endfor -%} -{%- endif -%} -{%- endblock -%} diff --git a/doc/_templates/autoapi/script.rst b/doc/_templates/autoapi/script.rst deleted file mode 100644 index ab52306a..00000000 --- a/doc/_templates/autoapi/script.rst +++ /dev/null @@ -1,149 +0,0 @@ -{{ node.name }}.py -=={{ '=' * node.name|length }}== - -.. automodule:: {{ node.name }} - - -{##} -{%- block modules -%} -{%- if subnodes %} - -.. #----------------------------------- -{##} -**Submodules** - -.. toctree:: -{% for item in subnodes %} - {{ item.name }} -{%- endfor %} -{##} -{%- endif -%} -{%- endblock -%} -{##} -.. currentmodule:: {{ node.name }} -{##} - -.. #----------------------------------- -{##} -{%- if node.variables %} -**Variables** -{##} -{% for item, obj in node.variables.items() -%} -- :py:data:`{{ item }}` -{% endfor -%} -{%- endif -%} - - -{%- if node.exceptions %} -{##} -**Exceptions** -{##} -{% for item, obj in node.exceptions.items() -%} -- :py:exc:`{{ item }}`: - {{ obj|summary }} - -{% endfor -%} -{%- endif -%} - - -{%- if node.classes %} -{##} -**Classes** -{##} -{% for item, obj in node.classes.items() -%} -- :py:class:`{{ item }}`: - {{ obj|summary }} - -{% endfor -%} -{%- endif -%} - - -{%- if node.functions %} -{##} -**Functions** -{##} -{% for item, obj in node.functions.items() -%} -- :py:func:`{{ item }}`: - {{ obj|summary }} - -{% endfor -%} -{%- endif -%} - - -{%- block variables -%} -{%- if node.variables %} -{% for item, obj in node.variables.items() %} -.. autodata:: {{ item }} - :noindex: - :annotation: - - .. code-block:: guess - - {{ obj|pprint|indent(6) }} -{##} -{%- endfor -%} -{%- endif -%} -{%- endblock -%} - - -{%- block exceptions -%} -{%- if node.exceptions %} - -.. #----------------------------------- - -{% for item in node.exceptions %} -.. autoexception:: {{ item }} - :members: - :noindex: - :private-members: - :inherited-members: - :undoc-members: -{##} - .. rubric:: Inheritance - .. inheritance-diagram:: {{ item }} -{##} - .. rubric:: Members -{##} -{%- endfor -%} -{%- endif -%} -{%- endblock -%} - - -{%- block classes -%} -{%- if node.classes %} - -.. #----------------------------------- - -{% for item in node.classes %} -.. autoclass:: {{ item }} - :members: - :noindex: - :private-members: - :undoc-members: - :inherited-members: -{##} - .. rubric:: Inheritance - .. inheritance-diagram:: {{ item }} - :parts: 1 -{##} - .. rubric:: Members -{##} -{%- endfor -%} -{%- endif -%} -{%- endblock -%} - - -{%- block functions -%} -{%- if node.functions %} - -.. #----------------------------------- - -**Functions** - -{% for item in node.functions %} -.. autofunction:: {{ item }} - :noindex: -{##} -{%- endfor -%} -{%- endif -%} -{%- endblock -%} diff --git a/doc/conf.py b/doc/conf.py index 72bf1e74..ce9d9d5b 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -39,9 +39,6 @@ # The master toctree document. master_doc = 'index' -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. From 3b130b95f350c84a7846f56ed5c265f8ac431d7c Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Wed, 23 Feb 2022 00:14:20 +0100 Subject: [PATCH 05/21] Bumped dependencies. --- doc/Dependency.rst | 6 +++--- doc/requirements.txt | 2 +- pyproject.toml | 2 +- requirements.txt | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/Dependency.rst b/doc/Dependency.rst index f52ffa67..5534657e 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -29,7 +29,7 @@ pySVModel Package +--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +========================================================+=============+==========================================================================================+=================================================================================================================================+ -| `pyTooling `__ | ≥1.9.2 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥1.9.4 | `Apache License, 2.0 `__ | *None* | +--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ @@ -93,7 +93,7 @@ the mandatory dependencies too. +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +=================================================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥1.9.2 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥1.9.4 | `Apache License, 2.0 `__ | *None* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `Sphinx `__ | ≥4.3.0 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -129,7 +129,7 @@ install the mandatory dependencies too. +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +============================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥1.9.2 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥1.9.4 | `Apache License, 2.0 `__ | *None* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `wheel `__ | any | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/doc/requirements.txt b/doc/requirements.txt index 48fdad5f..da29f705 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,6 +1,6 @@ -r ../requirements.txt -pyTooling>=1.9.2 +pyTooling>=1.9.4 # Enforce latest version on ReadTheDocs sphinx>=4.3.0 diff --git a/pyproject.toml b/pyproject.toml index 4fbec4ea..24fd949a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "pyTooling >= 1.9.2", + "pyTooling >= 1.9.4", "setuptools >= 35.0.2", "wheel >= 0.29.0" ] diff --git a/requirements.txt b/requirements.txt index af16e2f0..18855815 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -pyTooling>=1.9.2 +pyTooling>=1.9.4 From 283da487dabdb85facb7ad1d669d60e9701aa046 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 1 Mar 2022 13:13:26 +0100 Subject: [PATCH 06/21] Bumped dependencies. --- .github/dependabot.yml | 2 +- .github/pull_request_template.md | 8 +++ .idea/pySVModel.iml | 1 + doc/Dependency.rst | 14 ++-- doc/_templates/autoapi/module.rst | 108 ++++++++++++++++++++++++++++++ doc/requirements.txt | 6 +- pyproject.toml | 6 +- requirements.txt | 2 +- tests/requirements.txt | 4 +- 9 files changed, 134 insertions(+), 17 deletions(-) create mode 100644 doc/_templates/autoapi/module.rst diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0896e81d..bc1dfd59 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,7 +6,7 @@ updates: commit-message: prefix: "[Dependabot]" labels: - - Dependencies + - Dependencies assignees: - Paebbels reviewers: diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7a345ae6..ac698f89 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,8 +1,16 @@ # New Features + * tbd # Changes + * tbd # Bug Fixes + +* tbd + +---------- +# Related PRs: + * tbd diff --git a/.idea/pySVModel.iml b/.idea/pySVModel.iml index 54123544..97e14814 100644 --- a/.idea/pySVModel.iml +++ b/.idea/pySVModel.iml @@ -6,6 +6,7 @@ + diff --git a/doc/Dependency.rst b/doc/Dependency.rst index 5534657e..2e90a9ac 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -29,7 +29,7 @@ pySVModel Package +--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +========================================================+=============+==========================================================================================+=================================================================================================================================+ -| `pyTooling `__ | ≥1.9.4 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥1.9.5 | `Apache License, 2.0 `__ | *None* | +--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ @@ -57,7 +57,7 @@ the mandatory dependencies too. +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | **Package** | **Version** | **License** | **Dependencies** | +===========================================================+=============+========================================================================================+======================+ -| `pytest `__ | ≥6.2.5 | `MIT `__ | *Not yet evaluated.* | +| `pytest `__ | ≥7.0.1 | `MIT `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `pytest-cov `__ | ≥3.0.0 | `MIT `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ @@ -65,7 +65,7 @@ the mandatory dependencies too. +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `mypy `__ | ≥0.931 | `MIT `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `lxml `__ | ≥4.6.4 | `BSD 3-Clause `__ | *Not yet evaluated.* | +| `lxml `__ | ≥4.8 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ @@ -93,15 +93,15 @@ the mandatory dependencies too. +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +=================================================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥1.9.4 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥1.9.5 | `Apache License, 2.0 `__ | *None* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `Sphinx `__ | ≥4.3.0 | `BSD 3-Clause `__ | *Not yet evaluated.* | +| `Sphinx `__ | ≥4.4.0 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `sphinx_btd_theme `__ | ≥0.5.2 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | !! `sphinx_fontawesome `__ | ≥0.0.6 | `GPL 2.0 `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `sphinx_autodoc_typehints `__ | ≥1.14.1 | `MIT `__ | *Not yet evaluated.* | +| `sphinx_autodoc_typehints `__ | ≥1.17.0 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -129,7 +129,7 @@ install the mandatory dependencies too. +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +============================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥1.9.4 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥1.9.5 | `Apache License, 2.0 `__ | *None* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `wheel `__ | any | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/doc/_templates/autoapi/module.rst b/doc/_templates/autoapi/module.rst new file mode 100644 index 00000000..d41ca8ab --- /dev/null +++ b/doc/_templates/autoapi/module.rst @@ -0,0 +1,108 @@ +=={{ '=' * node.name|length }}== +``{{ node.name }}`` +=={{ '=' * node.name|length }}== + +.. #automodule:: {{ node.name }} + + .. contents:: + :local: +{##} +{%- block modules -%} +{%- if subnodes %} + +**Submodules** + + +.. toctree:: +{% for item in subnodes %} + {{ item.name }} +{%- endfor %} +{##} +{%- endif -%} +{%- endblock -%} +{##} +.. currentmodule:: {{ node.name }} +{##} +{%- block functions -%} +{%- if node.functions %} + +**Functions** + +{% for item, obj in node.functions.items() -%} +- :py:func:`{{ item }}`: + {{ obj|summary }} + +{% endfor -%} + +{% for item in node.functions %} +.. autofunction:: {{ item }} +{##} +{%- endfor -%} +{%- endif -%} +{%- endblock -%} + +{%- block classes -%} +{%- if node.classes %} + +**Classes** + +{% for item, obj in node.classes.items() -%} +- :py:class:`{{ item }}`: + {{ obj|summary }} + +{% endfor -%} + +{% for item in node.classes %} +.. autoclass:: {{ item }} + :members: + + .. rubric:: Inheritance + .. inheritance-diagram:: {{ item }} + :parts: 1 +{##} +{%- endfor -%} +{%- endif -%} +{%- endblock -%} + +{%- block exceptions -%} +{%- if node.exceptions %} + +**Exceptions** + +{% for item, obj in node.exceptions.items() -%} +- :py:exc:`{{ item }}`: + {{ obj|summary }} + +{% endfor -%} + +{% for item in node.exceptions %} +.. autoexception:: {{ item }} + + .. rubric:: Inheritance + .. inheritance-diagram:: {{ item }} + :parts: 1 +{##} +{%- endfor -%} +{%- endif -%} +{%- endblock -%} + +{%- block variables -%} +{%- if node.variables %} + +**Variables** + +{% for item, obj in node.variables.items() -%} +- :py:data:`{{ item }}` +{% endfor -%} + +{% for item, obj in node.variables.items() %} +.. autodata:: {{ item }} + :annotation: + + .. code-block:: text + + {{ obj|pprint|indent(6) }} +{##} +{%- endfor -%} +{%- endif -%} +{%- endblock -%} diff --git a/doc/requirements.txt b/doc/requirements.txt index da29f705..fe32d144 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,12 +1,12 @@ -r ../requirements.txt -pyTooling>=1.9.4 +pyTooling>=1.9.5 # Enforce latest version on ReadTheDocs -sphinx>=4.3.0 +sphinx>=4.4.0 # Sphinx Extenstions sphinxcontrib-mermaid>=0.7.1 autoapi>=2.0.1 sphinx_fontawesome>=0.0.6 -sphinx_autodoc_typehints>=1.14.1 +sphinx_autodoc_typehints>=1.17.0 diff --git a/pyproject.toml b/pyproject.toml index 24fd949a..c8eb2c39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [build-system] requires = [ - "pyTooling >= 1.9.4", - "setuptools >= 35.0.2", - "wheel >= 0.29.0" + "pyTooling >= 1.9.5", + "setuptools >= 60.9.3", + "wheel >= 0.37.1" ] build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt index 18855815..7fb34c67 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -pyTooling>=1.9.4 +pyTooling>=1.9.5 diff --git a/tests/requirements.txt b/tests/requirements.txt index e71c276a..0320e3aa 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -4,9 +4,9 @@ Coverage>=6.2 # Test Runner -pytest>=6.2.5 +pytest>=7.0.1 pytest-cov>=3.0.0 # Static Type Checking mypy>=0.931 -lxml>=4.6 +lxml>=4.8 From b8ee7b90719c61e784b7f2981d9278bfe5d0058e Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 1 Mar 2022 17:34:50 +0100 Subject: [PATCH 07/21] Added comment to autoapi template. --- doc/_templates/autoapi/module.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/_templates/autoapi/module.rst b/doc/_templates/autoapi/module.rst index d41ca8ab..5f9e361b 100644 --- a/doc/_templates/autoapi/module.rst +++ b/doc/_templates/autoapi/module.rst @@ -1,11 +1,11 @@ +.. # Template modified by Patrick Lehmann + * removed automodule on top, because private members are activated for autodoc (no doubled documentation). + * Made sections like 'submodules' bold text, but no headlines to reduce number of ToC levels. + =={{ '=' * node.name|length }}== ``{{ node.name }}`` =={{ '=' * node.name|length }}== -.. #automodule:: {{ node.name }} - - .. contents:: - :local: {##} {%- block modules -%} {%- if subnodes %} From afc5b3651ea785395d87b0856f9e874f119df70a Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 1 Mar 2022 18:14:00 +0100 Subject: [PATCH 08/21] Updated Sphinx configuration. --- doc/conf.py | 23 ++++++++++++++++++----- doc/pySVModel/index.rst | 5 +++++ setup.py | 2 +- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index ce9d9d5b..6ee4b96e 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -24,7 +24,7 @@ # built documents. project = "pySVModel" -packageInformationFile = Path(f"../{project}/__init__.py") +packageInformationFile = Path(f"../{project.replace('.', '/')}/__init__.py") versionInformation = extractVersionInformation(packageInformationFile) author = versionInformation.Author @@ -39,6 +39,9 @@ # The master toctree document. master_doc = 'index' +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. @@ -164,13 +167,14 @@ 'sphinx.ext.mathjax', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode', +# SphinxContrib extensions + 'sphinxcontrib.mermaid', # Other extensions - 'autoapi.sphinx', 'sphinx_fontawesome', 'sphinx_autodoc_typehints', + 'autoapi.sphinx', ] - # ============================================================================== # Sphinx.Ext.InterSphinx # ============================================================================== @@ -183,7 +187,17 @@ # Sphinx.Ext.AutoDoc # ============================================================================== # see: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#configuration +autodoc_default_options = { + "private-members": True, + "special-members": True, + "inherited-members": True, + "exclude-members": "__weakref__" +} +#autodoc_class_signature = "separated" autodoc_member_order = "bysource" # alphabetical, groupwise, bysource +autodoc_typehints = "both" +#autoclass_content = "both" + # ============================================================================== @@ -192,8 +206,7 @@ extlinks = { "ghissue": ('https://GitHub.com/edaa-org/pySVModel/issues/%s', 'issue #'), "ghpull": ('https://GitHub.com/edaa-org/pySVModel/pull/%s', 'pull request #'), - "ghsrc": ('https://GitHub.com/edaa-org/pySVModel/blob/main/pySVModel/%s?ts=2', None), -# "ghtest": ('https://GitHub.com/edaa-org/pySVModel/blob/main/test/%s?ts=2', None) + "ghsrc": ('https://GitHub.com/edaa-org/pySVModel/blob/main/%s?ts=2', ""), } diff --git a/doc/pySVModel/index.rst b/doc/pySVModel/index.rst index 7c8bb835..8a877206 100644 --- a/doc/pySVModel/index.rst +++ b/doc/pySVModel/index.rst @@ -1,3 +1,8 @@ +Python Class Reference +###################### + +Reference of all packages and modules: + .. toctree:: pySVModel diff --git a/setup.py b/setup.py index a6122da8..16a03e27 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ gitHubNamespace=gitHubNamespace, keywords="Python3 Verilog SystemVerilog Language Model Abstract", sourceFileWithVersion=packageInformationFile, - developmentStatus="beta", + developmentStatus="alpha", classifiers=list(DEFAULT_CLASSIFIERS) + [ "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)", "Topic :: Software Development :: Code Generators", From e1434c33236cfbaf0c868132deb5d0805ed885c2 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 1 Mar 2022 22:30:04 +0100 Subject: [PATCH 09/21] Bumped coverage version to v6.3. --- doc/Dependency.rst | 2 +- tests/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/Dependency.rst b/doc/Dependency.rst index 2e90a9ac..738082e7 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -61,7 +61,7 @@ the mandatory dependencies too. +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `pytest-cov `__ | ≥3.0.0 | `MIT `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `Coverage `__ | ≥6.2 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +| `Coverage `__ | ≥6.3 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `mypy `__ | ≥0.931 | `MIT `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ diff --git a/tests/requirements.txt b/tests/requirements.txt index 0320e3aa..f861877e 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,7 +1,7 @@ -r ../requirements.txt # Coverage collection -Coverage>=6.2 +Coverage>=6.3 # Test Runner pytest>=7.0.1 From 538944ceea7785bc93373fa690db7cfab2e41d9d Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 22 May 2022 15:27:17 +0200 Subject: [PATCH 10/21] Updated dependabot rules. --- .github/dependabot.yml | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index bc1dfd59..0e75a2d3 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,15 +1,29 @@ version: 2 updates: -- package-ecosystem: pip - directory: "/" - target-branch: dev - commit-message: - prefix: "[Dependabot]" - labels: - - Dependencies - assignees: - - Paebbels - reviewers: - - Paebbels - schedule: - interval: daily + # Maintain Python packages + - package-ecosystem: "pip" + directory: "/" + target-branch: dev + commit-message: + prefix: "[Dependabot]" + labels: + - Dependencies + reviewers: + - Paebbels + - Umarcor + schedule: + interval: "daily" # Checks on Monday trough Friday. + + # Maintain GitHub Action runners + - package-ecosystem: "github-actions" + directory: "/" + target-branch: dev + commit-message: + prefix: "[Dependabot]" + labels: + - Dependencies + reviewers: + - Paebbels + - Umarcor + schedule: + interval: "weekly" From 8b287e529b8d955596e20b3e69548cf3162dbf33 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 22 May 2022 15:27:42 +0200 Subject: [PATCH 11/21] Bumped dependencies. --- doc/Dependency.rst | 6 +++--- doc/conf.py | 2 +- doc/requirements.txt | 2 +- pyproject.toml | 2 +- requirements.txt | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/Dependency.rst b/doc/Dependency.rst index 738082e7..e91d40cb 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -29,7 +29,7 @@ pySVModel Package +--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +========================================================+=============+==========================================================================================+=================================================================================================================================+ -| `pyTooling `__ | ≥1.9.5 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥2.0.1 | `Apache License, 2.0 `__ | *None* | +--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ @@ -93,7 +93,7 @@ the mandatory dependencies too. +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +=================================================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥1.9.5 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥2.0.1 | `Apache License, 2.0 `__ | *None* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `Sphinx `__ | ≥4.4.0 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -129,7 +129,7 @@ install the mandatory dependencies too. +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +============================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥1.9.5 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥2.0.1 | `Apache License, 2.0 `__ | *None* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `wheel `__ | any | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/doc/conf.py b/doc/conf.py index 6ee4b96e..2aa216a6 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -64,7 +64,7 @@ with open(prologPath, "r") as prologFile: rst_prolog = prologFile.read() except Exception as ex: - print("[ERROR:] While reading '{0!s}'.".format(prologPath)) + print(f"[ERROR:] While reading '{prologPath}'.") print(ex) rst_prolog = "" diff --git a/doc/requirements.txt b/doc/requirements.txt index fe32d144..5c052642 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,6 +1,6 @@ -r ../requirements.txt -pyTooling>=1.9.5 +pyTooling>=2.0.1 # Enforce latest version on ReadTheDocs sphinx>=4.4.0 diff --git a/pyproject.toml b/pyproject.toml index c8eb2c39..23ac7ce8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "pyTooling >= 1.9.5", + "pyTooling >= 2.0.1", "setuptools >= 60.9.3", "wheel >= 0.37.1" ] diff --git a/requirements.txt b/requirements.txt index 7fb34c67..571c5f63 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -pyTooling>=1.9.5 +pyTooling>=2.0.1 From 63c109c6f4ae6e5f6feb525d93728f6d3553ee7d Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 22 May 2022 15:28:03 +0200 Subject: [PATCH 12/21] Fixed Python module index. --- doc/_templates/autoapi/module.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/_templates/autoapi/module.rst b/doc/_templates/autoapi/module.rst index 5f9e361b..655beff4 100644 --- a/doc/_templates/autoapi/module.rst +++ b/doc/_templates/autoapi/module.rst @@ -6,6 +6,8 @@ ``{{ node.name }}`` =={{ '=' * node.name|length }}== +.. py:module:: {{ node.name }} + {##} {%- block modules -%} {%- if subnodes %} From 0b4358189f12a442fa7710afc45aa977fa54c9dd Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Mon, 7 Nov 2022 00:47:45 +0100 Subject: [PATCH 13/21] Bumped dependencies. --- .idea/pySVModel.iml | 2 +- dist/requirements.txt | 2 +- doc/Dependency.rst | 24 ++++++++++++------------ doc/prolog.inc | 26 ++++++++++++++++++++++++++ doc/requirements.txt | 6 +++--- pyproject.toml | 4 ++-- requirements.txt | 2 +- tests/requirements.txt | 10 +++++----- 8 files changed, 51 insertions(+), 25 deletions(-) diff --git a/.idea/pySVModel.iml b/.idea/pySVModel.iml index 97e14814..eb934a99 100644 --- a/.idea/pySVModel.iml +++ b/.idea/pySVModel.iml @@ -8,7 +8,7 @@ - + \ No newline at end of file diff --git a/dist/requirements.txt b/dist/requirements.txt index 6c4932c1..e4718c94 100644 --- a/dist/requirements.txt +++ b/dist/requirements.txt @@ -1,2 +1,2 @@ -wheel +wheel>=0.38.1 twine diff --git a/doc/Dependency.rst b/doc/Dependency.rst index e91d40cb..39f442f5 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -29,7 +29,7 @@ pySVModel Package +--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +========================================================+=============+==========================================================================================+=================================================================================================================================+ -| `pyTooling `__ | ≥2.0.1 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥2.5.0 | `Apache License, 2.0 `__ | *None* | +--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ @@ -57,15 +57,15 @@ the mandatory dependencies too. +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | **Package** | **Version** | **License** | **Dependencies** | +===========================================================+=============+========================================================================================+======================+ -| `pytest `__ | ≥7.0.1 | `MIT `__ | *Not yet evaluated.* | +| `pytest `__ | ≥7.1.3 | `MIT `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `pytest-cov `__ | ≥3.0.0 | `MIT `__ | *Not yet evaluated.* | +| `pytest-cov `__ | ≥4.0.0 | `MIT `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `Coverage `__ | ≥6.3 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +| `Coverage `__ | ≥6.5 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `mypy `__ | ≥0.931 | `MIT `__ | *Not yet evaluated.* | +| `mypy `__ | ≥0.981 | `MIT `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `lxml `__ | ≥4.8 | `BSD 3-Clause `__ | *Not yet evaluated.* | +| `lxml `__ | ≥4.9 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ @@ -93,15 +93,15 @@ the mandatory dependencies too. +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +=================================================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥2.0.1 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥2.5.0 | `Apache License, 2.0 `__ | *None* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `Sphinx `__ | ≥4.4.0 | `BSD 3-Clause `__ | *Not yet evaluated.* | +| `Sphinx `__ | ≥5.3.0 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `sphinx_btd_theme `__ | ≥0.5.2 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | !! `sphinx_fontawesome `__ | ≥0.0.6 | `GPL 2.0 `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `sphinx_autodoc_typehints `__ | ≥1.17.0 | `MIT `__ | *Not yet evaluated.* | +| `sphinx_autodoc_typehints `__ | ≥1.19.5 | `MIT `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -129,9 +129,9 @@ install the mandatory dependencies too. +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +============================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥2.0.1 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥2.5.0 | `Apache License, 2.0 `__ | *None* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `wheel `__ | any | `MIT `__ | *Not yet evaluated.* | +| `wheel `__ | ≥0.38.1 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -160,7 +160,7 @@ install the mandatory dependencies too. +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ | **Package** | **Version** | **License** | **Dependencies** | +==========================================================+==============+===========================================================================================+======================+ -| `wheel `__ | any | `MIT `__ | *Not yet evaluated.* | +| `wheel `__ | ≥0.38.1 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ | `Twine `__ | any | `Apache License, 2.0 `__ | *Not yet evaluated.* | +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ diff --git a/doc/prolog.inc b/doc/prolog.inc index a3e09f25..75463a87 100644 --- a/doc/prolog.inc +++ b/doc/prolog.inc @@ -20,7 +20,12 @@ .. role:: bolditalic @@ -29,5 +34,26 @@ .. role:: underline :class: underline +.. role:: strike + :class: strike + .. role:: xlarge :class: xlarge + +.. role:: red + :class: colorred +.. role:: green + :class: colorgreen +.. role:: blue + :class: colorblue +.. role:: purple + :class: colorpurple + +.. role:: deletion + :class: colorred strike +.. role:: addition + :class: colorgreen + +.. role:: pycode(code) + :language: python + :class: highlight diff --git a/doc/requirements.txt b/doc/requirements.txt index 5c052642..dec2debc 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,12 +1,12 @@ -r ../requirements.txt -pyTooling>=2.0.1 +pyTooling>=2.5.0 # Enforce latest version on ReadTheDocs -sphinx>=4.4.0 +sphinx>=5.3.0 # Sphinx Extenstions sphinxcontrib-mermaid>=0.7.1 autoapi>=2.0.1 sphinx_fontawesome>=0.0.6 -sphinx_autodoc_typehints>=1.17.0 +sphinx_autodoc_typehints>=1.19.5 diff --git a/pyproject.toml b/pyproject.toml index 23ac7ce8..7b783ee9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [build-system] requires = [ - "pyTooling >= 2.0.1", + "pyTooling >= 2.5.0", "setuptools >= 60.9.3", - "wheel >= 0.37.1" + "wheel >= 0.38.1" ] build-backend = "setuptools.build_meta" diff --git a/requirements.txt b/requirements.txt index 571c5f63..7f3c5ed4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -pyTooling>=2.0.1 +pyTooling>=2.5.0 diff --git a/tests/requirements.txt b/tests/requirements.txt index f861877e..976fde43 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,12 +1,12 @@ -r ../requirements.txt # Coverage collection -Coverage>=6.3 +Coverage>=6.5 # Test Runner -pytest>=7.0.1 -pytest-cov>=3.0.0 +pytest>=7.1.3 +pytest-cov>=4.0.0 # Static Type Checking -mypy>=0.931 -lxml>=4.8 +mypy>=0.981 +lxml>=4.9 From 8e9922e9a8cd6637b895bed71d530045adba808b Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Mon, 7 Nov 2022 00:47:56 +0100 Subject: [PATCH 14/21] Updated pipeline. --- .github/workflows/Pipeline.yml | 80 ++++++++++++++-------------------- 1 file changed, 32 insertions(+), 48 deletions(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 2a6e51ea..023809a0 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -9,56 +9,55 @@ on: jobs: Params: - uses: pyTooling/Actions/.github/workflows/Parameters.yml@r0 + uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev with: name: pySVModel - python_version_list: "3.6 3.7 3.8 3.9 3.10" + exclude_list: "windows:3.11" UnitTesting: - uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@r0 + uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@dev needs: - Params with: jobs: ${{ needs.Params.outputs.python_jobs }} - artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }} + artifact: ${{ fromJson(needs.Params.outputs.artifact_names).unittesting_xml }} Coverage: - uses: pyTooling/Actions/.github/workflows/CoverageCollection.yml@r0 + uses: pyTooling/Actions/.github/workflows/CoverageCollection.yml@dev needs: - Params with: - python_version: ${{ fromJson(needs.Params.outputs.params).python_version }} - artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.coverage }} + python_version: ${{ needs.Params.outputs.python_version }} + artifact: ${{ fromJson(needs.Params.outputs.artifact_names).codecoverage_html }} secrets: codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }} StaticTypeCheck: - uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@r0 + uses: pyTooling/Actions/.github/workflows/StaticTypeCheck.yml@dev needs: - Params with: - python_version: ${{ fromJson(needs.Params.outputs.params).python_version }} + python_version: ${{ needs.Params.outputs.python_version }} commands: | mypy --html-report htmlmypy -p pySVModel - report: 'htmlmypy' - artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.typing }} + html_artifact: ${{ fromJson(needs.Params.outputs.artifact_names).statictyping_html }} PublishTestResults: - uses: pyTooling/Actions/.github/workflows/PublishTestResults.yml@r0 + uses: pyTooling/Actions/.github/workflows/PublishTestResults.yml@dev needs: - UnitTesting Package: - uses: pyTooling/Actions/.github/workflows/Package.yml@r0 + uses: pyTooling/Actions/.github/workflows/Package.yml@dev needs: - Params - Coverage with: - python_version: ${{ fromJson(needs.Params.outputs.params).python_version }} - artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.package }} + python_version: ${{ needs.Params.outputs.python_version }} + artifact: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }} Release: - uses: pyTooling/Actions/.github/workflows/Release.yml@r0 + uses: pyTooling/Actions/.github/workflows/Release.yml@dev if: startsWith(github.ref, 'refs/tags') needs: - UnitTesting @@ -67,48 +66,48 @@ jobs: - Package PublishOnPyPI: - uses: pyTooling/Actions/.github/workflows/PublishOnPyPI.yml@r0 + uses: pyTooling/Actions/.github/workflows/PublishOnPyPI.yml@dev if: startsWith(github.ref, 'refs/tags') needs: - Params - Release - Package with: - python_version: ${{ fromJson(needs.Params.outputs.params).python_version }} + python_version: ${{ needs.Params.outputs.python_version }} requirements: -r dist/requirements.txt - artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.package }} + artifact: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }} secrets: PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} # VerifyDocs: -# uses: pyTooling/Actions/.github/workflows/VerifyDocs.yml@r0 +# uses: pyTooling/Actions/.github/workflows/VerifyDocs.yml@dev # needs: # - Params # with: -# python_version: ${{ fromJson(needs.Params.outputs.params).python_version }} +# python_version: ${{ needs.Params.outputs.python_version }} BuildTheDocs: - uses: pyTooling/Actions/.github/workflows/BuildTheDocs.yml@r0 + uses: pyTooling/Actions/.github/workflows/BuildTheDocs.yml@dev needs: - Params # - VerifyDocs with: - artifact: ${{ fromJson(needs.Params.outputs.params).artifacts.doc }} + artifact: ${{ fromJson(needs.Params.outputs.artifact_names).documentation_html }} PublishToGitHubPages: - uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@r0 + uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@dev needs: - Params - BuildTheDocs - Coverage - StaticTypeCheck with: - doc: ${{ fromJson(needs.Params.outputs.params).artifacts.doc }} - coverage: ${{ fromJson(needs.Params.outputs.params).artifacts.coverage }} - typing: ${{ fromJson(needs.Params.outputs.params).artifacts.typing }} + doc: ${{ fromJson(needs.Params.outputs.artifact_names).documentation_html }} + coverage: ${{ fromJson(needs.Params.outputs.artifact_names).codecoverage_html }} + typing: ${{ fromJson(needs.Params.outputs.artifact_names).statictyping_html }} ArtifactCleanUp: - uses: pyTooling/Actions/.github/workflows/ArtifactCleanUp.yml@r0 + uses: pyTooling/Actions/.github/workflows/ArtifactCleanUp.yml@dev needs: - Params - UnitTesting @@ -118,24 +117,9 @@ jobs: - PublishToGitHubPages - PublishTestResults with: - package: ${{ fromJson(needs.Params.outputs.params).artifacts.package }} + package: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }} remaining: | - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-ubuntu-3.6 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-ubuntu-3.7 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-ubuntu-3.8 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-ubuntu-3.9 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-ubuntu-3.10 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-windows-3.6 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-windows-3.7 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-windows-3.8 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-windows-3.9 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-windows-3.10 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-msys2-3.9 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.6 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.7 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.8 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.9 - ${{ fromJson(needs.Params.outputs.params).artifacts.unittesting }}-macos-3.10 - ${{ fromJson(needs.Params.outputs.params).artifacts.coverage }} - ${{ fromJson(needs.Params.outputs.params).artifacts.typing }} - ${{ fromJson(needs.Params.outputs.params).artifacts.doc }} + ${{ fromJson(needs.Params.outputs.artifact_names).unittesting_xml }}-* + ${{ fromJson(needs.Params.outputs.artifact_names).codecoverage_html }} + ${{ fromJson(needs.Params.outputs.artifact_names).statictyping_html }} + ${{ fromJson(needs.Params.outputs.artifact_names).documentation_html }} From 9d0501ca429eb997c26ef6f7c59e7302d1aa80ff Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 18 Dec 2022 23:22:59 +0100 Subject: [PATCH 15/21] Bumped dependencies. --- doc/Dependency.rst | 12 ++++++------ doc/requirements.txt | 2 +- pyproject.toml | 2 +- requirements.txt | 2 +- tests/requirements.txt | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/Dependency.rst b/doc/Dependency.rst index 39f442f5..5e264a6b 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -29,7 +29,7 @@ pySVModel Package +--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +========================================================+=============+==========================================================================================+=================================================================================================================================+ -| `pyTooling `__ | ≥2.5.0 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥2.7.0 | `Apache License, 2.0 `__ | *None* | +--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ @@ -57,13 +57,13 @@ the mandatory dependencies too. +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | **Package** | **Version** | **License** | **Dependencies** | +===========================================================+=============+========================================================================================+======================+ -| `pytest `__ | ≥7.1.3 | `MIT `__ | *Not yet evaluated.* | +| `pytest `__ | ≥7.2.0 | `MIT `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `pytest-cov `__ | ≥4.0.0 | `MIT `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `Coverage `__ | ≥6.5 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +| `Coverage `__ | ≥7.0 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `mypy `__ | ≥0.981 | `MIT `__ | *Not yet evaluated.* | +| `mypy `__ | ≥0.990 | `MIT `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `lxml `__ | ≥4.9 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ @@ -93,7 +93,7 @@ the mandatory dependencies too. +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +=================================================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥2.5.0 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥2.7.0 | `Apache License, 2.0 `__ | *None* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `Sphinx `__ | ≥5.3.0 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -129,7 +129,7 @@ install the mandatory dependencies too. +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +============================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥2.5.0 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥2.7.0 | `Apache License, 2.0 `__ | *None* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `wheel `__ | ≥0.38.1 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/doc/requirements.txt b/doc/requirements.txt index dec2debc..454a1820 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,6 +1,6 @@ -r ../requirements.txt -pyTooling>=2.5.0 +pyTooling>=2.7.0 # Enforce latest version on ReadTheDocs sphinx>=5.3.0 diff --git a/pyproject.toml b/pyproject.toml index 7b783ee9..0dcb29b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "pyTooling >= 2.5.0", + "pyTooling >= 2.7.0", "setuptools >= 60.9.3", "wheel >= 0.38.1" ] diff --git a/requirements.txt b/requirements.txt index 7f3c5ed4..7dfcd153 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -pyTooling>=2.5.0 +pyTooling>=2.7.0 diff --git a/tests/requirements.txt b/tests/requirements.txt index 976fde43..7719481f 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,12 +1,12 @@ -r ../requirements.txt # Coverage collection -Coverage>=6.5 +Coverage>=7.0 # Test Runner -pytest>=7.1.3 +pytest>=7.2.0 pytest-cov>=4.0.0 # Static Type Checking -mypy>=0.981 +mypy>=0.990 lxml>=4.9 From 4ea4d6b897b0e720a10087928ee4ac653cb3cd58 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 18 Dec 2022 23:23:08 +0100 Subject: [PATCH 16/21] Code cleanup. --- doc/conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index 2aa216a6..7a98d3a4 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -59,10 +59,10 @@ # ============================================================================== # Restructured Text settings # ============================================================================== -prologPath = "prolog.inc" +prologPath = Path("prolog.inc") try: - with open(prologPath, "r") as prologFile: - rst_prolog = prologFile.read() + with prologPath.open("r") as fileHandle: + rst_prolog = fileHandle.read() except Exception as ex: print(f"[ERROR:] While reading '{prologPath}'.") print(ex) From d4b6a6fd4c5a9143e4979ef8c2a72331c367b69f Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sun, 18 Dec 2022 23:23:15 +0100 Subject: [PATCH 17/21] Enabled Windows + Python 3.11 again. --- .github/workflows/Pipeline.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml index 023809a0..a1d4c4bd 100644 --- a/.github/workflows/Pipeline.yml +++ b/.github/workflows/Pipeline.yml @@ -12,7 +12,6 @@ jobs: uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev with: name: pySVModel - exclude_list: "windows:3.11" UnitTesting: uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@dev From 52fe8ee69604f563477a82dfe0f0e67e069ed691 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Thu, 6 Jul 2023 00:11:26 +0200 Subject: [PATCH 18/21] Bumped dependencies. --- .idea/modules.xml | 4 ++-- doc/Dependency.rst | 6 +++--- doc/requirements.txt | 2 +- pyproject.toml | 2 +- requirements.txt | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.idea/modules.xml b/.idea/modules.xml index 044a2c3b..cba29ed8 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,7 +2,7 @@ - + - \ No newline at end of file + diff --git a/doc/Dependency.rst b/doc/Dependency.rst index 5e264a6b..fe01569d 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -29,7 +29,7 @@ pySVModel Package +--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +========================================================+=============+==========================================================================================+=================================================================================================================================+ -| `pyTooling `__ | ≥2.7.0 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥5.0.0 | `Apache License, 2.0 `__ | *None* | +--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ @@ -93,7 +93,7 @@ the mandatory dependencies too. +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +=================================================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥2.7.0 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥5.0.0 | `Apache License, 2.0 `__ | *None* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `Sphinx `__ | ≥5.3.0 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -129,7 +129,7 @@ install the mandatory dependencies too. +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Package** | **Version** | **License** | **Dependencies** | +============================================================================+==============+==========================================================================================================+======================================================================================================================================================+ -| `pyTooling `__ | ≥2.7.0 | `Apache License, 2.0 `__ | *None* | +| `pyTooling `__ | ≥5.0.0 | `Apache License, 2.0 `__ | *None* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | `wheel `__ | ≥0.38.1 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ diff --git a/doc/requirements.txt b/doc/requirements.txt index 454a1820..8c659351 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,6 +1,6 @@ -r ../requirements.txt -pyTooling>=2.7.0 +pyTooling >= 5.0.0 # Enforce latest version on ReadTheDocs sphinx>=5.3.0 diff --git a/pyproject.toml b/pyproject.toml index 0dcb29b0..9d49cf9c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] requires = [ - "pyTooling >= 2.7.0", + "pyTooling >= 5.0.0", "setuptools >= 60.9.3", "wheel >= 0.38.1" ] diff --git a/requirements.txt b/requirements.txt index 7dfcd153..07307ec0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -pyTooling>=2.7.0 +pyTooling >= 5.0.0 From 9398c01052f71922d27c2535f39ab83358f087f4 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 15 Jul 2023 23:01:36 +0200 Subject: [PATCH 19/21] Bumped dependencies. --- dist/requirements.txt | 4 ++-- doc/Dependency.rst | 8 ++++---- pySVModel/__init__.py | 6 +++--- pyproject.toml | 4 ++-- setup.py | 2 +- tests/requirements.txt | 2 +- tests/unit/Instantiate.py | 2 +- tests/unit/__init__.py | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dist/requirements.txt b/dist/requirements.txt index e4718c94..a414030a 100644 --- a/dist/requirements.txt +++ b/dist/requirements.txt @@ -1,2 +1,2 @@ -wheel>=0.38.1 -twine +wheel >= 0.40.0 +twine >= 4.0.2 diff --git a/doc/Dependency.rst b/doc/Dependency.rst index fe01569d..bbeeaea1 100644 --- a/doc/Dependency.rst +++ b/doc/Dependency.rst @@ -63,7 +63,7 @@ the mandatory dependencies too. +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `Coverage `__ | ≥7.0 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ -| `mypy `__ | ≥0.990 | `MIT `__ | *Not yet evaluated.* | +| `mypy `__ | ≥1.2 | `MIT `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ | `lxml `__ | ≥4.9 | `BSD 3-Clause `__ | *Not yet evaluated.* | +-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ @@ -131,7 +131,7 @@ install the mandatory dependencies too. +============================================================================+==============+==========================================================================================================+======================================================================================================================================================+ | `pyTooling `__ | ≥5.0.0 | `Apache License, 2.0 `__ | *None* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ -| `wheel `__ | ≥0.38.1 | `MIT `__ | *Not yet evaluated.* | +| `wheel `__ | ≥0.40.0 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ @@ -160,7 +160,7 @@ install the mandatory dependencies too. +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ | **Package** | **Version** | **License** | **Dependencies** | +==========================================================+==============+===========================================================================================+======================+ -| `wheel `__ | ≥0.38.1 | `MIT `__ | *Not yet evaluated.* | +| `wheel `__ | ≥0.40.0 | `MIT `__ | *Not yet evaluated.* | +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ -| `Twine `__ | any | `Apache License, 2.0 `__ | *Not yet evaluated.* | +| `Twine `__ | ≥4.0.2 | `Apache License, 2.0 `__ | *Not yet evaluated.* | +----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ diff --git a/pySVModel/__init__.py b/pySVModel/__init__.py index ea000294..38cf6752 100644 --- a/pySVModel/__init__.py +++ b/pySVModel/__init__.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2021-2022 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2021-2023 Patrick Lehmann - Boetzingen, Germany # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # @@ -31,7 +31,7 @@ """ An abstract SystemVerilog language model. -:copyright: Copyright 2021-2022 Patrick Lehmann - Bötzingen, Germany +:copyright: Copyright 2021-2023 Patrick Lehmann - Bötzingen, Germany :license: Apache License, Version 2.0 """ from enum import unique, Enum @@ -42,7 +42,7 @@ __author__ = "Patrick Lehmann" __email__ = "Paebbels@gmail.com" -__copyright__ = "2021-2022, Patrick Lehmann" +__copyright__ = "2021-2023, Patrick Lehmann" __license__ = "Apache License, Version 2.0" __version__ = "0.3.6" diff --git a/pyproject.toml b/pyproject.toml index 9d49cf9c..1281d4b5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,8 @@ [build-system] requires = [ "pyTooling >= 5.0.0", - "setuptools >= 60.9.3", - "wheel >= 0.38.1" + "setuptools >= 68.0.0", + "wheel >= 0.40.0" ] build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 16a03e27..98381360 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2021-2022 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2021-2023 Patrick Lehmann - Boetzingen, Germany # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # diff --git a/tests/requirements.txt b/tests/requirements.txt index 7719481f..6407e55c 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -8,5 +8,5 @@ pytest>=7.2.0 pytest-cov>=4.0.0 # Static Type Checking -mypy>=0.990 +mypy >= 1.2 lxml>=4.9 diff --git a/tests/unit/Instantiate.py b/tests/unit/Instantiate.py index 40c06d9f..981bd3b5 100644 --- a/tests/unit/Instantiate.py +++ b/tests/unit/Instantiate.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2021-2022 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2021-2023 Patrick Lehmann - Boetzingen, Germany # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py index cb1597e6..d7f3e0b9 100644 --- a/tests/unit/__init__.py +++ b/tests/unit/__init__.py @@ -11,7 +11,7 @@ # # # License: # # ==================================================================================================================== # -# Copyright 2021-2022 Patrick Lehmann - Boetzingen, Germany # +# Copyright 2021-2023 Patrick Lehmann - Boetzingen, Germany # # # # Licensed under the Apache License, Version 2.0 (the "License"); # # you may not use this file except in compliance with the License. # From 848c4e4d16525433f49da5ad399d19ab1ad306f6 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Sat, 29 Jul 2023 23:36:55 +0200 Subject: [PATCH 20/21] Updated pyproject file. --- pyproject.toml | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1281d4b5..5edb2ebb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,36 +1,55 @@ [build-system] requires = [ - "pyTooling >= 5.0.0", - "setuptools >= 68.0.0", - "wheel >= 0.40.0" + "setuptools >= 68.0.0", + "wheel >= 0.40.0", + "pyTooling >= 5.0.0" ] build-backend = "setuptools.build_meta" [tool.black] line-length = 120 +[tool.mypy] +python_version = "3.11" +namespace_packages = true + +pretty = true +show_error_context = true + +html_report = "report/typing" + [tool.pytest.ini_options] # Don't set 'python_classes = *' otherwise, pytest doesn't search for classes # derived from unittest.Testcase python_files = "*" python_functions = "test_*" +filterwarnings = [ + "error::DeprecationWarning", + "error::PendingDeprecationWarning" +] [tool.coverage.run] branch = true omit = [ "*site-packages*", - "setup.py" + "setup.py", + "tests/*" ] [tool.coverage.report] -skip_covered = true +skip_covered = false skip_empty = true exclude_lines = [ + "pragma: no cover", "raise NotImplementedError" ] +omit = [ + "tests/*" +] [tool.coverage.html] directory = "report/coverage/html" +title="Code Coverage of pySVModel" [tool.coverage.xml] output = "report/coverage/coverage.xml" From f2923ada2611c110c20d6f40edf76717c86475c2 Mon Sep 17 00:00:00 2001 From: Patrick Lehmann Date: Tue, 1 Aug 2023 23:50:36 +0200 Subject: [PATCH 21/21] Merged VerilogVersion and SystemVerilogVersion. --- pySVModel/__init__.py | 123 ++++++++++++--------------------- tests/unit/Instantiate.py | 140 +++++++++++++++++++++++++++++++++++--- 2 files changed, 173 insertions(+), 90 deletions(-) diff --git a/pySVModel/__init__.py b/pySVModel/__init__.py index 38cf6752..a313aa74 100644 --- a/pySVModel/__init__.py +++ b/pySVModel/__init__.py @@ -34,7 +34,7 @@ :copyright: Copyright 2021-2023 Patrick Lehmann - Bötzingen, Germany :license: Apache License, Version 2.0 """ -from enum import unique, Enum +from enum import unique, Enum from typing import Dict, Union from pyTooling.Decorators import export @@ -44,97 +44,50 @@ __email__ = "Paebbels@gmail.com" __copyright__ = "2021-2023, Patrick Lehmann" __license__ = "Apache License, Version 2.0" -__version__ = "0.3.6" - - -@export -@unique -class VerilogVersion(Enum): - Any = -1 - Verilog95 = 95 - Verilog2001 = 2001 - Verilog2005 = 2005 - - __VERSION_MAPPINGS__: Dict[Union[int, str], Enum] = { - 95: Verilog95, - 1: Verilog2001, - 5: Verilog2005, - 1995: Verilog95, - 2001: Verilog2001, - 2005: Verilog2005, - "Any": Any, - "95": Verilog95, - "01": Verilog2001, - "05": Verilog2005, - "1995": Verilog95, - "2001": Verilog2001, - "2005": Verilog2005, - } - - def __init__(self, *_): - """Patch the embedded MAP dictionary""" - for k, v in self.__class__.__VERSION_MAPPINGS__.items(): - if (not isinstance(v, self.__class__)) and (v == self.value): - self.__class__.__VERSION_MAPPINGS__[k] = self - - @classmethod - def Parse(cls, value): - try: - return cls.__VERSION_MAPPINGS__[value] - except KeyError: - ValueError("Value '{0!s}' cannot be parsed to member of {1}.".format(value, cls.__name__)) - - def __lt__(self, other): - return self.value < other.value - - def __le__(self, other): - return self.value <= other.value - - def __gt__(self, other): - return self.value > other.value - - def __ge__(self, other): - return self.value >= other.value - - def __ne__(self, other): - return self.value != other.value - - def __eq__(self, other): - if (self is self.__class__.Any) or (other is self.__class__.Any): - return True - else: - return self.value == other.value - - def __str__(self): - return "Verilog'" + str(self.value)[-2:] - - def __repr__(self): - return str(self.value) +__version__ = "0.4.0" @export @unique class SystemVerilogVersion(Enum): Any = -1 + + Verilog95 = 95 + Verilog2001 = 1 + Verilog2005 = 5 + SystemVerilog2005 = 2005 SystemVerilog2009 = 2009 SystemVerilog2012 = 2012 SystemVerilog2017 = 2017 __VERSION_MAPPINGS__: Dict[Union[int, str], Enum] = { - 5: SystemVerilog2005, + -1: Any, + 95: Verilog95, + 1: Verilog2001, + 5: Verilog2005, + # 5: SystemVerilog2005, # prefer Verilog on numbers below 2000 9: SystemVerilog2009, 12: SystemVerilog2012, 17: SystemVerilog2017, + 1995: Verilog95, + 2001: Verilog2001, + # 2005: Verilog2005, # prefer SystemVerilog on numbers above 2000 2005: SystemVerilog2005, 2009: SystemVerilog2009, 2012: SystemVerilog2012, 2017: SystemVerilog2017, "Any": Any, - "05": SystemVerilog2005, + "95": Verilog95, + "01": Verilog2001, + "05": Verilog2005, + # "05": SystemVerilog2005, # prefer Verilog on numbers below 2000 "09": SystemVerilog2009, "12": SystemVerilog2012, "17": SystemVerilog2017, + "1995": Verilog95, + "2001": Verilog2001, + # "2005": Verilog2005, # prefer SystemVerilog on numbers above 2000 "2005": SystemVerilog2005, "2009": SystemVerilog2009, "2012": SystemVerilog2012, @@ -148,35 +101,43 @@ def __init__(self, *_): self.__class__.__VERSION_MAPPINGS__[k] = self @classmethod - def Parse(cls, value): + def Parse(cls, value: Union[int, str]) -> "SystemVerilogVersion": try: return cls.__VERSION_MAPPINGS__[value] except KeyError: - ValueError("Value '{0!s}' cannot be parsed to member of {1}.".format(value, cls.__name__)) + raise ValueError("Value '{0!s}' cannot be parsed to member of {1}.".format(value, cls.__name__)) - def __lt__(self, other): + def __lt__(self, other) -> bool: return self.value < other.value - def __le__(self, other): + def __le__(self, other) -> bool: return self.value <= other.value - def __gt__(self, other): + def __gt__(self, other) -> bool: return self.value > other.value - def __ge__(self, other): + def __ge__(self, other) -> bool: return self.value >= other.value - def __ne__(self, other): + def __ne__(self, other) -> bool: return self.value != other.value - def __eq__(self, other): + def __eq__(self, other) -> bool: if (self is self.__class__.Any) or (other is self.__class__.Any): return True else: return self.value == other.value - def __str__(self): - return "SV'" + str(self.value)[-2:] + def __str__(self) -> str: + if self.value == -1: + return "SV'Any" + elif self.value < self.SystemVerilog2005.value: + return "Verilog'" + str(self.value)[-2:] + else: + return "SV'" + str(self.value)[-2:] - def __repr__(self): - return str(self.value) + def __repr__(self) -> str: + if self.value == -1: + return "Any" + else: + return str(self.value) diff --git a/tests/unit/Instantiate.py b/tests/unit/Instantiate.py index 981bd3b5..f265e2ca 100644 --- a/tests/unit/Instantiate.py +++ b/tests/unit/Instantiate.py @@ -29,9 +29,9 @@ # ==================================================================================================================== # # """Instantiation tests for the language model.""" -from unittest import TestCase +from unittest import TestCase -from pySVModel import VerilogVersion, SystemVerilogVersion +from pySVModel import SystemVerilogVersion if __name__ == "__main__": # pragma: no cover @@ -40,13 +40,135 @@ exit(1) -class Instantiate(TestCase): - def test_VerilogVersion(self): - version = VerilogVersion.Parse("95") +class SVVersion(TestCase): + def test_Any(self): + versions = ( + SystemVerilogVersion.Parse(-1), + SystemVerilogVersion.Parse("Any"), + ) - self.assertIsNotNone(version) + for version in versions: + self.assertIs(SystemVerilogVersion.Any, version) - def test_SystemVerilogVersion(self): - version = SystemVerilogVersion.Parse("2017") + print() + print(version) + print(version.value) - self.assertIsNotNone(version) + def test_V1995(self): + versions = ( + SystemVerilogVersion.Parse(95), + SystemVerilogVersion.Parse(1995), + SystemVerilogVersion.Parse("95"), + SystemVerilogVersion.Parse("1995"), + ) + + for version in versions: + self.assertIs(SystemVerilogVersion.Verilog95, version) + + print() + print(version) + print(version.value) + + def test_V2001(self): + versions = ( + SystemVerilogVersion.Parse(1), + SystemVerilogVersion.Parse(2001), + SystemVerilogVersion.Parse("01"), + SystemVerilogVersion.Parse("2001"), + ) + + for version in versions: + self.assertIs(SystemVerilogVersion.Verilog2001, version) + + print() + print(version) + print(version.value) + + def test_V2005(self): + versions = ( + SystemVerilogVersion.Parse(5), + # SystemVerilogVersion.Parse(2005), + SystemVerilogVersion.Parse("05"), + # SystemVerilogVersion.Parse("2005"), + ) + + for version in versions: + self.assertIs(SystemVerilogVersion.Verilog2005, version) + + print() + print(version) + print(version.value) + + def test_SV2005(self): + versions = ( + # SystemVerilogVersion.Parse(5), + SystemVerilogVersion.Parse(2005), + # SystemVerilogVersion.Parse("05"), + SystemVerilogVersion.Parse("2005"), + ) + + for version in versions: + self.assertIs(SystemVerilogVersion.SystemVerilog2005, version) + + print() + print(version) + print(version.value) + + def test_SV2009(self): + versions = ( + SystemVerilogVersion.Parse(9), + SystemVerilogVersion.Parse(2009), + SystemVerilogVersion.Parse("09"), + SystemVerilogVersion.Parse("2009"), + ) + + for version in versions: + self.assertIs(SystemVerilogVersion.SystemVerilog2009, version) + + print() + print(version) + print(version.value) + + def test_SV2012(self): + versions = ( + SystemVerilogVersion.Parse(12), + SystemVerilogVersion.Parse(2012), + SystemVerilogVersion.Parse("12"), + SystemVerilogVersion.Parse("2012"), + ) + + for version in versions: + self.assertIs(SystemVerilogVersion.SystemVerilog2012, version) + + print() + print(version) + print(version.value) + + def test_SV2017(self): + versions = ( + SystemVerilogVersion.Parse(17), + SystemVerilogVersion.Parse(2017), + SystemVerilogVersion.Parse("17"), + SystemVerilogVersion.Parse("2017"), + ) + + for version in versions: + self.assertIs(SystemVerilogVersion.SystemVerilog2017, version) + + print() + print(version) + print(version.value) + + def test_IntError(self): + with self.assertRaises(ValueError): + _ = SystemVerilogVersion.Parse(0) + + with self.assertRaises(ValueError): + _ = SystemVerilogVersion.Parse(13) + + def test_StrError(self): + with self.assertRaises(ValueError): + _ = SystemVerilogVersion.Parse("0") + + with self.assertRaises(ValueError): + _ = SystemVerilogVersion.Parse("13")