diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index 0896e81d..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:
+ # Maintain Python packages
+ - package-ecosystem: "pip"
+ directory: "/"
+ target-branch: dev
+ commit-message:
+ prefix: "[Dependabot]"
+ labels:
- Dependencies
- assignees:
- - Paebbels
- reviewers:
- - Paebbels
- schedule:
- interval: daily
+ 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"
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/.github/workflows/Pipeline.yml b/.github/workflows/Pipeline.yml
index ea442d7a..a1d4c4bd 100644
--- a/.github/workflows/Pipeline.yml
+++ b/.github/workflows/Pipeline.yml
@@ -9,55 +9,54 @@ on:
jobs:
Params:
- uses: pyTooling/Actions/.github/workflows/Parameters.yml@r0
+ uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev
with:
name: pySVModel
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
@@ -66,48 +65,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
@@ -117,21 +116,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.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.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.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 }}
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/.idea/pySVModel.iml b/.idea/pySVModel.iml
index 54123544..eb934a99 100644
--- a/.idea/pySVModel.iml
+++ b/.idea/pySVModel.iml
@@ -6,8 +6,9 @@
+
-
+
\ No newline at end of file
diff --git a/dist/requirements.txt b/dist/requirements.txt
index 6c4932c1..a414030a 100644
--- a/dist/requirements.txt
+++ b/dist/requirements.txt
@@ -1,2 +1,2 @@
-wheel
-twine
+wheel >= 0.40.0
+twine >= 4.0.2
diff --git a/doc/Dependency.rst b/doc/Dependency.rst
index f52ffa67..bbeeaea1 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 `__ | ≥5.0.0 | `Apache License, 2.0 `__ | *None* |
+--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+
@@ -57,15 +57,15 @@ the mandatory dependencies too.
+-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+
| **Package** | **Version** | **License** | **Dependencies** |
+===========================================================+=============+========================================================================================+======================+
-| `pytest `__ | ≥6.2.5 | `MIT `__ | *Not yet evaluated.* |
+| `pytest `__ | ≥7.2.0 | `MIT `__ | *Not yet evaluated.* |
+-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+
-| `pytest-cov `__ | ≥3.0.0 | `MIT `__ | *Not yet evaluated.* |
+| `pytest-cov `__ | ≥4.0.0 | `MIT `__ | *Not yet evaluated.* |
+-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+
-| `Coverage `__ | ≥6.2 | `Apache License, 2.0 `__ | *Not yet evaluated.* |
+| `Coverage `__ | ≥7.0 | `Apache License, 2.0 `__ | *Not yet evaluated.* |
+-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+
-| `mypy `__ | ≥0.931 | `MIT `__ | *Not yet evaluated.* |
+| `mypy `__ | ≥1.2 | `MIT `__ | *Not yet evaluated.* |
+-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+
-| `lxml `__ | ≥4.6.4 | `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 `__ | ≥1.9.2 | `Apache License, 2.0 `__ | *None* |
+| `pyTooling `__ | ≥5.0.0 | `Apache License, 2.0 `__ | *None* |
+-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
-| `Sphinx `__ | ≥4.3.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.14.1 | `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 `__ | ≥1.9.2 | `Apache License, 2.0 `__ | *None* |
+| `pyTooling `__ | ≥5.0.0 | `Apache License, 2.0 `__ | *None* |
+----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+
-| `wheel `__ | any | `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 `__ | any | `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/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/_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
index 8ded38ea..655beff4 100644
--- a/doc/_templates/autoapi/module.rst
+++ b/doc/_templates/autoapi/module.rst
@@ -1,16 +1,20 @@
-{{ node.name }}
+.. # 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 }}
+.. py:module:: {{ node.name }}
{##}
{%- block modules -%}
{%- if subnodes %}
-.. #-----------------------------------
-{##}
**Submodules**
+
.. toctree::
{% for item in subnodes %}
{{ item.name }}
@@ -21,123 +25,85 @@
{##}
.. currentmodule:: {{ node.name }}
{##}
+{%- block functions -%}
+{%- if node.functions %}
-.. #-----------------------------------
-{##}
-{%- if node.variables %}
-**Variables**
-{##}
-{% for item, obj in node.variables.items() -%}
-- :py:data:`{{ item }}`
-{% endfor -%}
-{%- endif -%}
-
+**Functions**
-{%- if node.exceptions %}
-{##}
-**Exceptions**
-{##}
-{% for item, obj in node.exceptions.items() -%}
-- :py:exc:`{{ item }}`:
+{% for item, obj in node.functions.items() -%}
+- :py:func:`{{ item }}`:
{{ obj|summary }}
{% endfor -%}
-{%- endif -%}
+{% 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 -%}
-{%- 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
+{% for item in node.classes %}
+.. autoclass:: {{ item }}
+ :members:
- {{ obj|pprint|indent(6) }}
+ .. rubric:: Inheritance
+ .. inheritance-diagram:: {{ item }}
+ :parts: 1
{##}
{%- 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 -%}
+**Exceptions**
+{% for item, obj in node.exceptions.items() -%}
+- :py:exc:`{{ item }}`:
+ {{ obj|summary }}
-{%- block classes -%}
-{%- if node.classes %}
+{% endfor -%}
-.. #-----------------------------------
+{% for item in node.exceptions %}
+.. autoexception:: {{ item }}
-{% 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 variables -%}
+{%- if node.variables %}
-{%- block functions -%}
-{%- if node.functions %}
+**Variables**
-.. #-----------------------------------
+{% for item, obj in node.variables.items() -%}
+- :py:data:`{{ item }}`
+{% endfor -%}
-**Functions**
+{% for item, obj in node.variables.items() %}
+.. autodata:: {{ item }}
+ :annotation:
-{% for item in node.functions %}
-.. autofunction:: {{ item }}
+ .. code-block:: text
+
+ {{ obj|pprint|indent(6) }}
{##}
{%- endfor -%}
{%- endif -%}
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 0da0f093..7a98d3a4 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'))
# ==============================================================================
@@ -25,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
@@ -60,12 +59,12 @@
# ==============================================================================
# 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("[ERROR:] While reading '{0!s}'.".format(prologPath))
+ print(f"[ERROR:] While reading '{prologPath}'.")
print(ex)
rst_prolog = ""
@@ -154,7 +153,6 @@
]
-
# ==============================================================================
# Extensions
# ==============================================================================
@@ -169,30 +167,12 @@
'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',
-
+ 'sphinxcontrib.mermaid',
# Other extensions
-# 'DocumentMember',
'sphinx_fontawesome',
'sphinx_autodoc_typehints',
-
-# local extensions (patched)
'autoapi.sphinx',
-
-# local extensions
-# 'DocumentMember'
]
# ==============================================================================
@@ -207,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"
+
# ==============================================================================
@@ -216,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/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/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/doc/requirements.txt b/doc/requirements.txt
index 48fdad5f..8c659351 100644
--- a/doc/requirements.txt
+++ b/doc/requirements.txt
@@ -1,12 +1,12 @@
-r ../requirements.txt
-pyTooling>=1.9.2
+pyTooling >= 5.0.0
# Enforce latest version on ReadTheDocs
-sphinx>=4.3.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.14.1
+sphinx_autodoc_typehints>=1.19.5
diff --git a/pySVModel/__init__.py b/pySVModel/__init__.py
index 1b445412..a313aa74 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,10 +31,10 @@
"""
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
+from enum import unique, Enum
from typing import Dict, Union
from pyTooling.Decorators import export
@@ -42,99 +42,52 @@
__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.5"
-
-
-@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/pyproject.toml b/pyproject.toml
index 4fbec4ea..5edb2ebb 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,36 +1,55 @@
[build-system]
requires = [
- "pyTooling >= 1.9.2",
- "setuptools >= 35.0.2",
- "wheel >= 0.29.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"
diff --git a/requirements.txt b/requirements.txt
index af16e2f0..07307ec0 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1 +1 @@
-pyTooling>=1.9.2
+pyTooling >= 5.0.0
diff --git a/setup.py b/setup.py
index a6122da8..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. #
@@ -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",
diff --git a/tests/requirements.txt b/tests/requirements.txt
index e71c276a..6407e55c 100644
--- a/tests/requirements.txt
+++ b/tests/requirements.txt
@@ -1,12 +1,12 @@
-r ../requirements.txt
# Coverage collection
-Coverage>=6.2
+Coverage>=7.0
# Test Runner
-pytest>=6.2.5
-pytest-cov>=3.0.0
+pytest>=7.2.0
+pytest-cov>=4.0.0
# Static Type Checking
-mypy>=0.931
-lxml>=4.6
+mypy >= 1.2
+lxml>=4.9
diff --git a/tests/unit/Instantiate.py b/tests/unit/Instantiate.py
index 40c06d9f..f265e2ca 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. #
@@ -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")
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. #