diff --git a/.btd.yml b/.btd.yml new file mode 100644 index 0000000..11133ad --- /dev/null +++ b/.btd.yml @@ -0,0 +1,9 @@ +input: doc +output: _build +requirements: requirements.txt +target: gh-pages +formats: [ html, pdf, man ] +images: + base: btdi/sphinx:pytooling + latex: btdi/latex +theme: https://codeload.GitHub.com/buildthedocs/sphinx.theme/tar.gz/v1 diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..3c7043c --- /dev/null +++ b/.editorconfig @@ -0,0 +1,30 @@ +root = true + +[*] +charset = utf-8 +# end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = tab +indent_size = 2 +tab_width = 2 + + +[*.py] +indent_style = tab +indent_size = 2 + +[*.{yml,yaml}] +indent_style = space +indent_size = 2 + +[*.{json,ini}] +indent_style = tab +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false + +[*.rst] +indent_style = space +indent_size = 3 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0e75a2d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,29 @@ +version: 2 +updates: + # 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" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..ac698f8 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +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 new file mode 100644 index 0000000..88bccf0 --- /dev/null +++ b/.github/workflows/Pipeline.yml @@ -0,0 +1,124 @@ +name: Pipeline + +on: + push: + workflow_dispatch: + schedule: + - cron: '0 0 * * 5' + +jobs: + + Params: + uses: pyTooling/Actions/.github/workflows/Parameters.yml@dev + with: + name: pySystemRDLModel + + UnitTesting: + uses: pyTooling/Actions/.github/workflows/UnitTesting.yml@dev + needs: + - Params + with: + jobs: ${{ needs.Params.outputs.python_jobs }} + artifact: ${{ fromJson(needs.Params.outputs.artifact_names).unittesting_xml }} + + Coverage: + uses: pyTooling/Actions/.github/workflows/CoverageCollection.yml@dev + needs: + - Params + with: + 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@dev + needs: + - Params + with: + python_version: ${{ needs.Params.outputs.python_version }} + commands: | + mypy --html-report htmlmypy -p pySystemRDLModel + html_artifact: ${{ fromJson(needs.Params.outputs.artifact_names).statictyping_html }} + + PublishTestResults: + uses: pyTooling/Actions/.github/workflows/PublishTestResults.yml@dev + needs: + - UnitTesting + + Package: + uses: pyTooling/Actions/.github/workflows/Package.yml@dev + needs: + - Params + - Coverage + with: + python_version: ${{ needs.Params.outputs.python_version }} + artifact: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }} + + Release: + uses: pyTooling/Actions/.github/workflows/Release.yml@dev + if: startsWith(github.ref, 'refs/tags') + needs: + - UnitTesting + - Coverage + - StaticTypeCheck + - Package + + PublishOnPyPI: + uses: pyTooling/Actions/.github/workflows/PublishOnPyPI.yml@dev + if: startsWith(github.ref, 'refs/tags') + needs: + - Params + - Release + - Package + with: + python_version: ${{ needs.Params.outputs.python_version }} + requirements: -r dist/requirements.txt + artifact: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }} + secrets: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + +# VerifyDocs: +# uses: pyTooling/Actions/.github/workflows/VerifyDocs.yml@dev +# needs: +# - Params +# with: +# python_version: ${{ needs.Params.outputs.python_version }} + + BuildTheDocs: + uses: pyTooling/Actions/.github/workflows/BuildTheDocs.yml@dev + needs: + - Params +# - VerifyDocs + with: + artifact: ${{ fromJson(needs.Params.outputs.artifact_names).documentation_html }} + + PublishToGitHubPages: + uses: pyTooling/Actions/.github/workflows/PublishToGitHubPages.yml@dev + needs: + - Params + - BuildTheDocs + - Coverage + - StaticTypeCheck + with: + 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@dev + needs: + - Params + - UnitTesting + - Coverage + - StaticTypeCheck + - BuildTheDocs + - PublishToGitHubPages + - PublishTestResults + with: + package: ${{ fromJson(needs.Params.outputs.artifact_names).package_all }} + remaining: | + ${{ 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/.gitignore b/.gitignore new file mode 100644 index 0000000..36631ad --- /dev/null +++ b/.gitignore @@ -0,0 +1,25 @@ +# Python cache and object files +__pycache__/ +*.py[cod] + +# Coverage.py +.coverage +.cov +coverage.xml + +# setuptools +/build/ +/dist/ +/*.egg-info + +# Dependencies +!requirements.txt + +# Sphinx +/doc/_build/ +/doc/_theme/ +/doc/pySystemRDLModel/**/*.* +!/doc/pySystemRDLModel/index.rst + +# PyCharm project files +/.idea/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..9c8f8b1 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/.idea/pySystemRDLModel.iml b/.idea/pySystemRDLModel.iml new file mode 100644 index 0000000..eb934a9 --- /dev/null +++ b/.idea/pySystemRDLModel.iml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..bc22050 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ +"files.trimTrailingWhitespace": false, +} diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..b4aef4c --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,82 @@ +This is a local copy of the Apache License Version 2.0. +The original can be obtained here: [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) + +-------------------------------------------------------------------------------- + +# Apache License + +Version 2.0, January 2004 + +## TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +### 1. Definitions. + +*"License"* shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +*"Licensor"* shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +*"Legal Entity"* shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +*"You"* (or *"Your"*) shall mean an individual or Legal Entity exercising permissions granted by this License. + +*"Source"* form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. + +*"Object"* form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. + +*"Work"* shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). + +*"Derivative Works"* shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +*"Contribution"* shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, *"submitted"* means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as *"Not a Contribution."* + +*"Contributor"* shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. + +### 2. Grant of Copyright License. +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. + +### 3. Grant of Patent License. +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +### 4. Redistribution. +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: + + - You must give any other recipients of the Work or Derivative Works a copy of this License; and + - You must cause any modified files to carry prominent notices stating that You changed the files; and + - You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and + - If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. + +### 5. Submission of Contributions. +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. + +### 6. Trademarks. +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +### 7. Disclaimer of Warranty. +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. + +### 8. Limitation of Liability. +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. + +### 9. Accepting Warranty or Additional Liability. +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + + +## Appendix: How to apply the Apache License to your work + +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/README.md b/README.md index d2ec31a..10fa3d2 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,66 @@ -# pySystemRDLModel +

+ +

