diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..284d8c2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,35 @@ +-------- +Issue Description +-------- +##### What did you expect to see happen? + + +##### What did you see instead? + + +##### Do you have a suggested fix for the development team? + + +##### Please attach the input file(s) that generate this error. The simpler the input, the faster we can find the issue. + + + +---------------- +For Change Control Board: Issue Review +---------------- +This review should occur before any development is performed as a response to this issue. +- [ ] 1. Is it tagged with a type: defect or task? +- [ ] 2. Is it tagged with a priority: critical, normal or minor? +- [ ] 3. If it will impact requirements or requirements tests, is it tagged with requirements? +- [ ] 4. If it is a defect, can it cause wrong results for users? If so an email needs to be sent to the users. +- [ ] 5. Is a rationale provided? (Such as explaining why the improvement is needed or why current code is wrong.) + +------- +For Change Control Board: Issue Closure +------- +This review should occur when the issue is imminently going to be closed. +- [ ] 1. If the issue is a defect, is the defect fixed? +- [ ] 2. If the issue is a defect, is the defect tested for in the regression test system? (If not explain why not.) +- [ ] 3. If the issue can impact users, has an email to the users group been written (the email should specify if the defect impacts stable or master)? +- [ ] 4. If the issue is a defect, does it impact the latest release branch? If yes, is there any issue tagged with release (create if needed)? +- [ ] 5. If the issue is being closed without a pull request, has an explanation of why it is being closed been provided? diff --git a/.github/ISSUE_TEMPLATE/defect-report.yml b/.github/ISSUE_TEMPLATE/defect-report.yml new file mode 100644 index 0000000..de9dad0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/defect-report.yml @@ -0,0 +1,95 @@ +name: Defect Report +description: Report a DEFECT you experienced using the code +title: "[DEFECT] " +labels: defect, priority_normal +body: + - type: checkboxes + id: requirements + attributes: + label: Thank you for the defect report + description: Please check the suggestions below before proceeding + options: + - label: I am using the latest version. + required: true + - label: | + I have created a [minimum, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) + that demonstrates the defect. + - type: textarea + id: defect-description + attributes: + label: Defect Description + description: A clear and concise description of what the defect is. + validations: + required: true + - type: textarea + id: steps-to-reproduce + attributes: + label: Steps to Reproduce + description: Describe how to reproduce the defect. + validations: + required: true + - type: textarea + id: expected-behavior + attributes: + label: Expected Behavior + description: A clear and concise description of what you expected to happen. + validations: + required: true + - type: textarea + id: additional-info + attributes: + label: Screenshots and Input Files + description: Please attach any additional information like input files, screenshots, recordings and logs, etc. + validations: + required: false + - type: dropdown + id: which-os + attributes: + label: OS + description: Which OS are you using? + options: + - Linux + - MacOS + - Windows + validations: + required: true + - type: input + id: which-version + attributes: + label: OS Version + description: Which OS version are you using? + placeholder: "10.15.5" + validations: + required: false + - type: dropdown + id: which-package-manager + attributes: + label: Dependency Manager + description: Which Dependency Manager are you using? + options: + - PIP + - CONDA + validations: + required: true + - type: checkboxes + id: issue-review + attributes: + label: "For Change Control Board: Issue Review" + description: "This review should occur before any development is performed as a response to this issue." + options: + - label: "Is it tagged with a type: defect or task?" + - label: "Is it tagged with a priority: critical, normal or minor?" + - label: "If it will impact requirements or requirements tests, is it tagged with requirements?" + - label: "If it is a defect, can it cause wrong results for users? If so an email needs to be sent to the users." + - label: "Is a rationale provided? (Such as explaining why the improvement is needed or why current code is wrong.)" + - type: checkboxes + id: issue-closure + attributes: + label: "For Change Control Board: Issue Closure" + description: "This review should occur when the issue is imminently going to be closed." + options: + - label: "If the issue is a defect, is the defect fixed?" + - label: "If the issue is a defect, is the defect tested for in the regression test system? (If not explain why not.)" + - label: "If the issue can impact users, has an email to the users group been written (the email should specify if the defect impacts stable or master)?" + - label: "If the issue is a defect, does it impact the latest release branch? If yes, is there any issue tagged with release (create if needed)?" + - label: "If the issue is being closed without a pull request, has an explanation of why it is being closed been provided?" diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..173c8d5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,42 @@ +--- +name: Feature request +about: Suggest a new capability or addition you would like to see +title: "[TASK] Title here" +labels: priority_minor, task +assignees: + + +--- + +-------- +Issue Description +-------- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +---------------- +For Change Control Board: Issue Review +---------------- +This review should occur before any development is performed as a response to this issue. +- [ ] 1. Is it tagged with a type: defect or task? +- [ ] 2. Is it tagged with a priority: critical, normal or minor? +- [ ] 3. If it will impact requirements or requirements tests, is it tagged with requirements? +- [ ] 4. If it is a defect, can it cause wrong results for users? If so an email needs to be sent to the users. +- [ ] 5. Is a rationale provided? (Such as explaining why the improvement is needed or why current code is wrong.) + +------- +For Change Control Board: Issue Closure +------- +This review should occur when the issue is imminently going to be closed. +- [ ] 1. If the issue is a defect, is the defect fixed? +- [ ] 2. If the issue is a defect, is the defect tested for in the regression test system? (If not explain why not.) +- [ ] 3. If the issue can impact users, has an email to the users group been written (the email should specify if the defect impacts stable or master)? +- [ ] 4. If the issue is a defect, does it impact the latest release branch? If yes, is there any issue tagged with release (create if needed)? +- [ ] 5. If the issue is being closed without a pull request, has an explanation of why it is being closed been provided? diff --git a/.github/ISSUE_TEMPLATE/under-discussion.md b/.github/ISSUE_TEMPLATE/under-discussion.md new file mode 100644 index 0000000..f398745 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/under-discussion.md @@ -0,0 +1,37 @@ +--- +name: Under Discussion +about: This issue template is aimed to propose an item of discussion for new features + or similar +title: "[UNDER-DISCUSSION] New Topic" +labels: under-discussion +assignees: + + +--- + +-------- +Under Discussion Topic +-------- + +**Summary of the topic to be discussed with the development team** +A clear and concise description of the topic to be discusses + +**Describe the solution you'd like to be implemented** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +---------------- +For Change Control Board: Issue Review +---------------- +This review should occur before any development is performed as a response to this issue. +- [ ] 1. Is it tagged with the under_discussion type? +- [ ] 2. If implemented, it will add a new requirement? +- [ ] 3. Is a rationale provided? (Such as explaining why the improvement is needed ) + +------- +For Change Control Board: Issue Closure +------- +This review should occur when the issue is imminently going to be closed. +- [ ] 1. The discussion determined the addition of a new ```task``` issue? diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..c2a166b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,21 @@ +-------- +Pull Request Description +-------- +##### What issue does this change request address? (Use "#" before the issue to link it, i.e., #42.) + + +##### What are the significant changes in functionality due to this change request? + + +---------------- +For Change Control Board: Change Request Review +---------------- +The following review must be completed by an authorized member of the Change Control Board. +- [ ] 1. Review all computer code. +- [ ] 2. If any changes occur to the input syntax, there must be an accompanying change to the user manual and xsd schema. If the input syntax change deprecates existing input files, a conversion script needs to be added (see Conversion Scripts). +- [ ] 3. Make sure the Python code and commenting standards are respected. +- [ ] 4. Automated Tests should pass. +- [ ] 5. If significant functionality is added, there must be tests added to check this. Tests should cover all possible options. Multiple short tests are preferred over one large test. +- [ ] 6. If the change modifies or adds a requirement or a requirement based test case, the Change Control Board's Chair or designee also needs to approve the change. The requirements and the requirements test shall be in sync. +- [ ] 7. The merge request must reference an issue. If the issue is closed, the issue close checklist shall be done. + diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml new file mode 100644 index 0000000..b6adaad --- /dev/null +++ b/.github/workflows/github-actions.yml @@ -0,0 +1,94 @@ +name: GitHub DACKAR test +run-name: ${{ github.actor }} is testing out DACKAR +on: [push, pull_request] + +concurrency: + # Here the group is defined by the head_ref of the PR + group: ${{ github.head_ref }} + # Here we specify that we'll cancel any "in progress" workflow of the same group. Thus if we push, ammend a commit and push + # again the previous workflow will be cancelled, thus saving us github action build minutes and avoid any conflicts + cancel-in-progress: true + +jobs: + Test-DACKAR-Linux: + # runs-on: [self-hosted, ubuntu-latest] + # runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }} + runs-on: ubuntu-latest + steps: + - uses: conda-incubator/setup-miniconda@v3 + with: + miniconda-version: "latest" + channels: conda-forge, defaults + use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + auto-update-conda: true + auto-activate-base: true + - run: echo " The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo " This job is now running on a ${{ runner.os }} server" + - run: echo " The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: pwd + - run: | + conda create -n dackar_libs python=3.11 + conda init bash && source ~/.bashrc && conda activate dackar_libs + pip install spacy==3.5 textacy matplotlib nltk coreferee beautifulsoup4 networkx pysbd tomli numerizer autocorrect pywsd openpyxl quantulum3[classifier] numpy==1.26 scikit-learn pyspellchecker contextualSpellCheck pandas + python3 -m spacy download en_core_web_lg + python3 -m coreferee install en + python3 -m nltk.downloader all + + + Test-DACKAR-Macos: + runs-on: macos-latest + steps: + - uses: conda-incubator/setup-miniconda@v3 + with: + miniconda-version: "latest" + channels: conda-forge, defaults + use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + auto-update-conda: true + auto-activate-base: true + - run: echo " The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo " This job is now running on a ${{ runner.os }} server" + - run: echo " The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: pwd + - run: | + conda create -n dackar_libs python=3.11 + conda init zsh && source ~/.zshrc && conda activate dackar_libs + pip install spacy==3.5 textacy matplotlib nltk coreferee beautifulsoup4 networkx pysbd tomli numerizer autocorrect pywsd openpyxl quantulum3[classifier] numpy==1.26 scikit-learn pyspellchecker contextualSpellCheck pandas + python3 -m spacy download en_core_web_lg + python3 -m coreferee install en + python3 -m nltk.downloader all + + + Test-DACKAR-Windows: + runs-on: windows-latest + steps: + - uses: conda-incubator/setup-miniconda@v3 + with: + miniconda-version: "latest" + channels: conda-forge, defaults + use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + activate-environment: dackar_libs + auto-update-conda: true + auto-activate-base: false + - run: echo " The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo " This job is now running on a ${{ runner.os }} server" + - run: echo " The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: Check out repository code + uses: actions/checkout@v3 + - run: pwd + - run: | + echo " Create dackar_libs" + conda install python=3.11 + echo " Conda information" + conda info + echo " Activate Dackar conda environment" + pip install spacy==3.5 textacy matplotlib nltk coreferee beautifulsoup4 networkx pysbd tomli numerizer autocorrect pywsd openpyxl quantulum3[classifier] numpy==1.26 scikit-learn pyspellchecker contextualSpellCheck pandas + conda list + which python + python -m spacy download en_core_web_lg + python -m coreferee install en + python -m nltk.downloader all + diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml new file mode 100644 index 0000000..4bfe09a --- /dev/null +++ b/.github/workflows/sphinx.yml @@ -0,0 +1,54 @@ +name: "Sphinx: Render docs" + +on: push + +jobs: + build: + # runs-on: ubuntu-latest + runs-on: ubuntu-22.04 + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: conda-incubator/setup-miniconda@v3 + with: + miniconda-version: "latest" + channels: conda-forge, defaults + use-only-tar-bz2: true # IMPORTANT: This needs to be set for caching to work properly! + auto-update-conda: true + activate-environment: dackar_libs + auto-activate-base: false + # - name: Use Pandoc + # uses: docker://pandoc/core:2.9 + # with: + # args: "--help" # gets appended to pandoc command + - name: Install + uses: pandoc/actions/setup@v1 + with: + version: 2.19 + + - name: Run pandoc + run: pandoc --version + - run: echo " Install Libraries Required to build Sphinx Documents" + - run: | + pwd + ls -l + pip install sphinx sphinx_rtd_theme nbsphinx sphinx-copybutton sphinx-autoapi + cd docs + make html + cd .. + # - name: Build HTML + # uses: ammaraskar/sphinx-action@master + # with: + # pre-build-command: "apt-get update && apt-get install -y pandoc" + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: html-docs + path: docs/_build/html/ + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/_build/html diff --git a/README.md b/README.md index 018fada..6466f69 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ autodoc_inherit_docstrings = False ```bash pip install sphinx sphinx_rtd_theme nbsphinx sphinx-copybutton sphinx-autoapi conda install pandoc - cd doc + cd docs make html cd _build/html python3 -m http.server @@ -61,7 +61,7 @@ open your brower to: http://localhost:8000 conda activate dackar_libs - pip install spacy==3.5 textacy matplotlib nltk coreferee beautifulsoup4 networkx pysbd tomli numerizer autocorrect pywsd openpyxl quantulum3[classifier] numpy scikit-learn pyspellchecker contextualSpellCheck pandas + pip install spacy==3.5 textacy matplotlib nltk coreferee beautifulsoup4 networkx pysbd tomli numerizer autocorrect pywsd openpyxl quantulum3[classifier] numpy=1.26 scikit-learn pyspellchecker contextualSpellCheck pandas ``` - Download language model from spacy (can not use INL network) @@ -126,7 +126,7 @@ For this project, the users can also try the following steps: ```bash conda create -n nlp_libs python=3.9 conda activate nlp_libs - pip install spacy==3.1 textacy matplotlib nltk coreferee beautifulsoup4 networkx pysbd tomli numerizer autocorrect pywsd openpyxl quantulum3[classifier] numpy scikit-learn==1.2.2 pyspellchecker + pip install spacy==3.1 textacy matplotlib nltk coreferee beautifulsoup4 networkx pysbd tomli numerizer autocorrect pywsd openpyxl quantulum3[classifier] numpy==1.26 scikit-learn==1.2.2 pyspellchecker ``` **scikit-learn 1.2.2 is required for quantulum3** diff --git a/doc/Makefile b/docs/Makefile similarity index 100% rename from doc/Makefile rename to docs/Makefile diff --git a/doc/conf.py b/docs/conf.py similarity index 92% rename from doc/conf.py rename to docs/conf.py index 7d8ddd9..feb78c2 100644 --- a/doc/conf.py +++ b/docs/conf.py @@ -13,8 +13,9 @@ # 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. -sys.path.insert(0, os.path.abspath('../src')) -from dackar import __version__ +# sys.path.insert(0, os.path.abspath('../src')) +# from dackar import __version__ +__version__ = '0.1' # -- Project information ----------------------------------------------------- @@ -28,19 +29,20 @@ # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration -extensions = ['sphinx.ext.intersphinx', - 'sphinx.ext.autodoc', +extensions = [ + "sphinx.ext.napoleon", # <- For Google style docstrings + 'sphinx.ext.intersphinx', 'sphinx.ext.doctest', 'sphinx.ext.todo', "sphinx.ext.autodoc.typehints", "sphinx.ext.mathjax", "sphinx.ext.autosummary", "nbsphinx", # <- For Jupyter Notebook support - "sphinx.ext.napoleon", # <- For Google style docstrings "sphinx.ext.imgmath", "sphinx.ext.viewcode", 'autoapi.extension', 'sphinx_copybutton', + 'sphinx.ext.autodoc', ] templates_path = ['_templates'] diff --git a/doc/contributors.rst b/docs/contributors.rst similarity index 100% rename from doc/contributors.rst rename to docs/contributors.rst diff --git a/doc/index.rst b/docs/index.rst similarity index 100% rename from doc/index.rst rename to docs/index.rst diff --git a/doc/install.rst b/docs/install.rst similarity index 100% rename from doc/install.rst rename to docs/install.rst diff --git a/doc/install_spacy3.5.rst b/docs/install_spacy3.5.rst similarity index 95% rename from doc/install_spacy3.5.rst rename to docs/install_spacy3.5.rst index 12ca699..d3626ac 100644 --- a/doc/install_spacy3.5.rst +++ b/docs/install_spacy3.5.rst @@ -11,7 +11,7 @@ How to install dependency libraries conda activate dackar_libs - pip install spacy==3.5 textacy matplotlib nltk coreferee beautifulsoup4 networkx pysbd tomli numerizer autocorrect pywsd openpyxl quantulum3[classifier] numpy scikit-learn pyspellchecker contextualSpellCheck pandas + pip install spacy==3.5 textacy matplotlib nltk coreferee beautifulsoup4 networkx pysbd tomli numerizer autocorrect pywsd openpyxl quantulum3[classifier] numpy=1.26 scikit-learn pyspellchecker contextualSpellCheck pandas .. conda install -c conda-forge pandas .. scikit-learn 1.2.2 is required for quantulum3 diff --git a/doc/make.bat b/docs/make.bat similarity index 100% rename from doc/make.bat rename to docs/make.bat diff --git a/doc/notebooks/index.rst b/docs/notebooks/index.rst similarity index 100% rename from doc/notebooks/index.rst rename to docs/notebooks/index.rst diff --git a/doc/pics/logo.png b/docs/pics/logo.png similarity index 100% rename from doc/pics/logo.png rename to docs/pics/logo.png diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..63304e9 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,7 @@ +sphinx>=6.2.0 +sphinx-rtd-theme +nbsphinx +sphinx-copybutton +sphinx-autoapi +furo +pypandoc_binary diff --git a/doc/support.rst b/docs/support.rst similarity index 100% rename from doc/support.rst rename to docs/support.rst diff --git a/src/dackar/utils/mbse/LMLparser.py b/src/dackar/utils/mbse/LMLparser.py index 2af1d23..315f943 100644 --- a/src/dackar/utils/mbse/LMLparser.py +++ b/src/dackar/utils/mbse/LMLparser.py @@ -41,10 +41,13 @@ def LMLparser(self, diagramName): """ This method is designed to parse the xml file containing the MBSE model, to create its corresponding graph and to populate: - - the set of entities: dictionary of assets in the form of 'LML_ID': ('asset name', 'asset ID') - - the set of links: list containing the LML-IDs of all links between assets - - the set of embedded entities: dictionary of the components that have been specified in the description text of the - LML asset or link (e.g., [comp1,comp2,comp3]) in the form of 'LML_ID': [comp1,comp2,comp3] + + * the set of entities: dictionary of assets in the form of 'LML_ID': ('asset name', 'asset ID') + + * the set of links: list containing the LML-IDs of all links between assets + + * the set of embedded entities: dictionary of the components that have been specified in the description text of the + LML asset or link (e.g., [comp1,comp2,comp3]) in the form of 'LML_ID': [comp1,comp2,comp3] Args: @@ -99,8 +102,8 @@ def parseLinkEntity(self, linkNode): Args: - linkNode: xml node, xml node containing containing all the information of a single link generated - in LML using Innoslate + linkNode: xml node, xml node containing containing all the information of a single link generated + in LML using Innoslate Returns: @@ -130,8 +133,8 @@ def parseAssetEntity(self, entityNode): Args: - linkNode: xml node, xml node containing containing all the information of a single link generated - in LML using Innoslate + linkNode: xml node, xml node containing containing all the information of a single link generated + in LML using Innoslate Returns: @@ -202,8 +205,8 @@ def returnEntities(self): Returns: - self.entities : dict, dict of entities - self.embEntities : dict, dict of embedded entities + self.entities : dict, dict of entities + self.embEntities : dict, dict of embedded entities """ return self.entities, self.embEntities @@ -323,9 +326,9 @@ def parseEntityDescription(text): Returns: - out : tuple, tuple containing the list of elements specified in square brackets and separated - by commas (e.g., ['FV304,'305']) and the link to an external MBSE model - (e.g., ('centrifugalPumpFull', 'body')) + out: tuple, tuple containing the list of elements specified in square brackets and separated + by commas (e.g., ['FV304,'305']) and the link to an external MBSE model + (e.g., ('centrifugalPumpFull', 'body')) """