+ +[![Sourcecode on GitHub](https://img.shields.io/badge/pyEDAA-pySystemRDLModel-29b6f6.svg?longCache=true&style=flat-square&logo=GitHub&labelColor=0277bd)](https://GitHub.com/edaa-org/pySystemRDLModel) +[![Sourcecode License](https://img.shields.io/pypi/l/pySystemRDLModel?longCache=true&style=flat-square&logo=Apache&label=code)](LICENSE.md) +[![Documentation](https://img.shields.io/website?longCache=true&style=flat-square&label=edaa-org.github.io%2FpySystemRDLModel&logo=GitHub&logoColor=fff&up_color=blueviolet&up_message=Read%20now%20%E2%9E%9A&url=https%3A%2F%2Fedaa-org.github.io%2FpySystemRDLModel%2Findex.html)](https://edaa-org.github.io/pySystemRDLModel/) +[![Documentation License](https://img.shields.io/badge/doc-CC--BY%204.0-green?longCache=true&style=flat-square&logo=CreativeCommons&logoColor=fff)](LICENSE.md) +[![Gitter](https://img.shields.io/badge/chat-on%20gitter-4db797.svg?longCache=true&style=flat-square&logo=gitter&logoColor=e8ecef)](https://gitter.im/hdl/community) +[![PyPI](https://img.shields.io/pypi/v/pySystemRDLModel?longCache=true&style=flat-square&logo=PyPI&logoColor=FBE072)](https://pypi.org/project/pySystemRDLModel/) +![PyPI - Status](https://img.shields.io/pypi/status/pySystemRDLModel?longCache=true&style=flat-square&logo=PyPI&logoColor=FBE072) +![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pySystemRDLModel?longCache=true&style=flat-square&logo=PyPI&logoColor=FBE072) +[![GitHub Workflow - Build and Test Status](https://img.shields.io/github/workflow/status/edaa-org/pySystemRDLModel/Pipeline/main?longCache=true&style=flat-square&label=Build%20and%20Test&logo=GitHub%20Actions&logoColor=FFFFFF)](https://GitHub.com/edaa-org/pySystemRDLModel/actions/workflows/Pipeline.yml) +[![Libraries.io status for latest release](https://img.shields.io/librariesio/release/pypi/pySystemRDLModel?longCache=true&style=flat-square&logo=Libraries.io&logoColor=fff)](https://libraries.io/github/edaa-org/pySystemRDLModel) +[![Codacy - Quality](https://img.shields.io/codacy/grade/39d312bf98244961975559f141c3e000?longCache=true&style=flat-square&logo=Codacy)](https://app.codacy.com/gh/edaa-org/pySystemRDLModel) +[![Codacy - Coverage](https://img.shields.io/codacy/coverage/39d312bf98244961975559f141c3e000?longCache=true&style=flat-square&logo=Codacy)](https://app.codacy.com/gh/edaa-org/pySystemRDLModel) +[![Codecov - Branch Coverage](https://img.shields.io/codecov/c/github/edaa-org/pySystemRDLModel?longCache=true&style=flat-square&logo=Codecov)](https://codecov.io/gh/edaa-org/pySystemRDLModel) + + + An abstract language model of SystemRDL written in Python. + + +# Main Goals + +This package provides a unified abstract language model for SystemRDL. +Projects reading from source files can derive own classes and implement additional logic to create a concrete language +model for their tools. + +Projects consuming pre-processed SystemRDL data (parsed, analyzed or elaborated) can build higher level features +and services on such a model, while supporting multiple frontends. + + +# Use Cases + +## pySystemRDLModel Generators + +*TBD* + +## pySystemRDLModel Consumers + +* [Electronic Design Automation Abstraction (EDA²)](https://edaa-org.github.io/) + + +# Examples + +## List all Modules with Parameters and Ports + +*TBD* + +# Contributors + +* [Patrick Lehmann](https://GitHub.com/Paebbels) (Maintainer) +* [and more...](https://GitHub.com/edaa-org/pySystemRDLModel/graphs/contributors) + +# License + +This Python package (source code) licensed under [Apache License 2.0](LICENSE.md). +The accompanying documentation is licensed under [Creative Commons - Attribution 4.0 (CC-BY 4.0)](doc/Doc-License.rst). + +------------------------- +SPDX-License-Identifier: Apache-2.0 diff --git a/dist/requirements.txt b/dist/requirements.txt new file mode 100644 index 0000000..a414030 --- /dev/null +++ b/dist/requirements.txt @@ -0,0 +1,2 @@ +wheel >= 0.40.0 +twine >= 4.0.2 diff --git a/doc/ChangeLog/index.rst b/doc/ChangeLog/index.rst new file mode 100644 index 0000000..24b5426 --- /dev/null +++ b/doc/ChangeLog/index.rst @@ -0,0 +1,12 @@ +ChangeLog +######### + +Upcoming Release +================ + +* tbd + +19.06.2023 +========== + +Class :class:`SystemRDLVersion` was moved from pyEDAA.ProjectModel to this package. diff --git a/doc/Dependency.rst b/doc/Dependency.rst new file mode 100644 index 0000000..b228495 --- /dev/null +++ b/doc/Dependency.rst @@ -0,0 +1,166 @@ +.. _dependency: + +Dependency +########## + +.. |img-pySystemRDLModel-lib-status| image:: https://img.shields.io/librariesio/release/pypi/pySystemRDLModel + :alt: Libraries.io status for latest release + :height: 22 + :target: https://libraries.io/github/edaa-org/pySystemRDLModel +.. |img-pySystemRDLModel-req-status| image:: https://img.shields.io/requires/github/edaa-org/pySystemRDLModel + :alt: Requires.io + :height: 22 + :target: https://requires.io/github/edaa-org/pySystemRDLModel/requirements/?branch=main + ++------------------------------------------+------------------------------------------+ +| `Libraries.io `_ | `Requires.io `_ | ++==========================================+==========================================+ +| |img-pySystemRDLModel-lib-status| | |img-pySystemRDLModel-req-status| | ++------------------------------------------+------------------------------------------+ + + +.. _dependency-package: + +pySystemRDLModel Package +************************ + +*None* + ++--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ +| **Package** | **Version** | **License** | **Dependencies** | ++========================================================+=============+==========================================================================================+=================================================================================================================================+ +| `pyTooling `__ | ≥4.0.0 | `Apache License, 2.0 `__ | *None* | ++--------------------------------------------------------+-------------+------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------+ + + +.. _dependency-testing: + +Unit Testing / Coverage / Type Checking (Optional) +************************************************** + +Additional Python packages needed for testing, code coverage collection and static type checking. These packages are +only needed for developers or on a CI server, thus sub-dependencies are not evaluated further. + + +.. rubric:: Manually Installing Test Requirements + +Use the :file:`tests/requirements.txt` file to install all dependencies via ``pip3``. The file will recursively install +the mandatory dependencies too. + +.. code-block:: shell + + pip3 install -U -r tests/requirements.txt + + +.. rubric:: Dependency List + ++-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| **Package** | **Version** | **License** | **Dependencies** | ++===========================================================+=============+========================================================================================+======================+ +| `pytest `__ | ≥7.2.0 | `MIT `__ | *Not yet evaluated.* | ++-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| `pytest-cov `__ | ≥4.0.0 | `MIT `__ | *Not yet evaluated.* | ++-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| `Coverage `__ | ≥7.0 | `Apache License, 2.0 `__ | *Not yet evaluated.* | ++-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| `mypy `__ | ≥1.2 | `MIT `__ | *Not yet evaluated.* | ++-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ +| `lxml `__ | ≥4.9 | `BSD 3-Clause `__ | *Not yet evaluated.* | ++-----------------------------------------------------------+-------------+----------------------------------------------------------------------------------------+----------------------+ + + +.. _dependency-documentation: + +Sphinx Documentation (Optional) +******************************* + +Additional Python packages needed for documentation generation. These packages are only needed for developers or on a +CI server, thus sub-dependencies are not evaluated further. + + +.. rubric:: Manually Installing Documentation Requirements + +Use the :file:`doc/requirements.txt` file to install all dependencies via ``pip3``. The file will recursively install +the mandatory dependencies too. + +.. code-block:: shell + + pip3 install -U -r doc/requirements.txt + + +.. rubric:: Dependency List + ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| **Package** | **Version** | **License** | **Dependencies** | ++=================================================================================================+==============+==========================================================================================================+======================================================================================================================================================+ +| `pyTooling `__ | ≥4.0.0 | `Apache License, 2.0 `__ | *None* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `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.19.5 | `MIT `__ | *Not yet evaluated.* | ++-------------------------------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ + + +.. _dependency-packaging: + +Packaging (Optional) +******************** + +Additional Python packages needed for installation package generation. These packages are only needed for developers or +on a CI server, thus sub-dependencies are not evaluated further. + + +.. rubric:: Manually Installing Packaging Requirements + +Use the :file:`build/requirements.txt` file to install all dependencies via ``pip3``. The file will recursively +install the mandatory dependencies too. + +.. code-block:: shell + + pip3 install -U -r build/requirements.txt + + +.. rubric:: Dependency List + ++----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| **Package** | **Version** | **License** | **Dependencies** | ++============================================================================+==============+==========================================================================================================+======================================================================================================================================================+ +| `pyTooling `__ | ≥4.0.0 | `Apache License, 2.0 `__ | *None* | ++----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ +| `wheel `__ | ≥0.40.0 | `MIT `__ | *Not yet evaluated.* | ++----------------------------------------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ + + +.. _dependency-publishing: + +Publishing (CI-Server only) +*************************** + +Additional Python packages needed for publishing the generated installation package to e.g, PyPI or any equivalent +services. These packages are only needed for maintainers or on a CI server, thus sub-dependencies are not evaluated +further. + + +.. rubric:: Manually Installing Publishing Requirements + +Use the :file:`dist/requirements.txt` file to install all dependencies via ``pip3``. The file will recursively +install the mandatory dependencies too. + +.. code-block:: shell + + pip3 install -U -r dist/requirements.txt + + +.. rubric:: Dependency List + ++----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ +| **Package** | **Version** | **License** | **Dependencies** | ++==========================================================+==============+===========================================================================================+======================+ +| `wheel `__ | ≥0.40.0 | `MIT `__ | *Not yet evaluated.* | ++----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ +| `Twine `__ | ≥4.0.2 | `Apache License, 2.0 `__ | *Not yet evaluated.* | ++----------------------------------------------------------+--------------+-------------------------------------------------------------------------------------------+----------------------+ diff --git a/doc/Doc-License.rst b/doc/Doc-License.rst new file mode 100644 index 0000000..1258fbc --- /dev/null +++ b/doc/Doc-License.rst @@ -0,0 +1,353 @@ +.. _DOCLICENSE: + +.. Note:: This is a local copy of the `Creative Commons - Attribution 4.0 International (CC BY 4.0) `__. + +.. Attention:: This **CC BY 4.0** license applies only to the **documentation** of this project. + + +Creative Commons Attribution 4.0 International +############################################## + +Creative Commons Corporation (“Creative Commons”) is not a law firm and does not +provide legal services or legal advice. Distribution of Creative Commons public +licenses does not create a lawyer-client or other relationship. Creative Commons +makes its licenses and related information available on an “as-is” basis. +Creative Commons gives no warranties regarding its licenses, any material +licensed under their terms and conditions, or any related information. Creative +Commons disclaims all liability for damages resulting from their use to the +fullest extent possible. + +.. topic:: Using Creative Commons Public Licenses + + Creative Commons public licenses provide a standard set of terms and conditions + that creators and other rights holders may use to share original works of + authorship and other material subject to copyright and certain other rights + specified in the public license below. The following considerations are for + informational purposes only, are not exhaustive, and do not form part of our + licenses. + + * **Considerations for licensors:** Our public licenses are intended for use + by those authorized to give the public permission to use material in ways + otherwise restricted by copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms and conditions + of the license they choose before applying it. Licensors should also secure + all rights necessary before applying our licenses so that the public can reuse + the material as expected. Licensors should clearly mark any material not + subject to the license. This includes other CC-licensed material, or material + used under an exception or limitation to copyright. + `More considerations for licensors `__. + + * **Considerations for the public:** By using one of our public licenses, a + licensor grants the public permission to use the licensed material under + specified terms and conditions. If the licensor’s permission is not necessary + for any reason–for example, because of any applicable exception or limitation + to copyright–then that use is not regulated by the license. Our licenses grant + only permissions under copyright and certain other rights that a licensor has + authority to grant. Use of the licensed material may still be restricted for + other reasons, including because others have copyright or other rights in the + material. A licensor may make special requests, such as asking that all + changes be marked or described. Although not required by our licenses, you are + encouraged to respect those requests where reasonable. + `More considerations for the public `__. + +:xlarge:`Creative Commons Attribution 4.0 International Public License` + +By exercising the Licensed Rights (defined below), You accept and agree to be +bound by the terms and conditions of this Creative Commons Attribution 4.0 +International Public License ("Public License"). To the extent this Public +License may be interpreted as a contract, You are granted the Licensed Rights +in consideration of Your acceptance of these terms and conditions, and the +Licensor grants You such rights in consideration of benefits the Licensor +receives from making the Licensed Material available under these terms and +conditions. + +Section 1 – Definitions. +======================== + +a. **Adapted Material** means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material and in + which the Licensed Material is translated, altered, arranged, transformed, or + otherwise modified in a manner requiring permission under the Copyright and + Similar Rights held by the Licensor. For purposes of this Public License, + where the Licensed Material is a musical work, performance, or sound + recording, Adapted Material is always produced where the Licensed Material + is synched in timed relation with a moving image. + +b. **Adapter's License** means the license You apply to Your Copyright and + Similar Rights in Your contributions to Adapted Material in accordance with + the terms and conditions of this Public License. + +c. **Copyright and Similar Rights** means copyright and/or similar rights + closely related to copyright including, without limitation, performance, + broadcast, sound recording, and Sui Generis Database Rights, without regard + to how the rights are labeled or categorized. For purposes of this Public + License, the rights specified in Section 2(b)(1)-(2) are not Copyright and + Similar Rights. + +d. **Effective Technological Measures** means those measures that, in the + absence of proper authority, may not be circumvented under laws fulfilling + obligations under Article 11 of the WIPO Copyright Treaty adopted on + December 20, 1996, and/or similar international agreements. + +e. **Exceptions and Limitations** means fair use, fair dealing, and/or any + other exception or limitation to Copyright and Similar Rights that applies to + Your use of the Licensed Material. + +f. **Licensed Material** means the artistic or literary work, database, or + other material to which the Licensor applied this Public License. + +g. **Licensed Rights** means the rights granted to You subject to the terms + and conditions of this Public License, which are limited to all Copyright and + Similar Rights that apply to Your use of the Licensed Material and that the + Licensor has authority to license. + +h. **Licensor** means the individual(s) or entity(ies) granting rights under + this Public License. + +i. **Share** means to provide material to the public by any means or process + that requires permission under the Licensed Rights, such as reproduction, + public display, public performance, distribution, dissemination, + communication, or importation, and to make material available to the public + including in ways that members of the public may access the material from a + place and at a time individually chosen by them. + +j. **Sui Generis Database Rights** means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of the + Council of 11 March 1996 on the legal protection of databases, as amended + and/or succeeded, as well as other essentially equivalent rights anywhere + in the world. + +k. **You** means the individual or entity exercising the Licensed Rights + under this Public License. **Your** has a corresponding meaning. + +Section 2 – Scope. +================== + +a. **License grant.** + + 1. Subject to the terms and conditions of this Public License, the Licensor + hereby grants You a worldwide, royalty-free, non-sublicensable, + non-exclusive, irrevocable license to exercise the Licensed Rights in the + Licensed Material to: + + A. reproduce and Share the Licensed Material, in whole or in part; and + + B. produce, reproduce, and Share Adapted Material. + + 2. :underline:`Exceptions and Limitations.` For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public License does not + apply, and You do not need to comply with its terms and conditions. + + 3. :underline:`Term.` The term of this Public License is specified in Section 6(a). + + 4. :underline:`Media and formats`; :underline:`technical modifications allowed.` The Licensor + authorizes You to exercise the Licensed Rights in all media and formats + whether now known or hereafter created, and to make technical + modifications necessary to do so. The Licensor waives and/or agrees not to + assert any right or authority to forbid You from making technical + modifications necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective Technological + Measures. For purposes of this Public License, simply making modifications + authorized by this Section 2(a)(4) never produces Adapted Material. + + 5. :underline:`Downstream recipients.` + + A. :underline:`Offer from the Licensor – Licensed Material.` Every recipient of + the Licensed Material automatically receives an offer from the + Licensor to exercise the Licensed Rights under the terms and + conditions of this Public License. + + B. :underline:`No downstream restrictions.` You may not offer or impose any + additional or different terms or conditions on, or apply any Effective + Technological Measures to, the Licensed Material if doing so restricts + exercise of the Licensed Rights by any recipient of the Licensed + Material. + + 6. :underline:`No endorsement.` Nothing in this Public License constitutes or may + be construed as permission to assert or imply that You are, or that Your + use of the Licensed Material is, connected with, or sponsored, endorsed, + or granted official status by, the Licensor or others designated to + receive attribution as provided in Section 3(a)(1)(A)(i). + +b. **Other rights.** + + 1. Moral rights, such as the right of integrity, are not licensed under this + Public License, nor are publicity, privacy, and/or other similar + personality rights; however, to the extent possible, the Licensor waives + and/or agrees not to assert any such rights held by the Licensor to the + limited extent necessary to allow You to exercise the Licensed Rights, but + not otherwise. + + 2. Patent and trademark rights are not licensed under this Public License. + + 3. To the extent possible, the Licensor waives any right to collect royalties + from You for the exercise of the Licensed Rights, whether directly or + through a collecting society under any voluntary or waivable statutory or + compulsory licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + +Section 3 – License Conditions. +=============================== + +Your exercise of the Licensed Rights is expressly made subject to the following conditions. + +a. **Attribution.** + + 1. If You Share the Licensed Material (including in modified form), You must: + + A. retain the following if it is supplied by the Licensor with the + Licensed Material: + + i. identification of the creator(s) of the Licensed Material and any + others designated to receive attribution, in any reasonable manner + requested by the Licensor (including by pseudonym if designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of warranties; + + v. a URI or hyperlink to the Licensed Material to the extent reasonably + practicable; + + B. indicate if You modified the Licensed Material and retain an + indication of any previous modifications; and + + C. indicate the Licensed Material is licensed under this Public License, + and include the text of, or the URI or hyperlink to, this Public + License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner + based on the medium, means, and context in which You Share the Licensed + Material. For example, it may be reasonable to satisfy the conditions by + providing a URI or hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the information + required by Section 3(a)(1)(A) to the extent reasonably practicable. + + 4. If You Share Adapted Material You produce, the Adapter's License You apply + must not prevent recipients of the Adapted Material from complying with + this Public License. + +Section 4 – Sui Generis Database Rights. +======================================== + +Where the Licensed Rights include Sui Generis Database Rights that apply to Your +use of the Licensed Material: + +a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, + reuse, reproduce, and Share all or a substantial portion of the contents of + the database; + +b. if You include all or a substantial portion of the database contents in a + database in which You have Sui Generis Database Rights, then the database + in which You have Sui Generis Database Rights (but not its individual + contents) is Adapted Material; and + +c. You must comply with the conditions in Section 3(a) if You Share all or a + substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not replace +Your obligations under this Public License where the Licensed Rights include +other Copyright and Similar Rights. + +Section 5 – Disclaimer of Warranties and Limitation of Liability. +================================================================= + +a. **Unless otherwise separately undertaken by the Licensor, to the extent + possible, the Licensor offers the Licensed Material as-is and as-available, + and makes no representations or warranties of any kind concerning the + Licensed Material, whether express, implied, statutory, or other. This + includes, without limitation, warranties of title, merchantability, + fitness for a particular purpose, non-infringement, absence of latent or + other defects, accuracy, or the presence or absence of errors, whether or + not known or discoverable. Where disclaimers of warranties are not allowed + in full or in part, this disclaimer may not apply to You.** + +b. **To the extent possible, in no event will the Licensor be liable to You + on any legal theory (including, without limitation, negligence) or + otherwise for any direct, special, indirect, incidental, consequential, + punitive, exemplary, or other losses, costs, expenses, or damages arising + out of this Public License or use of the Licensed Material, even if the + Licensor has been advised of the possibility of such losses, costs, expenses, + or damages. Where a limitation of liability is not allowed in full or in + part, this limitation may not apply to You.** + +c. The disclaimer of warranties and limitation of liability provided above + shall be interpreted in a manner that, to the extent possible, most + closely approximates an absolute disclaimer and waiver of all liability. + +Section 6 – Term and Termination. +================================= + +a. This Public License applies for the term of the Copyright and Similar Rights + licensed here. However, if You fail to comply with this Public License, then + Your rights under this Public License terminate automatically. + +b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided it is cured + within 30 days of Your discovery of the violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any right the + Licensor may have to seek remedies for Your violations of this Public License. + +c. For the avoidance of doubt, the Licensor may also offer the Licensed Material + under separate terms or conditions or stop distributing the Licensed Material + at any time; however, doing so will not terminate this Public License. + +d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License. + +Section 7 – Other Terms and Conditions. +======================================= + +a. The Licensor shall not be bound by any additional or different terms or + conditions communicated by You unless expressly agreed. + +b. Any arrangements, understandings, or agreements regarding the Licensed + Material not stated herein are separate from and independent of the terms + and conditions of this Public License. + +Section 8 – Interpretation. +=========================== + +a. For the avoidance of doubt, this Public License does not, and shall not be + interpreted to, reduce, limit, restrict, or impose conditions on any use of + the Licensed Material that could lawfully be made without permission under + this Public License. + +b. To the extent possible, if any provision of this Public License is deemed + unenforceable, it shall be automatically reformed to the minimum extent + necessary to make it enforceable. If the provision cannot be reformed, it + shall be severed from this Public License without affecting the + enforceability of the remaining terms and conditions. + +c. No term or condition of this Public License will be waived and no failure to + comply consented to unless expressly agreed to by the Licensor. + +d. Nothing in this Public License constitutes or may be interpreted as a + limitation upon, or waiver of, any privileges and immunities that apply to + the Licensor or You, including from the legal processes of any jurisdiction + or authority. + +------------------ + +Creative Commons is not a party to its public licenses. Notwithstanding, +Creative Commons may elect to apply one of its public licenses to material it +publishes and in those instances will be considered the “Licensor.” Except for +the limited purpose of indicating that material is shared under a Creative +Commons public license or as otherwise permitted by the Creative Commons +policies published at `creativecommons.org/policies `__, +Creative Commons does not authorize the use of the trademark “Creative Commons” +or any other trademark or logo of Creative Commons without its prior written +consent including, without limitation, in connection with any unauthorized +modifications to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For the +avoidance of doubt, this paragraph does not form part of the public licenses. + +Creative Commons may be contacted at `creativecommons.org `__ diff --git a/doc/Glossary.rst b/doc/Glossary.rst new file mode 100644 index 0000000..22af2e9 --- /dev/null +++ b/doc/Glossary.rst @@ -0,0 +1,12 @@ +Glossary +######## + +.. glossary:: + + Accellera + ......... + + * IEEE Std. xxxx-yyy - ssc + + SystemRDL + ... diff --git a/doc/Installation.rst b/doc/Installation.rst new file mode 100644 index 0000000..7615769 --- /dev/null +++ b/doc/Installation.rst @@ -0,0 +1,37 @@ +.. _installation: + +Installation/Updates +#################### + + + +.. _installation-pip: + +Using PIP +********* + +Installation using PIP +====================== + +.. code-block:: bash + + pip3 install pySystemRDLModel + + +Updating using PIP +================== + +.. code-block:: bash + + pip3 install -U pySystemRDLModel + + + +.. _installation-setup: + +Using setup.py +************** + +.. todo:: + + Describe setup procedure using ``setup.py`` diff --git a/doc/LanguageModel/Module.rst b/doc/LanguageModel/Module.rst new file mode 100644 index 0000000..61a2330 --- /dev/null +++ b/doc/LanguageModel/Module.rst @@ -0,0 +1,4 @@ +Module +###### + +TBD diff --git a/doc/LanguageModel/index.rst b/doc/LanguageModel/index.rst new file mode 100644 index 0000000..9fb550f --- /dev/null +++ b/doc/LanguageModel/index.rst @@ -0,0 +1,21 @@ +.. _SRDLModel: + +SystemRDL Language Model +######################## + +.. topic:: Design Goal + + * Clearly named classes that model the semantics of SystemRDL. + * All language constructs (statements, declarations, specifications, …) have their own classes. + |br| + These classes are arranged in a logical hierarchy, with a single common base-class. + * Child objects shall have a reference to their parent. + * Comments will be associated with a particular code object. + * Easy modifications of the object tree. + +.. rubric:: Elements of the Language Model + +.. toctree:: + :maxdepth: 1 + + Module diff --git a/doc/License.rst b/doc/License.rst new file mode 100644 index 0000000..fba66a2 --- /dev/null +++ b/doc/License.rst @@ -0,0 +1,140 @@ +.. _SRCLICENSE: + +.. Note:: This is a local copy of the `Apache License Version 2.0 `__. + +.. Attention:: This **Apache License, 2.0** applies to all **source and configuration files of project**, **except documentation**. + +Apache License 2.0 +################## + +Version 2.0, January 2004 + +:xlarge:`TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION` + + +1. Definitions. +=============== +**"License"** shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. + +**"Licensor"** shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. + +**"Legal Entity"** shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that +entity. For the purposes of this definition, **"control"** means (i) the power, direct or indirect, to cause the direction or management of such entity, whether +by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. + +**"You"** (or **"Your"**) shall mean an individual or Legal Entity exercising permissions granted by this License. + +**"Source"** form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and +configuration files. + +**"Object"** form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object +code, generated documentation, and conversions to other media types. + +**"Work"** shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is +included in or attached to the work (an example is provided in the Appendix below). + +**"Derivative Works"** shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, +annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works +shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. + +**"Contribution"** shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative +Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to +submit on behalf of the copyright owner. For the purposes of this definition, **"submitted"** means any form of electronic, verbal, or written communication +sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue +tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is +conspicuously marked or otherwise designated in writing by the copyright owner as **"Not a Contribution."** + +**"Contributor"** shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently +incorporated within the Work. + +2. Grant of Copyright License. +============================== +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such +Derivative Works in Source or Object form. + +3. Grant of Patent License. +=========================== +Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, +irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such +license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of +their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim +or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then +any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. + +4. Redistribution. +================== +You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, +provided that You meet the following conditions: + +* You must give any other recipients of the Work or Derivative Works a copy of this License; and +* You must cause any modified files to carry prominent notices stating that You changed the files; and +* You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source + form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and +* If the Work includes a **"NOTICE"** text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the + attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the + following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the + Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE + file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, + alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. + +You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or +distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise +complies with the conditions stated in this License. + +5. Submission of Contributions. +=============================== +Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and +conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any +separate license agreement you may have executed with Licensor regarding such Contributions. + +6. Trademarks. +============== +This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable +and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. +========================== +Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, +MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and +assume any risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. +=========================== +In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate +and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or +consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages +for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been +advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. +============================================== +While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other +liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole +responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability +incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. + +---------------------------------------------------------------------------------------------------------------------------------------------------------------- + +:xlarge:`Appendix: How to apply the Apache License to your work` + +To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying +information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or +class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. + +.. code-block:: none + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..4dc7e78 --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,11 @@ +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees -T -D language=en $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +%: + $(SPHINXBUILD) -b $@ $(ALLSPHINXOPTS) $(BUILDDIR)/$@ diff --git a/doc/_static/favicon.svg b/doc/_static/favicon.svg new file mode 100644 index 0000000..ce3203b --- /dev/null +++ b/doc/_static/favicon.svg @@ -0,0 +1,65 @@ + + + + + + + + + + + diff --git a/doc/_static/logo.svg b/doc/_static/logo.svg new file mode 100644 index 0000000..94450ff --- /dev/null +++ b/doc/_static/logo.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/doc/_templates/autoapi/module.rst b/doc/_templates/autoapi/module.rst new file mode 100644 index 0000000..655beff --- /dev/null +++ b/doc/_templates/autoapi/module.rst @@ -0,0 +1,110 @@ +.. # 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 }}== + +.. py:module:: {{ node.name }} + +{##} +{%- 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/conf.py b/doc/conf.py new file mode 100644 index 0000000..35eadf9 --- /dev/null +++ b/doc/conf.py @@ -0,0 +1,234 @@ +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. + +from sys import path as sys_path +from os.path import abspath +from pathlib import Path +from json import loads + +from pyTooling.Packaging import extractVersionInformation + +ROOT = Path(__file__).resolve().parent + +sys_path.insert(0, abspath('.')) +sys_path.insert(0, abspath('..')) +sys_path.insert(0, abspath('../pySystemRDLModel')) + + +# ============================================================================== +# Project information and versioning +# ============================================================================== +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +project = "pySystemRDLModel" + +packageInformationFile = Path(f"../{project.replace('.', '/')}/__init__.py") +versionInformation = extractVersionInformation(packageInformationFile) + +author = versionInformation.Author +copyright = versionInformation.Copyright +version = ".".join(versionInformation.Version.split(".")[:2]) # e.g. 2.3 The short X.Y version. +release = versionInformation.Version + + +# ============================================================================== +# Miscellaneous settings +# ============================================================================== +# 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. +exclude_patterns = [ + "_build", + "_themes", + "Thumbs.db", + ".DS_Store" +] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'stata-dark' + + +# ============================================================================== +# Restructured Text settings +# ============================================================================== +prologPath = Path("prolog.inc") +try: + with prologPath.open("r") as fileHandle: + rst_prolog = fileHandle.read() +except Exception as ex: + print(f"[ERROR:] While reading '{prologPath}'.") + print(ex) + rst_prolog = "" + + +# ============================================================================== +# Options for HTML output +# ============================================================================== + +html_context = {} +ctx = ROOT / 'context.json' +if ctx.is_file(): + html_context.update(loads(ctx.open('r').read())) + +if (ROOT / "_theme").is_dir(): + html_theme_path = ["."] + html_theme = "_theme" + html_theme_options = { + 'logo_only': True, + 'home_breadcrumbs': False, + 'vcs_pageview_mode': 'blob', + } +else: + html_theme = "alabaster" + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +html_logo = str(Path(html_static_path[0]) / "logo.svg") +html_favicon = str(Path(html_static_path[0]) / "favicon.svg") + +# Output file base name for HTML help builder. +htmlhelp_basename = 'pySystemRDLModelDoc' + +# If not None, a 'Last updated on:' timestamp is inserted at every page +# bottom, using the given strftime format. +# The empty string is equivalent to '%b %d, %Y'. +html_last_updated_fmt = "%d.%m.%Y" + + +# ============================================================================== +# Options for LaTeX / PDF output +# ============================================================================== +from textwrap import dedent + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + 'papersize': 'a4paper', + + # The font size ('10pt', '11pt' or '12pt'). + #'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + 'preamble': dedent(r""" + % ================================================================================ + % User defined additional preamble code + % ================================================================================ + % Add more Unicode characters for pdfLaTeX. + % - Alternatively, compile with XeLaTeX or LuaLaTeX. + % - https://GitHub.com/sphinx-doc/sphinx/issues/3511 + % + \ifdefined\DeclareUnicodeCharacter + \DeclareUnicodeCharacter{2265}{$\geq$} + \DeclareUnicodeCharacter{21D2}{$\Rightarrow$} + \fi + + + % ================================================================================ + """), + + # Latex figure (float) alignment + #'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ( master_doc, + 'pySystemRDLModel.tex', + 'The pySystemRDLModel Documentation', + 'Patrick Lehmann', + 'manual' + ), +] + + +# ============================================================================== +# Extensions +# ============================================================================== +extensions = [ +# Standard Sphinx extensions + "sphinx.ext.autodoc", + 'sphinx.ext.extlinks', + 'sphinx.ext.intersphinx', + 'sphinx.ext.inheritance_diagram', + 'sphinx.ext.todo', + 'sphinx.ext.graphviz', + 'sphinx.ext.mathjax', + 'sphinx.ext.ifconfig', + 'sphinx.ext.viewcode', +# SphinxContrib extensions + 'sphinxcontrib.mermaid', +# Other extensions + 'sphinx_fontawesome', + 'sphinx_autodoc_typehints', + 'autoapi.sphinx', +] + +# ============================================================================== +# Sphinx.Ext.InterSphinx +# ============================================================================== +intersphinx_mapping = { + 'python': ('https://docs.python.org/3', None), +} + + +# ============================================================================== +# 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" + + + +# ============================================================================== +# Sphinx.Ext.ExtLinks +# ============================================================================== +extlinks = { + "ghissue": ('https://GitHub.com/edaa-org/pySystemRDLModel/issues/%s', 'issue #'), + "ghpull": ('https://GitHub.com/edaa-org/pySystemRDLModel/pull/%s', 'pull request #'), + "ghsrc": ('https://GitHub.com/edaa-org/pySystemRDLModel/blob/main/%s?ts=2', ""), +} + + +# ============================================================================== +# Sphinx.Ext.Graphviz +# ============================================================================== +graphviz_output_format = "svg" + + + +# ============================================================================== +# Sphinx.Ext.ToDo +# ============================================================================== +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True +todo_link_only = True + + + +# ============================================================================== +# AutoAPI.Sphinx +# ============================================================================== +autoapi_modules = { + 'pySystemRDLModel': {'output': "pySystemRDLModel", "override": True} +} diff --git a/doc/coverage/index.rst b/doc/coverage/index.rst new file mode 100644 index 0000000..80bbad2 --- /dev/null +++ b/doc/coverage/index.rst @@ -0,0 +1,4 @@ +Coverage Report +############### + +*Placeholder for the Coverage report generated with* ``pytest`` *and* ``coverage``. diff --git a/doc/genindex.rst b/doc/genindex.rst new file mode 100644 index 0000000..c07da40 --- /dev/null +++ b/doc/genindex.rst @@ -0,0 +1,4 @@ +.. This file is a placeholder and will be replaced + +Index +##### diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 0000000..17fe507 --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,157 @@ +.. include:: shields.inc + +.. image:: _static/logo.svg + :height: 90 px + :align: center + :target: https://GitHub.com/edaa-org/pySystemRDLModel + +.. raw:: html + +
+ +.. raw:: latex + + \part{Introduction} + +.. only:: html + + | |SHIELD:svg:pySystemRDLModel-github| |SHIELD:svg:pySystemRDLModel-src-license| |SHIELD:svg:pySystemRDLModel-ghp-doc| |SHIELD:svg:pySystemRDLModel-doc-license| |SHIELD:svg:pySystemRDLModel-gitter| + | |SHIELD:svg:pySystemRDLModel-pypi-tag| |SHIELD:svg:pySystemRDLModel-pypi-status| |SHIELD:svg:pySystemRDLModel-pypi-python| + | |SHIELD:svg:pySystemRDLModel-gha-test| |SHIELD:svg:pySystemRDLModel-lib-status| |SHIELD:svg:pySystemRDLModel-codacy-quality| |SHIELD:svg:pySystemRDLModel-codacy-coverage| |SHIELD:svg:pySystemRDLModel-codecov-coverage| + +.. Disabled shields: |SHIELD:svg:pySystemRDLModel-lib-dep| |SHIELD:svg:pySystemRDLModel-req-status| |SHIELD:svg:pySystemRDLModel-lib-rank| + +.. only:: latex + + |SHIELD:png:pySystemRDLModel-github| |SHIELD:png:pySystemRDLModel-src-license| |SHIELD:png:pySystemRDLModel-ghp-doc| |SHIELD:png:pySystemRDLModel-doc-license| |SHIELD:png:pySystemRDLModel-gitter| + |SHIELD:png:pySystemRDLModel-pypi-tag| |SHIELD:png:pySystemRDLModel-pypi-status| |SHIELD:png:pySystemRDLModel-pypi-python| + |SHIELD:png:pySystemRDLModel-gha-test| |SHIELD:png:pySystemRDLModel-lib-status| |SHIELD:png:pySystemRDLModel-codacy-quality| |SHIELD:png:pySystemRDLModel-codacy-coverage| |SHIELD:png:pySystemRDLModel-codecov-coverage| + +.. Disabled shields: |SHIELD:png:pySystemRDLModel-lib-dep| |SHIELD:png:pySystemRDLModel-req-status| |SHIELD:png:pySystemRDLModel-lib-rank| + +The pySystemRDLModel Documentation +################################## + +An abstract SystemRDL language model. + + +.. _goals: + +Main Goals +********** + +This package provides a unified abstract language model for SystemRDL. +Projects reading from source files can derive own classes and implement additional logic to create a concrete language +model for their tools. + +Projects consuming pre-processed SystemRDL data (parsed, analyzed or elaborated) can build higher level features +and services on such a model, while supporting multiple frontends. + + +.. _usecase: + +Use Cases +********* + +* TBD + + +.. _news: + +News +**** + +.. only:: html + + June 2023 - New Repository Created + ================================== + +.. only:: latex + + .. rubric:: New Repository Created + +* Moved ``SystemRDLVersion`` class from ``pyEDAA.ProjectModel`` to this new repository. + + +.. _contributors: + +Contributors +************ + +* `Patrick Lehmann `__ (Maintainer) +* `and more... `__ + + +License +******* + +.. only:: html + + This Python package (source code) is licensed under `Apache License 2.0 `__. |br| + The accompanying documentation is licensed under `Creative Commons - Attribution 4.0 (CC-BY 4.0) `__. + +.. only:: latex + + This Python package (source code) is licensed under **Apache License 2.0**. |br| + The accompanying documentation is licensed under **Creative Commons - Attribution 4.0 (CC-BY 4.0)**. + +------------------------------------ + +.. |docdate| date:: %d.%b %Y - %H:%M + +.. only:: html + + This document was generated on |docdate|. + +.. toctree:: + :hidden: + + Used as a layer of EDA² ➚ + +.. toctree:: + :caption: Introduction + :hidden: + + Installation + Dependency + + +.. raw:: latex + + \part{Main Documentation} + +.. toctree:: + :caption: Main Documentation + :hidden: + + LanguageModel/index + + +.. raw:: latex + + \part{References} + +.. toctree:: + :caption: References + :hidden: + + pySystemRDLModel/index + + +.. raw:: latex + + \part{Appendix} + +.. toctree:: + :caption: Appendix + :hidden: + + Coverage Report ➚ + Static Type Check Report ➚ + License + Doc-License + Glossary + genindex + +.. # + py-modindex diff --git a/doc/make.bat b/doc/make.bat new file mode 100644 index 0000000..922152e --- /dev/null +++ b/doc/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/doc/make.ps1 b/doc/make.ps1 new file mode 100644 index 0000000..3bafa6f --- /dev/null +++ b/doc/make.ps1 @@ -0,0 +1,323 @@ +# .SYNOPSIS +# Please use '.\make.ps1 -' where is one of: +# html, dirhtml, singlehtml, pickle, json, linkcheck +# +# .DESCRIPTION +# This is a front-end script for Sphinx. +# +# .EXAMPLE +# .\make.ps1 -clean +# Cleanup the build directory. +# .EXAMPLE +# .\make.ps1 -html +# Build documentation as HTML pages. +# .EXAMPLE +# .\make.ps1 -clean -html -linkcheck +# Combine multiple commands in a single call +# +# +# ========================================================================== +# Copyright � 2016 Patrick Lehmann - Dresden, Germany +# ========================================================================== +[CmdletBinding()] +param( + # Make all targets + [switch]$all = $false, + # Extract VHDL documentation + [switch]$PoC = $false, + # Make standalone HTML files + [switch]$html = $false, + # Make HTML files named index.html in directories + [switch]$dirhtml = $false, + # Make a single large HTML file + [switch]$singlehtml = $false, + # Make a PDF file + [switch]$latex = $false, + [switch]$pdf = $false, + # Make pickle files + [switch]$pickle = $false, + # Make json files + [switch]$json = $false, + # Check all external links for integrity + [switch]$linkcheck = $false, + # Clean up directory before running Sphinx. + [switch]$changes = $false, + # Show changed files. + [switch]$clean = $false, + [switch]$cleanup = $false, + # Show the embedded help page(s). + [switch]$help = $false +) + +# resolve paths +$WorkingDir = Get-Location +$SphinxRootDir = Convert-Path (Resolve-Path ($PSScriptRoot)) + +# set default values +$EnableVerbose = $PSCmdlet.MyInvocation.BoundParameters["Verbose"] +$EnableDebug = $PSCmdlet.MyInvocation.BoundParameters["Debug"] +if ($EnableVerbose -eq $null) { $EnableVerbose = $false } +if ($EnableDebug -eq $null) { $EnableDebug = $false } +if ($EnableDebug -eq $true) { $EnableVerbose = $true } + +# Display help if no command was selected +$Help = $Help -or (-not ($all -or $PoC -or $html -or $dirhtml -or $singlehtml -or $latex -or $pdf -or $json -or $pickle -or $linkcheck -or $changes -or $clean -or $help)) + +function Exit-Script +{ <# + .PARAMETER ExitCode + ExitCode of this script run + #> + [CmdletBinding()] + param([int]$ExitCode = 0) + + # restore environment + # rm env:GHDL -ErrorAction SilentlyContinue + + cd $WorkingDir + + # unload modules + # Remove-Module precompile -Verbose:$false + + Pop-EnvironmentBlock + # exit with exit code + exit $ExitCode +} + +if ($Help) +{ Get-Help $MYINVOCATION.InvocationName -Detailed + Exit-Script +} + +Push-EnvironmentBlock +$env:Path += ";C:\Tools\Graphviz\2.38\bin" + +if ($PoC) +{ cd "$SphinxRootDir" + py -3 poc.py + Write-Host "Complete" -Foreground Green +} + +if ($All) +{ $clean = $true + $html = $true + $dirhtml = $true + $singlehtml = $true +} + +$SphinxBuild = if (-not $env:SPHINXBUILD) { "sphinx-build" } else { $env:SPHINXBUILD } +# $BuildDir = "$SphinxRootDir\{{ rbuilddir }}" +# $SourceDir = "$SphinxRootDir\{{ rsrcdir }}" +$BuildDir = "$SphinxRootDir\_build" # for local testing, can be removed in the future +$SourceDir = "$SphinxRootDir\." # for local testing, can be removed in the future +$AllSphinxOpts = "-d $BuildDir\doctrees ${env:SPHINXOPTS} $SourceDir" +$I18NSphinxOpts = "${env:SPHINXOPTS} $SourceDir" +# ------------------------------------------------------------------------------ +# TODO: add paper options +# ------------------------------------------------------------------------------ +# if NOT "%PAPER%" == "" ( +# set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% +# set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% +# ) + +# Check if sphinx-build is available and fallback to Python version if any +# ------------------------------------------------------------------------------ +# TODO: add testings if sphinxbuild can be called and/or is installed +# ------------------------------------------------------------------------------ +# %SPHINXBUILD% 1>NUL 2>NUL +# if errorlevel 9009 goto sphinx_python +# goto sphinx_ok +# +# :sphinx_python +# +# set SPHINXBUILD=python -m sphinx.__init__ +# %SPHINXBUILD% 2> nul +# if errorlevel 9009 ( +# echo. +# echo.The 'sphinx-build' command was not found. Make sure you have Sphinx +# echo.installed, then set the SPHINXBUILD environment variable to point +# echo.to the full path of the 'sphinx-build' executable. Alternatively you +# echo.may add the Sphinx directory to PATH. +# echo. +# echo.If you don't have Sphinx installed, grab it from +# echo.http://sphinx-doc.org/ +# exit /b 1 +# ) + + +if ($clean) +{ $EnableVerbose -and (Write-Host "Cleaning build directory '$BuildDir'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " dir -Path $BuildDir * -Directory | rmdir -Recurse" ) | Out-Null + if (Test-Path $BuildDir) + { dir -Path $BuildDir * -Directory | rmdir -Recurse } + + $EnableVerbose -and (Write-Host "Cleaning autoapi directory '$SphinxRootDir\PyInfrastructure'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " dir -Path $SphinxRootDir\PyInfrastructure *.rst | ? {$_.FullName -NotMatch 'index.rst'} | rmdir -Recurse" ) | Out-Null + dir -Path $SphinxRootDir\PyInfrastructure *.rst | ? {$_.FullName -NotMatch 'index.rst'} | rmdir -Recurse + + Write-Host "Cleaning finished." -Foreground Green +} + +if ($pickle) +{ $expr = "$SphinxBuild -b pickle $AllSphinxOpts $BuildDir\pickle" + $EnableVerbose -and (Write-Host "Building target 'pickle' into '$BuildDir\pickle'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Build finished. Now you can process the pickle files." -Foreground Green +} + +if ($html) +{ $expr = "$SphinxBuild -b html" + $expr += " -t PoCInternal" + if ($cleanup) + { $expr += " -t PoCCleanUp" } + + $expr += " $AllSphinxOpts $BuildDir\html" + $EnableVerbose -and (Write-Host "Building target 'html' into '$BuildDir\html'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Build finished. The HTML pages are in $BuildDir\html." -Foreground Green +} + +if ($dirhtml) +{ $expr = "$SphinxBuild -b dirhtml $AllSphinxOpts $BuildDir\dirhtml" + $EnableVerbose -and (Write-Host "Building target 'dirhtml' into '$BuildDir\dirhtml'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Build finished. The HTML pages are in $BuildDir\dirhtml." -Foreground Green +} + +if ($singlehtml) +{ $expr = "$SphinxBuild -b singlehtml $AllSphinxOpts $BuildDir\singlehtml" + $EnableVerbose -and (Write-Host "Building target 'singlehtml' into '$BuildDir\singlehtml'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Build finished. The HTML file is in $BuildDir\singlehtml." -Foreground Green +} + +if ($latex) +{ $expr = "$SphinxBuild -b latex $AllSphinxOpts $BuildDir\pdf" + $EnableVerbose -and (Write-Host "Building target 'latex' into '$BuildDir\pdf'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Build finished. The LaTeX sources are in $BuildDir\pdf." -Foreground Green +} +if ($pdf) +{ cd "$BuildDir\pdf" + + # Write-Host "Patching LaTeX file..." -Foreground Yellow + # $strippedFileContent = "" + # $state = 0 + # foreach ($line in (cat "$BuildDir\pdf\ThePoC-Library.tex" -Encoding UTF8)) + # { if ($state -lt 3) + # { if ($line.StartsWith("\ifPDFTeX")) + # { $state = 1 + # $strippedFileContent += "\usepackage[utf8]{inputenc}`r`n\ifdefined\DeclareUnicodeCharacter`r`n \DeclareUnicodeCharacter{00A0}{\nobreakspace}`r`n \DeclareUnicodeCharacter{2265}{$\geq$}`r`n \DeclareUnicodeCharacter{21D2}{$\Rightarrow$}`r`n\fi`r`n" + # continue + # } + # elseif ($line.StartsWith("\fi")) + # { $state += 1 + # continue + # } + # if ($state -eq 0) + # { $strippedFileContent += $line + "`r`n" } + # } + # else + # { $strippedFileContent += $line + "`r`n" } + # } + # $strippedFileContent | Out-File "$BuildDir\pdf\The-PoC-Library.tex" -Encoding UTF8 + # Write-Host "Patching finished. The new LaTeX file is in $BuildDir\pdf." -Foreground Green + + cp "$BuildDir\pdf\ThePoC-Library.tex" "$BuildDir\pdf\The-PoC-Library.tex" + + $expr = "pdflatex.exe $BuildDir\pdf\The-PoC-Library.tex" + $EnableVerbose -and (Write-Host "Building target 'pdf' into '$BuildDir\pdf'..." -Foreground DarkCyan ) | Out-Null + Write-Host "Compiling with pdflatex.exe..." -Foreground Yellow + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + + $expr = "makeindex.exe .\The-PoC-Library.idx" + Write-Host "Creating index with makeindex.exe..." -Foreground Yellow + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + + $expr = "pdflatex.exe $BuildDir\pdf\The-PoC-Library.tex" + Write-Host "Compiling with pdflatex.exe..." -Foreground Yellow + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Build finished. The PDF file is in $BuildDir\pdf." -Foreground Green +} + +if ($json) +{ $expr = "$SphinxBuild -b json $AllSphinxOpts $BuildDir\json" + $EnableVerbose -and (Write-Host "Building target 'json' into '$BuildDir\json'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Build finished. Now you can process the json files." -Foreground Green +} + +if ($linkcheck) +{ $expr = "$SphinxBuild -b linkcheck $AllSphinxOpts $BuildDir\linkcheck" + $EnableVerbose -and (Write-Host "Building target 'html' into '$BuildDir\html'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Link check complete. Look for any errors in the above output or in $BuildDir\linkcheck\output.txt." -Foreground Green +} + +if ($changes) +{ $expr = "$SphinxBuild -b changes $AllSphinxOpts $BuildDir\changes" + $EnableVerbose -and (Write-Host "Building target 'changes' into '$BuildDir\changes'..." -Foreground DarkCyan ) | Out-Null + $EnableDebug -and (Write-Host " $expr" -Foreground Cyan ) | Out-Null + Invoke-Expression $expr + if ($LastExitCode -ne 0) + { Exit-Script 1 } + Write-Host "Searching for changes complete. Look for any errors in the above output or in $BuildDir\changes\output.txt." -Foreground Green +} + +if ($PoC) +{ cd "$SphinxRootDir" + Write-Host "Expanding labels..." -Foreground Yellow + py -3 ..\temp\sphinx\inventory.py --file _build\html\objects.inv --rst > ..\temp\sphinx\PoC.inventory.rst + + Write-Host "Stripping file from Python labels..." -Foreground Yellow + $strippedFileContent = "" + $skip = $false + foreach ($line in (cat ..\temp\sphinx\PoC.inventory.rst -Encoding UTF8)) + { if ($line -match "^`t:py:(exception|class|classmethod|staticmethod|module|function|method|prefix):\w") + { $skip = $true + # Write-Host "$line" -Foreground Gray + continue + } + if ($line -match "^`t`t:Title:`t-") + { $skip = $false + # Write-Host "$line" -Foreground DarkCyan + continue + } + if (-not $skip) + { $strippedFileContent += $line + "`r`n" + } + } + $strippedFileContent | Out-File ..\temp\sphinx\PoC.stripped.rst -Encoding UTF8 + Write-Host "Complete" -Foreground Green +} + +Exit-Script diff --git a/doc/prolog.inc b/doc/prolog.inc new file mode 100644 index 0000000..75463a8 --- /dev/null +++ b/doc/prolog.inc @@ -0,0 +1,59 @@ +.. # Load pre-defined aliases and graphical characters like © from docutils + # is used to denote the special path + # \Lib\site-packages\docutils\parsers\rst\include +.. include:: +.. include:: + +.. # define a hard line break for HTML +.. |br| raw:: html + +
+ +.. # define horizontal line for HTML +.. |hr| raw:: html + +
+ +.. # define additional CSS based styles and ReST roles for HTML +.. raw:: html + + + +.. role:: bolditalic + :class: bolditalic + +.. 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/py-modindex.rst b/doc/py-modindex.rst new file mode 100644 index 0000000..23167be --- /dev/null +++ b/doc/py-modindex.rst @@ -0,0 +1,4 @@ +.. This file is a placeholder and will be replaced + +Module Index +############ diff --git a/doc/pySystemRDLModel/index.rst b/doc/pySystemRDLModel/index.rst new file mode 100644 index 0000000..1c3e618 --- /dev/null +++ b/doc/pySystemRDLModel/index.rst @@ -0,0 +1,8 @@ +Python Class Reference +###################### + +Reference of all packages and modules: + +.. toctree:: + + pySystemRDLModel diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 0000000..4017a3c --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,12 @@ +-r ../requirements.txt + +pyTooling >= 5.0.0, <6.0 + +# Enforce latest version on ReadTheDocs +sphinx>=5.3.0 + +# Sphinx Extenstions +sphinxcontrib-mermaid>=0.7.1 +autoapi>=2.0.1 +sphinx_fontawesome>=0.0.6 +sphinx_autodoc_typehints>=1.19.5 diff --git a/doc/shields.inc b/doc/shields.inc new file mode 100644 index 0000000..cca274c --- /dev/null +++ b/doc/shields.inc @@ -0,0 +1,190 @@ +.. # Use http://b64.io/ to encode any image to base64. Then replace `/` with + # `%2F` and `+` with `%2B` (or use http://meyerweb.com/eric/tools/dencoder/). + # Beware that `?logo=data:image/png;base64,` must also be converted to + # percent encoding so that the URL is properly parsed. + +.. # Sourcecode link to GitHub +.. |SHIELD:svg:pySystemRDLModel-github| image:: https://img.shields.io/badge/pyEDAA-pySystemRDLModel-29b6f6.svg?longCache=true&style=flat-square&logo=GitHub&labelColor=0277bd + :alt: Sourcecode on GitHub + :height: 22 + :target: https://GitHub.com/edaa-org/pySystemRDLModel +.. |SHIELD:png:pySystemRDLModel-github| image:: https://raster.shields.io/badge/pyEDAA-pySystemRDLModel-29b6f6.svg?longCache=true&style=flat-square&logo=GitHub&labelColor=0277bd + :alt: Sourcecode on GitHub + :height: 22 + :target: https://GitHub.com/edaa-org/pySystemRDLModel + +.. # Sourcecode license +.. |SHIELD:svg:pySystemRDLModel-src-license| image:: https://img.shields.io/pypi/l/pySystemRDLModel?longCache=true&style=flat-square&logo=Apache&label=code + :alt: Code license + :height: 22 + :target: License.html +.. |SHIELD:png:pySystemRDLModel-src-license| image:: https://img.shields.io/pypi/l/pySystemRDLModel?longCache=true&style=flat-square&logo=Apache&label=code + :alt: Code license + :height: 22 + :target: https://GitHub.com/edaa-org/pySystemRDLModel/blob/main/LICENSE.md + +.. # GitHub tag +.. |SHIELD:svg:pySystemRDLModel-tag| image:: https://img.shields.io/github/v/tag/edaa-org/pySystemRDLModel?longCache=true&style=flat-square&logo=GitHub&include_prereleases + :alt: GitHub tag (latest SemVer incl. pre-release + :height: 22 + :target: https://GitHub.com/edaa-org/pySystemRDLModel/tags +.. |SHIELD:png:pySystemRDLModel-tag| image:: https://raster.shields.io/github/v/tag/edaa-org/pySystemRDLModel?longCache=true&style=flat-square&logo=GitHub&include_prereleases + :alt: GitHub tag (latest SemVer incl. pre-release + :height: 22 + :target: https://GitHub.com/edaa-org/pySystemRDLModel/tags + +.. # GitHub release +.. |SHIELD:svg:pySystemRDLModel-release| image:: https://img.shields.io/github/v/release/edaa-org/pySystemRDLModel?longCache=true&style=flat-square&logo=GitHub&include_prereleases + :alt: GitHub release (latest SemVer incl. including pre-releases + :height: 22 + :target: https://GitHub.com/edaa-org/pySystemRDLModel/releases/latest +.. |SHIELD:png:pySystemRDLModel-release| image:: https://raster.shields.io/github/v/release/edaa-org/pySystemRDLModel?longCache=true&style=flat-square&logo=GitHub&include_prereleases + :alt: GitHub release (latest SemVer incl. including pre-releases + :height: 22 + :target: https://GitHub.com/edaa-org/pySystemRDLModel/releases/latest + +.. # GitHub release date +.. |SHIELD:svg:pySystemRDLModel-date| image:: https://img.shields.io/github/release-date/edaa-org/pySystemRDLModel?longCache=true&style=flat-square&logo=GitHub + :alt: GitHub release date + :height: 22 + :target: https://GitHub.com/edaa-org/pySystemRDLModel/releases +.. |SHIELD:png:pySystemRDLModel-date| image:: https://raster.shields.io/github/release-date/edaa-org/pySystemRDLModel?logo=GitHub + :alt: GitHub release date + :height: 22 + :target: https://GitHub.com/edaa-org/pySystemRDLModel/releases + +.. # GitHub/Libraries dependent projects +.. |SHIELD:svg:pySystemRDLModel-lib-dep| image:: https://img.shields.io/librariesio/dependent-repos/pypi/pySystemRDLModel?longCache=true&style=flat-square&logo=Libraries.io&logoColor=fff + :alt: Dependent repos (via libraries.io) + :height: 22 + :target: https://GitHub.com/edaa-org/pySystemRDLModel/network/dependents +.. |SHIELD:png:pySystemRDLModel-lib-dep| image:: https://raster.shields.io/librariesio/dependent-repos/pypi/pySystemRDLModel?longCache=true&style=flat-square&logo=Libraries.io&logoColor=fff + :alt: Dependent repos (via libraries.io) + :height: 22 + :target: https://GitHub.com/edaa-org/pySystemRDLModel/network/dependents + +.. # GHA test and coverage +.. |SHIELD:svg:pySystemRDLModel-gha-test| image:: https://img.shields.io/github/workflow/status/edaa-org/pySystemRDLModel/Pipeline/main?longCache=true&style=flat-square&label=Build%20and%20Test&logo=GitHub%20Actions&logoColor=FFFFFF + :alt: GitHub Workflow - Build and Test Status + :height: 22 + :target: https://GitHub.com/edaa-org/pySystemRDLModel/actions/workflows/Pipeline.yml +.. |SHIELD:png:pySystemRDLModel-gha-test| image:: https://raster.shields.io/github/workflow/status/edaa-org/pySystemRDLModel/Pipeline/main?longCache=true&style=flat-square&label=Build%20and%20Test&logo=GitHub%20Actions&logoColor=FFFFFF + :alt: GitHub Workflow - Build and Test Status + :height: 22 + :target: https://GitHub.com/edaa-org/pySystemRDLModel/actions/workflows/Pipeline.yml + +.. # Codacy - quality +.. |SHIELD:svg:pySystemRDLModel-codacy-quality| image:: https://img.shields.io/codacy/grade/39d312bf98244961975559f141c3e000?longCache=true&style=flat-square&logo=codacy + :alt: Codacy - Quality + :height: 22 + :target: https://www.codacy.com/gh/edaa-org/pySystemRDLModel +.. |SHIELD:png:pySystemRDLModel-codacy-quality| image:: https://raster.shields.io/codacy/grade/39d312bf98244961975559f141c3e000?longCache=true&style=flat-square&logo=codacy + :alt: Codacy - Quality + :height: 22 + :target: https://www.codacy.com/gh/edaa-org/pySystemRDLModel + +.. # Codacy - coverage +.. |SHIELD:svg:pySystemRDLModel-codacy-coverage| image:: https://img.shields.io/codacy/coverage/39d312bf98244961975559f141c3e000?longCache=true&style=flat-square&logo=codacy + :alt: Codacy - Line Coverage + :height: 22 + :target: https://www.codacy.com/gh/edaa-org/pySystemRDLModel +.. |SHIELD:png:pySystemRDLModel-codacy-coverage| image:: https://raster.shields.io/codacy/coverage/39d312bf98244961975559f141c3e000?longCache=true&style=flat-square&logo=codacy + :alt: Codacy - Line Coverage + :height: 22 + :target: https://www.codacy.com/gh/edaa-org/pySystemRDLModel + +.. # Codecov - coverage +.. |SHIELD:svg:pySystemRDLModel-codecov-coverage| image:: https://img.shields.io/codecov/c/github/edaa-org/pySystemRDLModel?longCache=true&style=flat-square&logo=Codecov + :alt: Codecov - Branch Coverage + :height: 22 + :target: https://codecov.io/gh/edaa-org/pySystemRDLModel +.. |SHIELD:png:pySystemRDLModel-codecov-coverage| image:: https://raster.shields.io/codecov/c/github/edaa-org/pySystemRDLModel?longCache=true&style=flat-square&logo=Codecov + :alt: Codecov - Branch Coverage + :height: 22 + :target: https://codecov.io/gh/edaa-org/pySystemRDLModel + +.. # Libraries - source rank +.. |SHIELD:svg:pySystemRDLModel-lib-rank| image:: https://img.shields.io/librariesio/sourcerank/pypi/pySystemRDLModel?longCache=true&style=flat-square&logo=Libraries.io&logoColor=fff + :alt: Libraries.io SourceRank + :height: 22 + :target: https://libraries.io/github/edaa-org/pySystemRDLModel/sourcerank +.. |SHIELD:png:pySystemRDLModel-lib-rank| image:: https://raster.shields.io/librariesio/sourcerank/pypi/pySystemRDLModel?longCache=true&style=flat-square&logo=Libraries.io&logoColor=fff + :alt: Libraries.io SourceRank + :height: 22 + :target: https://libraries.io/github/edaa-org/pySystemRDLModel/sourcerank + +.. # PyPI tag +.. |SHIELD:svg:pySystemRDLModel-pypi-tag| image:: https://img.shields.io/pypi/v/pySystemRDLModel?longCache=true&style=flat-square&logo=PyPI&logoColor=FBE072 + :alt: PyPI - Tag + :height: 22 + :target: https://pypi.org/project/pySystemRDLModel/ +.. |SHIELD:png:pySystemRDLModel-pypi-tag| image:: https://raster.shields.io/pypi/v/pySystemRDLModel?longCache=true&style=flat-square&logo=PyPI&logoColor=FBE072 + :alt: PyPI - Tag + :height: 22 + :target: https://pypi.org/project/pySystemRDLModel/ + +.. # PyPI project status +.. |SHIELD:svg:pySystemRDLModel-pypi-status| image:: https://img.shields.io/pypi/status/pySystemRDLModel?longCache=true&style=flat-square&logo=PyPI&logoColor=FBE072 + :alt: PyPI - Status + :height: 22 +.. |SHIELD:png:pySystemRDLModel-pypi-status| image:: https://raster.shields.io/pypi/status/pySystemRDLModel?longCache=true&style=flat-square&logo=PyPI&logoColor=FBE072 + :alt: PyPI - Status + :height: 22 + +.. # PyPI Python versions +.. |SHIELD:svg:pySystemRDLModel-pypi-python| image:: https://img.shields.io/pypi/pyversions/pySystemRDLModel?longCache=true&style=flat-square&logo=PyPI&logoColor=FBE072 + :alt: PyPI - Python Version + :height: 22 +.. |SHIELD:png:pySystemRDLModel-pypi-python| image:: https://raster.shields.io/pypi/pyversions/pySystemRDLModel?longCache=true&style=flat-square&logo=PyPI&logoColor=FBE072 + :alt: PyPI - Python Version + :height: 22 + +.. # Libraries - status +.. |SHIELD:svg:pySystemRDLModel-lib-status| image:: https://img.shields.io/librariesio/release/pypi/pySystemRDLModel?longCache=true&style=flat-square&logo=Libraries.io&logoColor=fff + :alt: Libraries.io status for latest release + :height: 22 + :target: https://libraries.io/github/edaa-org/pySystemRDLModel +.. |SHIELD:png:pySystemRDLModel-lib-status| image:: https://raster.shields.io/librariesio/release/pypi/pySystemRDLModel?longCache=true&style=flat-square&logo=Libraries.io&logoColor=fff + :alt: Libraries.io status for latest release + :height: 22 + :target: https://libraries.io/github/edaa-org/pySystemRDLModel + +.. # Requires - status +.. |SHIELD:svg:pySystemRDLModel-req-status| image:: https://img.shields.io/requires/github/edaa-org/pySystemRDLModel?longCache=true&style=flat-square + :alt: Requires.io + :height: 22 + :target: https://requires.io/github/edaa-org/pySystemRDLModel/requirements/?branch=main +.. |SHIELD:png:pySystemRDLModel-req-status| image:: https://raster.shields.io/requires/github/edaa-org/pySystemRDLModel?longCache=true&style=flat-square + :alt: Requires.io + :height: 22 + :target: https://requires.io/github/edaa-org/pySystemRDLModel/requirements/?branch=main + +.. # Documentation license +.. |SHIELD:svg:pySystemRDLModel-doc-license| image:: https://img.shields.io/badge/doc-CC--BY%204.0-green?longCache=true&style=flat-square&logo=CreativeCommons&logoColor=fff + :alt: Documentation License + :height: 22 + :target: Doc-License.html +.. |SHIELD:png:pySystemRDLModel-doc-license| image:: https://raster.shields.io/badge/doc-CC--BY%204.0-green?longCache=true&style=flat-square&logo=CreativeCommons&logoColor=fff + :alt: Documentation License + :height: 22 + :target: https://GitHub.com/edaa-org/pySystemRDLModel/blob/main/doc/Doc-License.rst + +.. # GHPages - read now +.. |SHIELD:svg:pySystemRDLModel-ghp-doc| image:: https://img.shields.io/website?longCache=true&style=flat-square&label=edaa-org.github.io%2FpySystemRDLModel&logo=GitHub&logoColor=fff&up_color=blueviolet&up_message=Read%20now%20%E2%9E%9A&url=https%3A%2F%2Fedaa-org.github.io%2FpySystemRDLModel%2Findex.html + :alt: Documentation - Read Now! + :height: 22 + :target: https://edaa-org.github.io/pySystemRDLModel/ +.. |SHIELD:png:pySystemRDLModel-ghp-doc| image:: https://raster.shields.io/website?longCache=true&style=flat-square&label=edaa-org.github.io%2FpySystemRDLModel&logo=GitHub&logoColor=fff&up_color=blueviolet&up_message=Read%20now%20%E2%9E%9A&url=https%3A%2F%2Fedaa-org.github.io%2FpySystemRDLModel%2Findex.html + :alt: Documentation - Read Now! + :height: 22 + :target: https://edaa-org.github.io/pySystemRDLModel/ + +.. # Gitter +.. |SHIELD:svg:pySystemRDLModel-gitter| image:: https://img.shields.io/badge/chat-on%20gitter-4db797.svg?longCache=true&style=flat-square&logo=gitter&logoColor=e8ecef + :alt: Documentation License + :height: 22 + :target: https://gitter.im/hdl/community +.. |SHIELD:png:pySystemRDLModel-gitter| image:: https://raster.shields.io/badge/chat-on%20gitter-4db797.svg?longCache=true&style=flat-square&logo=gitter&logoColor=e8ecef + :alt: Documentation License + :height: 22 + :target: https://gitter.im/hdl/community diff --git a/doc/typing/index.rst b/doc/typing/index.rst new file mode 100644 index 0000000..97d4ae2 --- /dev/null +++ b/doc/typing/index.rst @@ -0,0 +1,4 @@ +Static Type Checking Report +########################### + +*Placeholder for the Static Type Checking report generated with* ``mypy``. diff --git a/pySystemRDLModel/__init__.py b/pySystemRDLModel/__init__.py new file mode 100644 index 0000000..f86850e --- /dev/null +++ b/pySystemRDLModel/__init__.py @@ -0,0 +1,117 @@ +# ==================================================================================================================== # +# ____ _ ____ ____ _ __ __ _ _ # +# _ __ _ _/ ___| _ _ ___| |_ ___ _ __ ___ | _ \| _ \| | | \/ | ___ __| | ___| | # +# | '_ \| | | \___ \| | | / __| __/ _ \ '_ ` _ \| |_) | | | | | | |\/| |/ _ \ / _` |/ _ \ | # +# | |_) | |_| |___) | |_| \__ \ || __/ | | | | | _ <| |_| | |___| | | | (_) | (_| | __/ | # +# | .__/ \__, |____/ \__, |___/\__\___|_| |_| |_|_| \_\____/|_____|_| |_|\___/ \__,_|\___|_| # +# |_| |___/ |___/ # +# ==================================================================================================================== # +# Authors: # +# Patrick Lehmann # +# # +# License: # +# ==================================================================================================================== # +# Copyright 2023-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. # +# 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. # +# # +# SPDX-License-Identifier: Apache-2.0 # +# ==================================================================================================================== # +# +""" +An abstract SystemRDL language model. + +:copyright: Copyright 2023-2023 Patrick Lehmann - Bötzingen, Germany +:license: Apache License, Version 2.0 +""" +from enum import unique, Enum +from typing import Dict, Union + +from pyTooling.Decorators import export + + +__author__ = "Patrick Lehmann" +__email__ = "Paebbels@gmail.com" +__copyright__ = "2023-2023, Patrick Lehmann" +__license__ = "Apache License, Version 2.0" +__version__ = "0.1.0" + + +@export +@unique +class SystemRDLVersion(Enum): + Any = -1 + SystemVerilog2005 = 2005 + SystemVerilog2009 = 2009 + SystemVerilog2012 = 2012 + SystemVerilog2017 = 2017 + + __VERSION_MAPPINGS__: Dict[Union[int, str], Enum] = { + 5: SystemVerilog2005, + 9: SystemVerilog2009, + 12: SystemVerilog2012, + 17: SystemVerilog2017, + 2005: SystemVerilog2005, + 2009: SystemVerilog2009, + 2012: SystemVerilog2012, + 2017: SystemVerilog2017, + "Any": Any, + "05": SystemVerilog2005, + "09": SystemVerilog2009, + "12": SystemVerilog2012, + "17": SystemVerilog2017, + "2005": SystemVerilog2005, + "2009": SystemVerilog2009, + "2012": SystemVerilog2012, + "2017": SystemVerilog2017, + } + + 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(f"Value '{value!s}' cannot be parsed to member of {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 "SV'" + str(self.value)[-2:] + + def __repr__(self): + return str(self.value) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..387cfda --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,55 @@ +[build-system] +requires = [ + "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", + "tests/*" +] + +[tool.coverage.report] +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 pySystemRDLModel" + +[tool.coverage.xml] +output = "report/coverage/coverage.xml" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..013cc1f --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pyTooling >= 5.0.0, <6.0 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..98a423e --- /dev/null +++ b/setup.py @@ -0,0 +1,52 @@ +# ==================================================================================================================== # +# ____ _ ____ ____ _ __ __ _ _ # +# _ __ _ _/ ___| _ _ ___| |_ ___ _ __ ___ | _ \| _ \| | | \/ | ___ __| | ___| | # +# | '_ \| | | \___ \| | | / __| __/ _ \ '_ ` _ \| |_) | | | | | | |\/| |/ _ \ / _` |/ _ \ | # +# | |_) | |_| |___) | |_| \__ \ || __/ | | | | | _ <| |_| | |___| | | | (_) | (_| | __/ | # +# | .__/ \__, |____/ \__, |___/\__\___|_| |_| |_|_| \_\____/|_____|_| |_|\___/ \__,_|\___|_| # +# |_| |___/ |___/ # +# ==================================================================================================================== # +# Authors: # +# Patrick Lehmann # +# # +# License: # +# ==================================================================================================================== # +# Copyright 2023-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. # +# 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. # +# # +# SPDX-License-Identifier: Apache-2.0 # +# ==================================================================================================================== # +# +"""Package installer for 'An abstract SystemRDL language model'.""" +from pathlib import Path +from pyTooling.Packaging import DescribePythonPackageHostedOnGitHub, DEFAULT_CLASSIFIERS + +gitHubNamespace = "edaa-org" +packageName = "pySystemRDLModel" +packageDirectory = packageName +packageInformationFile = Path(f"{packageDirectory}/__init__.py") + +DescribePythonPackageHostedOnGitHub( + packageName=packageName, + description="An abstract SystemRDL language model.", + gitHubNamespace=gitHubNamespace, + keywords="Python3 SystemRDL Language Model Abstract", + sourceFileWithVersion=packageInformationFile, + developmentStatus="alpha", + classifiers=list(DEFAULT_CLASSIFIERS) + [ + "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)", + "Topic :: Software Development :: Code Generators", + "Topic :: Software Development :: Compilers" + ] +) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/requirements.txt b/tests/requirements.txt new file mode 100644 index 0000000..6407e55 --- /dev/null +++ b/tests/requirements.txt @@ -0,0 +1,12 @@ +-r ../requirements.txt + +# Coverage collection +Coverage>=7.0 + +# Test Runner +pytest>=7.2.0 +pytest-cov>=4.0.0 + +# Static Type Checking +mypy >= 1.2 +lxml>=4.9 diff --git a/tests/unit/Instantiate.py b/tests/unit/Instantiate.py new file mode 100644 index 0000000..7a36d4d --- /dev/null +++ b/tests/unit/Instantiate.py @@ -0,0 +1,47 @@ +# ==================================================================================================================== # +# ____ _ ____ ____ _ __ __ _ _ # +# _ __ _ _/ ___| _ _ ___| |_ ___ _ __ ___ | _ \| _ \| | | \/ | ___ __| | ___| | # +# | '_ \| | | \___ \| | | / __| __/ _ \ '_ ` _ \| |_) | | | | | | |\/| |/ _ \ / _` |/ _ \ | # +# | |_) | |_| |___) | |_| \__ \ || __/ | | | | | _ <| |_| | |___| | | | (_) | (_| | __/ | # +# | .__/ \__, |____/ \__, |___/\__\___|_| |_| |_|_| \_\____/|_____|_| |_|\___/ \__,_|\___|_| # +# |_| |___/ |___/ # +# ==================================================================================================================== # +# Authors: # +# Patrick Lehmann # +# # +# License: # +# ==================================================================================================================== # +# Copyright 2023-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. # +# 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. # +# # +# SPDX-License-Identifier: Apache-2.0 # +# ==================================================================================================================== # +# +"""Instantiation tests for the language model.""" +from unittest import TestCase + +from pySystemRDLModel import SystemRDLVersion + + +if __name__ == "__main__": # pragma: no cover + print("ERROR: you called a testcase declaration file as an executable module.") + print("Use: 'python -m unitest '") + exit(1) + + +class Instantiate(TestCase): + def test_SystemRDLVersion(self): + version = SystemRDLVersion.Parse("2017") + + self.assertIsNotNone(version) diff --git a/tests/unit/__init__.py b/tests/unit/__init__.py new file mode 100644 index 0000000..d2b2394 --- /dev/null +++ b/tests/unit/__init__.py @@ -0,0 +1,30 @@ +# ==================================================================================================================== # +# ____ _ ____ ____ _ __ __ _ _ # +# _ __ _ _/ ___| _ _ ___| |_ ___ _ __ ___ | _ \| _ \| | | \/ | ___ __| | ___| | # +# | '_ \| | | \___ \| | | / __| __/ _ \ '_ ` _ \| |_) | | | | | | |\/| |/ _ \ / _` |/ _ \ | # +# | |_) | |_| |___) | |_| \__ \ || __/ | | | | | _ <| |_| | |___| | | | (_) | (_| | __/ | # +# | .__/ \__, |____/ \__, |___/\__\___|_| |_| |_|_| \_\____/|_____|_| |_|\___/ \__,_|\___|_| # +# |_| |___/ |___/ # +# ==================================================================================================================== # +# Authors: # +# Patrick Lehmann # +# # +# License: # +# ==================================================================================================================== # +# Copyright 2023-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. # +# 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. # +# # +# SPDX-License-Identifier: Apache-2.0 # +# ==================================================================================================================== # +#