From d0e190c086b4f3403242f3d5bb038023454829c1 Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Tue, 4 Oct 2022 10:38:00 +0200 Subject: [PATCH 01/23] Use release/v1 for PyPI release action Fixes #482 --- .github/workflows/cd_publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd_publish.yml b/.github/workflows/cd_publish.yml index 18b58ca54..00f7ebb45 100644 --- a/.github/workflows/cd_publish.yml +++ b/.github/workflows/cd_publish.yml @@ -85,7 +85,7 @@ jobs: run: python setup.py sdist bdist_wheel - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__ password: ${{ secrets.PYPI_TOKEN }} From e5346cf12f8aec15a49406a53da86b1f1336692d Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Tue, 4 Oct 2022 17:21:11 +0200 Subject: [PATCH 02/23] Use SINTEF/ci-cd --- .github/workflows/cd_publish.yml | 143 ++++-------------- .github/workflows/ci_automerge_dependabot.yml | 25 +-- .github/workflows/ci_cd_updated_master.yml | 139 +++-------------- .github/workflows/ci_dependabot.yml | 107 ++----------- .github/workflows/ci_workflow.yml | 140 ++++++----------- docs/api_reference/emmopy/emmocheck.md | 2 +- mkdocs.yml | 9 +- requirements_docs.txt | 2 +- 8 files changed, 122 insertions(+), 445 deletions(-) diff --git a/.github/workflows/cd_publish.yml b/.github/workflows/cd_publish.yml index 00f7ebb45..64e79dd5b 100644 --- a/.github/workflows/cd_publish.yml +++ b/.github/workflows/cd_publish.yml @@ -4,121 +4,30 @@ on: release: types: [published] -env: - PUBLISH_UPDATE_BRANCH: master - GIT_USER_NAME: EMMOntoPy Developers - GIT_USER_EMAIL: "Team4.0@SINTEF.no" - jobs: - update-and-publish: - name: Update CHANGELOG and documentation - if: github.repository == 'emmo-repo/EMMOntoPy' - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Python 3.7 - uses: actions/setup-python@v4 - with: - python-version: 3.7 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel - pip install -U -e .[dev] - - - name: Set up git user - run: | - git config --global user.name "${GIT_USER_NAME}" - git config --global user.email "${GIT_USER_EMAIL}" - - - name: Update changelog - uses: CharMixer/auto-changelog-action@v1 - with: - token: ${{ secrets.RELEASE_PAT }} - release_branch: ${{ env.PUBLISH_UPDATE_BRANCH }} - - - name: Update version and tag - run: | - invoke setver --ver="${GITHUB_REF#refs/tags/}" - git add ontopy/__init__.py CHANGELOG.md - git commit -m "Release ${GITHUB_REF#refs/tags/}" - - TAG_MSG=.github/utils/release_tag_msg.txt - sed -i "s|TAG_NAME|${GITHUB_REF#refs/tags/}|" "${TAG_MSG}" - git tag -af -F "${TAG_MSG}" ${GITHUB_REF#refs/tags/} - - - name: Push new commit and update tag - uses: CasperWA/push-protected@v2 - with: - token: ${{ secrets.RELEASE_PAT }} - branch: ${{ env.PUBLISH_UPDATE_BRANCH }} - force: true - tags: true - unprotect_reviews: true - - - name: Get tagged versions - run: echo "PREVIOUS_VERSION=$(git tag -l --sort -version:refname | grep -E "^v0\.[1-8].*$" | sed -n 2p)" >> $GITHUB_ENV - - - name: Create release-specific changelog - uses: CharMixer/auto-changelog-action@v1 - with: - token: ${{ secrets.RELEASE_PAT }} - release_branch: ${{ env.PUBLISH_UPDATE_BRANCH }} - since_tag: "${{ env.PREVIOUS_VERSION }}" - output: "release_changelog.md" - - - name: Append changelog to release body - run: | - gh api /repos/${{ github.repository }}/releases/${{ github.event.release.id }} --jq '.body' > release_body.md - cat release_changelog.md >> release_body.md - gh api /repos/${{ github.repository }}/releases/${{ github.event.release.id }} -X PATCH -F body='@release_body.md' - env: - GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }} - - - name: Build source and built distributions - run: python setup.py sdist bdist_wheel - - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }} - - deploy-docs: - name: Deploy new documentation - runs-on: ubuntu-latest - needs: update-and-publish - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ env.PUBLISH_UPDATE_BRANCH }} - - - name: Set up Python 3.7 - uses: actions/setup-python@v4 - with: - python-version: 3.7 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel - pip install -U -e .[docs] - - - name: Set up git user - run: | - git config --global user.name "${{ env.GIT_USER_NAME }}" - git config --global user.email "${{ env.GIT_USER_EMAIL }}" - - - name: Deploy documentation - run: | - mike deploy --push --remote origin --branch gh-pages --update-aliases --config-file mkdocs.yml ${GITHUB_REF#refs/tags/v} stable - mike deploy --push --remote origin --branch gh-pages --update-aliases --config-file mkdocs.yml latest ${{ env.PUBLISH_UPDATE_BRANCH }} + publish: + name: External + uses: SINTEF/ci-cd/.github/workflows/cd_release.yml@v1 + if: github.repository == 'emmo-repo/EMMOntoPy' && startsWith(github.ref, 'refs/tags/v') + with: + git_username: EMMOntoPy Developers + git_email: "Team4.0@SINTEF.no" + python_version: "3.7" + release_branch: master + + # Publish package + python_package: true + # We're mentioning only 'ontopy', since the version is set only in ontopy/__init__.py + package_dir: ontopy + install_extras: "[dev]" + build_cmd: "python -m build" + publish_on_pypi: true + + # Update documentation + update_docs: true + doc_extras: "[docs]" + changelog_exclude_labels: dependencies + + secrets: + PyPI_token: ${{ secrets.PYPI_TOKEN }} + PAT: ${{ secrets.RELEASE_PAT }} diff --git a/.github/workflows/ci_automerge_dependabot.yml b/.github/workflows/ci_automerge_dependabot.yml index 2ab15f7cd..d241f92f8 100644 --- a/.github/workflows/ci_automerge_dependabot.yml +++ b/.github/workflows/ci_automerge_dependabot.yml @@ -6,25 +6,8 @@ on: jobs: update-dependabot-branch: - name: Update permanent dependabot branch + name: External + uses: SINTEF/ci-cd/.github/workflows/ci_automerge_prs.yml@v1 if: github.repository_owner == 'emmo-repo' && startsWith(github.event.pull_request.head.ref, 'dependabot/') && github.actor == 'dependabot[bot]' - runs-on: ubuntu-latest - - env: - DEPENDABOT_BRANCH: ci/dependabot-updates - GIT_USER_NAME: EMMOntoPy Developers - GIT_USER_EMAIL: "Team4.0@SINTEF.no" - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.ref }} - - - name: Activate auto-merge - run: | - PR_ID="$(gh api graphql -F owner='{owner}' -F name='{repo}' -f query='query($owner: String!, $name: String!) {repository(owner: $owner, name: $name) {pullRequest(number: ${{ github.event.pull_request.number }}) {id}}}' --jq '.data.repository.pullRequest.id')" - gh api graphql -f pr_id="$PR_ID" -f query='mutation($pr_id: ID!) {enablePullRequestAutoMerge(input:{mergeMethod:SQUASH,pullRequestId:$pr_id }) {pullRequest {number}}}' - env: - GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }} + secrets: + PAT: ${{ secrets.RELEASE_PAT }} diff --git a/.github/workflows/ci_cd_updated_master.yml b/.github/workflows/ci_cd_updated_master.yml index d9607ee29..86fe4e5f4 100644 --- a/.github/workflows/ci_cd_updated_master.yml +++ b/.github/workflows/ci_cd_updated_master.yml @@ -4,122 +4,27 @@ on: push: branches: [master] -env: - DEPENDABOT_BRANCH: ci/dependabot-updates - GIT_USER_NAME: EMMOntoPy Developers - GIT_USER_EMAIL: "Team4.0@SINTEF.no" - DEFAULT_REPO_BRANCH: master - jobs: - update-dependabot-branch: - name: Update permanent dependabot branch - if: github.repository_owner == 'emmo-repo' - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - ref: ${{ env.DEPENDABOT_BRANCH }} - fetch-depth: 0 - - - name: Set up git config - run: | - git config --global user.name "${{ env.GIT_USER_NAME }}" - git config --global user.email "${{ env.GIT_USER_EMAIL }}" - - - name: Update '${{ env.DEPENDABOT_BRANCH }}' - run: | - git fetch origin - - LATEST_PR_BODY="$(gh api /repos/${{ github.repository}}/pulls -X GET -f state=closed -f per_page=1 -f sort=updated -f direction=desc --jq '.[].body')" - cat .github/utils/single_dependency_pr_body.txt | head -8 > .tmp_file.txt - if [ -z "$(printf '%s\n' "${LATEST_PR_BODY}" | head -8 | diff - .tmp_file.txt --strip-trailing-cr)" ]; then - # The dependency branch has just been merged into `${{ env.DEFAULT_REPO_BRANCH }}` - # The dependency branch should be reset to `${{ env.DEFAULT_REPO_BRANCH }}` - echo "The dependencies have just been updated! Reset to ${{ env.DEFAULT_REPO_BRANCH }}." - git reset --hard origin/${{ env.DEFAULT_REPO_BRANCH }} - echo "FORCE_PUSH=yes" >> $GITHUB_ENV - else - # Normal procedure: Merge `${{ env.DEFAULT_REPO_BRANCH }}` into `${{ env.DEPENDABOT_BRANCH }}` - echo "Merge new updates to ${{ env.DEFAULT_REPO_BRANCH }} into ${{ env.DEPENDABOT_BRANCH }}" - git merge -m "Keep '${{ env.DEPENDABOT_BRANCH }}' up-to-date with '${{ env.DEFAULT_REPO_BRANCH }}'" origin/${{ env.DEFAULT_REPO_BRANCH }} - echo "FORCE_PUSH=no" >> $GITHUB_ENV - fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Push to '${{ env.DEPENDABOT_BRANCH }}' - uses: CasperWA/push-protected@v2 - with: - token: ${{ secrets.RELEASE_PAT }} - branch: ${{ env.DEPENDABOT_BRANCH }} - sleep: 15 - force: ${{ env.FORCE_PUSH }} - - deploy-docs: - name: Deploy `latest` documentation + updates-to-master: + name: External + uses: SINTEF/ci-cd/.github/workflows/ci_cd_updated_default_branch.yml@v1 if: github.repository_owner == 'emmo-repo' - runs-on: ubuntu-latest - - steps: - - name: Release check - run: | - COMMIT_MSG="$(gh api /repos/${{ github.repository}}/commits/${{ env.DEFAULT_REPO_BRANCH }} --jq '.commit.message')" - if [[ "${COMMIT_MSG}" =~ ^Release\ v.*$ ]]; then - echo "In a release - do not run this job !" - echo "RELEASE_RUN=true" >> $GITHUB_ENV - else - echo "Not a release - update docs" - echo "RELEASE_RUN=false" >> $GITHUB_ENV - fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Checkout repository - if: env.RELEASE_RUN == 'false' - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Python 3.7 - if: env.RELEASE_RUN == 'false' - uses: actions/setup-python@v4 - with: - python-version: 3.7 - - - name: Install dependencies - if: env.RELEASE_RUN == 'false' - run: | - python -m pip install --upgrade pip - pip install -U setuptools wheel - pip install -U -e .[docs] - - - name: Set up git user - if: env.RELEASE_RUN == 'false' - run: | - git config --global user.name "${{ env.GIT_USER_NAME }}" - git config --global user.email "${{ env.GIT_USER_EMAIL }}" - - - name: Check API Reference and landing page - if: env.RELEASE_RUN == 'false' - run: | - invoke create-api-reference-docs --pre-clean - invoke create-docs-index - - if [ -n "$(git status --porcelain docs/api_reference docs/index.md)" ]; then - echo -e "\u274c Discrepancies found !" - echo -e "The following files in the documentation must be committed:" - git status --porcelain docs/api_reference docs/index.md - echo -e "\nRun:\n" - echo " invoke create-api-reference-docs --pre-clean" - echo -e " invoke create-docs-index\n" - echo "And commit the changed files." - exit 1 - else - echo -e "\u2705 All good !" - fi - - - name: Deploy documentation - if: env.RELEASE_RUN == 'false' - run: mike deploy --push --remote origin --branch gh-pages --update-aliases --config-file mkdocs.yml latest ${{ env.DEFAULT_REPO_BRANCH }} + with: + git_username: EMMOntoPy Developers + git_email: "Team4.0@SINTEF.no" + permanent_dependencies_branch: ci/dependabot-updates + default_repo_branch: master + + # Update documentation + update_docs: true + update_python_api_ref: true + update_docs_landing_page: true + package_dir: ontopy + python_version: "3.7" + doc_extras: "[docs]" + landing_page_replacements: | + (LICENSE.txt),(LICENSE.md) + (tools),(../tools) + changelog_exclude_labels: dependencies + + test: true diff --git a/.github/workflows/ci_dependabot.yml b/.github/workflows/ci_dependabot.yml index f8285a34e..8c4b9d201 100644 --- a/.github/workflows/ci_dependabot.yml +++ b/.github/workflows/ci_dependabot.yml @@ -6,98 +6,23 @@ on: # Dependabot runs once a week (every Monday) (pip) # and every day (GH Actions) between 7:00 and 7:30 (5:00-5:30 UTC) - cron: "30 6 * * 3" + workflow_dispatch: jobs: create-collected-pr: - name: Single dependabot PR + name: External + uses: SINTEF/ci-cd/.github/workflows/ci_update_dependencies.yml@v1 if: github.repository_owner == 'emmo-repo' - runs-on: ubuntu-latest - env: - DEPENDABOT_BRANCH: ci/dependabot-updates - GIT_USER_NAME: EMMOntoPy Developers - GIT_USER_EMAIL: "Team4.0@SINTEF.no" - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - ref: master - - - name: Set up Python 3.8 - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - name: Install `pre-commit` and dependencies - run: | - python -m pip install -U pip - pip install -U setuptools wheel - - while IFS="" read -r line || [ -n "${line}" ]; do - if [[ "${line}" =~ ^pre-commit.*$ ]]; then - pre_commit="${line}" - fi - done < requirements_dev.txt - - while IFS="" read -r line || [ -n "${line}" ]; do - if [[ "${line}" =~ ^invoke.*$ ]]; then - invoke="${line}" - fi - done < requirements_docs.txt - - pip install ${pre_commit} ${invoke} - - - name: Set up git user info - run: | - git config --global user.name "${{ env.GIT_USER_NAME }}" - git config --global user.email "${{ env.GIT_USER_EMAIL }}" - - - name: Reset to '${{ env.DEPENDABOT_BRANCH }}' - run: | - git fetch origin ${{ env.DEPENDABOT_BRANCH }}:${{ env.DEPENDABOT_BRANCH }} - git reset --hard ${{ env.DEPENDABOT_BRANCH }} - - - name: Auto-update `pre-commit` hooks - run: | - pre-commit autoupdate - - if [ -n "$(git status --porcelain .pre-commit-config.yaml)" ]; then - # Set environment variable notifying next steps that the hooks changed - echo "Pre-commit hooks have been updated !" - echo "UPDATED_PRE_COMMIT_HOOKS=true" >> $GITHUB_ENV - else - echo "No pre-commit hooks have been updated." - echo "UPDATED_PRE_COMMIT_HOOKS=false" >> $GITHUB_ENV - fi - - - name: Possibly run `pre-commit` with updated hooks - if: env.UPDATED_PRE_COMMIT_HOOKS == 'true' - continue-on-error: true # Still create the PR if this step fails - run: SKIP=pylint pre-commit run --all-files - - - name: Possibly commit changes and updates - if: env.UPDATED_PRE_COMMIT_HOOKS == 'true' - run: git commit -am "Update \`pre-commit\` hooks" - - - name: Fetch PR body - id: pr_body - uses: chuhlomin/render-template@v1.5 - with: - template: .github/utils/single_dependency_pr_body.txt - - - name: Create PR - id: cpr - uses: peter-evans/create-pull-request@v4 - with: - token: ${{ secrets.RELEASE_PAT }} - commit-message: New @dependabot-fueled updates - committer: "${{ env.GIT_USER_NAME }} <${{ env.GIT_USER_EMAIL }}>" - author: "${{ env.GIT_USER_NAME }} <${{ env.GIT_USER_EMAIL }}>" - branch: ci/update-dependencies - delete-branch: true - title: "[Auto-generated] Update dependencies" - body: ${{ steps.pr_body.outputs.result }} - labels: dependencies,github_actions - - - name: Information - run: 'echo "${{ steps.cpr.outputs.pull-request-operation }} PR #${{ steps.cpr.outputs.pull-request-number }}: ${{ steps.cpr.outputs.pull-request-url }}"' + with: + git_username: EMMOntoPy Developers + git_email: "Team4.0@SINTEF.no" + permanent_dependencies_branch: ci/dependabot-updates + default_repo_branch: master + pr_labels: dependencies,github_actions + extra_to_dos: "- [ ] Make sure that the PR is **squash** merged, with a sensible commit message." + update_pre-commit: true + python_version: "3.8" + install_extras: "[dev,docs]" + skip_pre-commit_hooks: pylint + secrets: + PAT: ${{ secrets.RELEASE_PAT }} diff --git a/.github/workflows/ci_workflow.yml b/.github/workflows/ci_workflow.yml index 4df49d1cc..66910f8cc 100644 --- a/.github/workflows/ci_workflow.yml +++ b/.github/workflows/ci_workflow.yml @@ -8,6 +8,53 @@ on: - 'push-action/**' jobs: + tests: + name: External + uses: SINTEF/ci-cd/.github/workflows/ci_tests.yml@v1 + with: + # General + python_version: "3.7" + install_extras: "[dev,docs]" + + # pre-commit + # Run this test as an explicit job (see below), + # since a different Python version is used and necessary. + run_pre-commit: false + + # pylint + run_pylint: true + pylint_options: "--rcfile=pyproject.toml" + pylint_targets: "*.py tools emmopy ontopy" + + # safety + # Ignore ID 44715 for now. + # See this NumPy issue for more information: https://github.com/numpy/numpy/issues/19038 + # Also ignore IDs 44716 and 44717 as they are not deemed to be as severe as it is + # laid out in the CVE. + # Remove ignoring 48547 as soon as RDFLib/rdflib#1844 has been fixed and the fix + # has been released. + run_safety: true + safety_options: | + --ignore 44715 + --ignore 44716 + --ignore 44717 + --ignore 48547 + + # Build distribution + run_build_package: true + build_cmd: "python -m build" + + # Build documentation + run_build_docs: true + update_python_api_ref: true + update_docs_landing_page: true + package_dirs: | + emmopy + ontopy + landing_page_replacements: | + (LICENSE.txt),(LICENSE.md) + (tools),(../tools) + pre-commit: name: pre-commit @@ -42,44 +89,10 @@ jobs: pip install ${pre_commit} ${invoke} - name: Run pre-commit - run: SKIP=pylint pre-commit run --all-files --show-diff-on-failure - - - pylint-safety: - name: PyLint and safety - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Python 3.7 - uses: actions/setup-python@v4 - with: - python-version: 3.7 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -U setuptools wheel - - pip install -U -r requirements.txt -r requirements_dev.txt -r requirements_docs.txt - pip install safety - - - name: Run PyLint - run: pylint --rcfile=pyproject.toml *.py tools emmopy ontopy - - # Ignore ID 44715 for now. - # See this NumPy issue for more information: https://github.com/numpy/numpy/issues/19038 - # Also ignore IDs 44716 and 44717 as they are not deemed to be as severe as it is - # laid out in the CVE. - # Remove ignoring 48547 as soon as RDFLib/rdflib#1844 has been fixed and the fix - # has been released. - - name: Run safety - run: pip freeze | safety check --stdin -i 44715 -i 44716 -i 44717 -i 48547 + run: SKIP=pylint pre-commit run --all-files - tests: + pytest: name: pytest runs-on: ubuntu-latest @@ -223,58 +236,3 @@ jobs: mkdir -p /tmp/installation_dir cd /tmp/installation_dir pip install ${ORIGINAL_PWD}/${BDIST_DIR}/${{ env.BDIST_FILE }} - - documentation: - name: Check documentation - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Python 3.7 - uses: actions/setup-python@v4 - with: - python-version: 3.7 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -U setuptools wheel - pip install -U -e .[docs] - - - name: Set up git user - run: | - git config --global user.name "EMMOntoPy Developers" - git config --global user.email "Team4.0@SINTEF.no" - - - name: Check API Reference and landing page - run: | - invoke create-api-reference-docs --pre-clean - invoke create-docs-index - - if [ -n "$(git status --porcelain docs/api_reference docs/index.md)" ]; then - echo -e "\u274c Discrepancies found !" - echo -e "The following files in the documentation must be committed:" - git status --porcelain docs/api_reference docs/index.md - echo -e "\nRun:\n" - echo " invoke create-api-reference-docs --pre-clean" - echo -e " invoke create-docs-index\n" - echo "And commit the changed files." - exit 1 - else - echo -e "\u2705 All good !" - fi - - - name: Build check - run: | - mkdocs build 2>build_out.txt - WARNING_LINES=$( cat build_out.txt | grep WARNING | wc -l ) - if [ ${WARNING_LINES} != 1 ]; then - echo -e "FAIL !\n\n" - cat build_out.txt - exit 1 - else - echo -e "Only 1 warning - that's workable :)\n\n" - cat build_out.txt - fi diff --git a/docs/api_reference/emmopy/emmocheck.md b/docs/api_reference/emmopy/emmocheck.md index 17c16dc05..6c9000f96 100644 --- a/docs/api_reference/emmopy/emmocheck.md +++ b/docs/api_reference/emmopy/emmocheck.md @@ -1,5 +1,5 @@ # emmocheck ::: emmopy.emmocheck - rendering: + options: show_bases: false diff --git a/mkdocs.yml b/mkdocs.yml index ffee0b983..6c4f9c660 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -69,13 +69,10 @@ plugins: - "!^_" - "^__init__$" members: null - # inherited_members: false + inherited_members: false docstring_style: google - # docstring_options: - # replace_admonitions: true - # setup_commands: - # - import os - # - os.environ["MKDOCS_BUILD"] = "1" + docstring_options: + replace_admonitions: true watch: - emmopy - ontopy diff --git a/requirements_docs.txt b/requirements_docs.txt index 2101caeed..0d4860f6f 100644 --- a/requirements_docs.txt +++ b/requirements_docs.txt @@ -3,4 +3,4 @@ mike~=1.1 mkdocs~=1.4 mkdocs-awesome-pages-plugin~=2.8 mkdocs-material~=8.5 -mkdocstrings[python]~=0.19.0 +mkdocstrings[python-legacy]~=0.19.0 From 9063277062c6797ead005a9cebf488f63de20a9c Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Tue, 4 Oct 2022 17:21:58 +0200 Subject: [PATCH 03/23] Run pre-commit --- docs/api_reference/emmopy/emmocheck.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api_reference/emmopy/emmocheck.md b/docs/api_reference/emmopy/emmocheck.md index 6c9000f96..17c16dc05 100644 --- a/docs/api_reference/emmopy/emmocheck.md +++ b/docs/api_reference/emmopy/emmocheck.md @@ -1,5 +1,5 @@ # emmocheck ::: emmopy.emmocheck - options: + rendering: show_bases: false From 8d8b47bb2d682dff6cc2087e771598c68be2a978 Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Wed, 5 Oct 2022 17:11:33 +0200 Subject: [PATCH 04/23] Update test workflow Use more from SINTEF/ci-cd and also determine code coverage and upload it to codecov.io. Upload different coverages for each package. --- .github/workflows/ci_workflow.yml | 128 ++++++++---------------------- requirements_dev.txt | 1 + 2 files changed, 36 insertions(+), 93 deletions(-) diff --git a/.github/workflows/ci_workflow.yml b/.github/workflows/ci_workflow.yml index 66910f8cc..6ab5b78df 100644 --- a/.github/workflows/ci_workflow.yml +++ b/.github/workflows/ci_workflow.yml @@ -13,16 +13,16 @@ jobs: uses: SINTEF/ci-cd/.github/workflows/ci_tests.yml@v1 with: # General - python_version: "3.7" install_extras: "[dev,docs]" # pre-commit - # Run this test as an explicit job (see below), - # since a different Python version is used and necessary. - run_pre-commit: false + run_pre-commit: true + python_version_pre-commit: "3.8" + skip_pre-commit_hooks: pylint # pylint run_pylint: true + python_version_pylint_safety: "3.7" pylint_options: "--rcfile=pyproject.toml" pylint_targets: "*.py tools emmopy ontopy" @@ -42,68 +42,42 @@ jobs: # Build distribution run_build_package: true + python_version_package: "3.7" build_cmd: "python -m build" # Build documentation + # Exclude base classes in emmopy.emmocheck run_build_docs: true + python_version_docs: "3.7" update_python_api_ref: true update_docs_landing_page: true package_dirs: | emmopy ontopy + special_file_api_ref_options: "emmopy/emmocheck.py,show_bases: false" landing_page_replacements: | (LICENSE.txt),(LICENSE.md) (tools),(../tools) - pre-commit: - name: pre-commit - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Python 3.8 - uses: actions/setup-python@v4 - with: - python-version: "3.8" - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -U setuptools wheel - - while IFS="" read -r line || [ -n "${line}" ]; do - if [[ "${line}" =~ ^pre-commit.*$ ]]; then - pre_commit="${line}" - fi - done < requirements_dev.txt - - while IFS="" read -r line || [ -n "${line}" ]; do - if [[ "${line}" =~ ^invoke.*$ ]]; then - invoke="${line}" - fi - done < requirements_docs.txt - - pip install ${pre_commit} ${invoke} - - - name: Run pre-commit - run: SKIP=pylint pre-commit run --all-files - - pytest: name: pytest runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + # Currently supported versions according to setup.py + python-version: ["3.6", "3.7"] + steps: - name: Checkout repository uses: actions/checkout@v3 - - name: Set up Python 3.7 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: ${{ matrix.python-version }} - name: Install system dependencies run: sudo apt-get update && sudo apt-get install -y graphviz openjdk-11-jre-headless @@ -112,11 +86,27 @@ jobs: run: | python -m pip install --upgrade pip pip install -U setuptools wheel - pip install -U -e .[dev] - - name: Test with pytest - run: pytest + - name: Test (covering ontopy) + run: pytest -vvv --cov=ontopy --cov-report="xml:coverage_ontopy.xml" --cov-report=term + + - name: Test (covering emmopy) + run: pytest -vvv --cov=emmopy --cov-report="xml:coverage_emmopy.xml" --cov-report=term + + - name: Upload ontopy coverage to Codecov + if: matrix.python-version == '3.7' && github.repository == 'emmo-repo/EMMOntoPy' + uses: codecov/codecov-action@v3 + with: + flags: ontopy + files: coverage_ontopy.xml + + - name: Upload emmopy coverage to Codecov + if: matrix.python-version == '3.7' && github.repository == 'emmo-repo/EMMOntoPy' + uses: codecov/codecov-action@v3 + with: + flags: emmopy + files: coverage_emmopy.xml # - name: Run vertical demo # run: | @@ -188,51 +178,3 @@ jobs: # needs to be resolved if we decide to keep ontodoc as a tool. # python ../../tools/ontodoc -t emmo.md emmo-inferred emmo.pdf cd - - - - build_package: - name: Build Python package and install (integrity test) - runs-on: ubuntu-latest - env: - SDIST_DIR: sdist_action - BDIST_DIR: bdist_action - - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - - name: Set up Python 3.7 - uses: actions/setup-python@v4 - with: - python-version: 3.7 - - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - pip install -U setuptools wheel - pip install -r requirements.txt - - - name: Build source and built distributions - run: python setup.py sdist bdist_wheel - - - name: Check build and installation of PyPI source distribution - run: | - python setup.py -v sdist -d ${SDIST_DIR} bdist_wheel -d ${BDIST_DIR} - SDIST_FILE=$( ls ${SDIST_DIR}/ ) - echo "BDIST_FILE=$( ls ${BDIST_DIR}/ )" >> $GITHUB_ENV - ORIGINAL_PWD=$(pwd) - mkdir -p /tmp/installation_dir - cd /tmp/installation_dir - pip install ${ORIGINAL_PWD}/${SDIST_DIR}/${SDIST_FILE} - - - name: Remove installation again - run: pip uninstall -y EMMO - - - name: Install built distribution (wheel) - run: | - ORIGINAL_PWD=$(pwd) - - if [ "${ORIGINAL_PWD}" == "/tmp/installation_dir" ]; then echo "Wrong original dir: ${ORIGINAL_PWD}"; exit 1; fi - mkdir -p /tmp/installation_dir - cd /tmp/installation_dir - pip install ${ORIGINAL_PWD}/${BDIST_DIR}/${{ env.BDIST_FILE }} diff --git a/requirements_dev.txt b/requirements_dev.txt index 60232ff5c..0a0daa7c7 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,3 +1,4 @@ pre-commit~=2.20 pylint~=2.15 pytest~=7.1 +pytest-cov~=4.0 From 369f80b7b8433b6656fa0993c6097420df495fc3 Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Wed, 5 Oct 2022 17:19:01 +0200 Subject: [PATCH 05/23] Finalize workflow updates --- .github/workflows/cd_publish.yml | 8 +++++--- .github/workflows/ci_cd_updated_master.yml | 7 ++++--- .github/workflows/ci_workflow.yml | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cd_publish.yml b/.github/workflows/cd_publish.yml index 64e79dd5b..6491ad4d7 100644 --- a/.github/workflows/cd_publish.yml +++ b/.github/workflows/cd_publish.yml @@ -12,19 +12,21 @@ jobs: with: git_username: EMMOntoPy Developers git_email: "Team4.0@SINTEF.no" - python_version: "3.7" release_branch: master # Publish package python_package: true - # We're mentioning only 'ontopy', since the version is set only in ontopy/__init__.py - package_dir: ontopy + python_version_build: "3.7" + # We're mentioning only 'ontopy', since the version is set statically only in + # ontopy/__init__.py + package_dirs: ontopy install_extras: "[dev]" build_cmd: "python -m build" publish_on_pypi: true # Update documentation update_docs: true + python_version_docs: "3.7" doc_extras: "[docs]" changelog_exclude_labels: dependencies diff --git a/.github/workflows/ci_cd_updated_master.yml b/.github/workflows/ci_cd_updated_master.yml index 86fe4e5f4..812b92c27 100644 --- a/.github/workflows/ci_cd_updated_master.yml +++ b/.github/workflows/ci_cd_updated_master.yml @@ -19,12 +19,13 @@ jobs: update_docs: true update_python_api_ref: true update_docs_landing_page: true - package_dir: ontopy + package_dirs: | + emmopy + ontopy python_version: "3.7" doc_extras: "[docs]" + special_file_api_ref_options: "emmopy/emmocheck.py,show_bases: false" landing_page_replacements: | (LICENSE.txt),(LICENSE.md) (tools),(../tools) changelog_exclude_labels: dependencies - - test: true diff --git a/.github/workflows/ci_workflow.yml b/.github/workflows/ci_workflow.yml index 6ab5b78df..27c774176 100644 --- a/.github/workflows/ci_workflow.yml +++ b/.github/workflows/ci_workflow.yml @@ -134,7 +134,7 @@ jobs: - name: Set up Python 3.7 uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: "3.7" - name: Check Ubuntu version we are running under run: | From 634d73cee50bebf44a2d0f26f837a518e1b34686 Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Wed, 5 Oct 2022 17:20:00 +0200 Subject: [PATCH 06/23] Remove unused task 'setver' --- tasks.py | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/tasks.py b/tasks.py index 666fc569c..2ee9394ad 100644 --- a/tasks.py +++ b/tasks.py @@ -34,33 +34,6 @@ def update_file( handle.write("\n") -@task(help={"ver": "EMMOntoPy version to set"}) -def setver(_, ver=""): - """Sets the EMMOntoPy version.""" - match = re.fullmatch( - ( - r"v?(?P[0-9]+(\.[0-9]+){2}" # Major.Minor.Patch - r"(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?" # pre-release - r"(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?)" # build metadata - ), - ver, - ) - if not match: - sys.exit( - "Error: Please specify version as " - "'Major.Minor.Patch(-Pre-Release+Build Metadata)' or " - "'vMajor.Minor.Patch(-Pre-Release+Build Metadata)'" - ) - ver = match.group("version") - - update_file( - TOP_DIR / "ontopy" / "__init__.py", - (r"__version__ = ('|\").*('|\")", f'__version__ = "{ver}"'), - ) - - print(f"Bumped version to {ver}") - - @task( help={ "pre-clean": ( From d988da9f50f28b313130d1639e43b7cb7d7ce9e0 Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Thu, 6 Oct 2022 14:31:00 +0200 Subject: [PATCH 07/23] Use SINTEF/ci-cd pre-commit hooks --- .pre-commit-config.yaml | 38 +++++++++++-------- docs/api_reference/.pages | 1 - docs/api_reference/emmopy/.pages | 1 - docs/api_reference/emmopy/emmocheck.md | 2 +- docs/api_reference/ontopy/.pages | 1 - .../ontopy/factpluspluswrapper/.pages | 1 - mkdocs.yml | 10 ++--- 7 files changed, 29 insertions(+), 25 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1740ae0a7..8e0f950da 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,24 +35,32 @@ repos: # - id: mypy # exclude: ^tests/.*$ -- repo: local +- repo: https://github.com/SINTEF/ci-cd + rev: b648cea02c07ef2c2a81b60696c0e3eb283fa3d0 # frozen: v1 hooks: - - id: update-docs-api-reference - name: Update API Reference in Documentation - entry: invoke - args: [create-api-reference-docs, --pre-clean, --pre-commit] - language: python - pass_filenames: false + - id: docs-api-reference + args: + - --package-dir + - emmopy + - --package-dir + - ontopy + - --special-option + - "emmopy/emmocheck.py,show_bases: false" + - --unwanted-folder + - __pycache__ + - --unwanted-folder + - java files: ^(emmopy|ontopy)/.*\.py$ - description: Update the API Reference documentation, whenever a Python file is touched in the code base. - - id: update-docs-index - name: Update Landing Page for Documentation - entry: invoke - args: [create-docs-index] - language: python - pass_filenames: false + - id: docs-landing-page + args: + - --replacement + - (LICENSE.txt),(LICENSE.md) + - --replacement + - (tools),(../tools) files: ^README.md$ - description: Update the landing page for the documentation if the source file (README.md) is changed. + +- repo: local + hooks: - id: pylint name: pylint entry: pylint diff --git a/docs/api_reference/.pages b/docs/api_reference/.pages index a848e7c2f..9385270ba 100644 --- a/docs/api_reference/.pages +++ b/docs/api_reference/.pages @@ -1,2 +1 @@ title: "API Reference" -collapse_single_pages: false diff --git a/docs/api_reference/emmopy/.pages b/docs/api_reference/emmopy/.pages index 1f6fed708..3169cd7d4 100644 --- a/docs/api_reference/emmopy/.pages +++ b/docs/api_reference/emmopy/.pages @@ -1,2 +1 @@ title: "emmopy" -collapse_single_pages: false diff --git a/docs/api_reference/emmopy/emmocheck.md b/docs/api_reference/emmopy/emmocheck.md index 17c16dc05..6c9000f96 100644 --- a/docs/api_reference/emmopy/emmocheck.md +++ b/docs/api_reference/emmopy/emmocheck.md @@ -1,5 +1,5 @@ # emmocheck ::: emmopy.emmocheck - rendering: + options: show_bases: false diff --git a/docs/api_reference/ontopy/.pages b/docs/api_reference/ontopy/.pages index 01e236003..7e57e1f51 100644 --- a/docs/api_reference/ontopy/.pages +++ b/docs/api_reference/ontopy/.pages @@ -1,2 +1 @@ title: "ontopy" -collapse_single_pages: false diff --git a/docs/api_reference/ontopy/factpluspluswrapper/.pages b/docs/api_reference/ontopy/factpluspluswrapper/.pages index a117fa2ee..a90122175 100644 --- a/docs/api_reference/ontopy/factpluspluswrapper/.pages +++ b/docs/api_reference/ontopy/factpluspluswrapper/.pages @@ -1,2 +1 @@ title: "factpluspluswrapper" -collapse_single_pages: false diff --git a/mkdocs.yml b/mkdocs.yml index 6c4f9c660..3467e1a1b 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -73,11 +73,7 @@ plugins: docstring_style: google docstring_options: replace_admonitions: true - watch: - - emmopy - - ontopy - - awesome-pages: - collapse_single_pages: true + - awesome-pages nav: - Home: index.md @@ -90,3 +86,7 @@ nav: - ... | developers/** - Changelog: CHANGELOG.md - ... | api_reference/** + +watch: + - emmopy + - ontopy From d62f08072a3e13cd570e2845a54b572a0f3742ec Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Thu, 6 Oct 2022 14:32:44 +0200 Subject: [PATCH 08/23] Remove invoke tasks and dependency These tasks are replaced by SINTEF/ci-cd workflows and pre-commit hooks. --- requirements_docs.txt | 1 - tasks.py | 180 ------------------------------------------ 2 files changed, 181 deletions(-) delete mode 100644 tasks.py diff --git a/requirements_docs.txt b/requirements_docs.txt index 0d4860f6f..c1170b8fe 100644 --- a/requirements_docs.txt +++ b/requirements_docs.txt @@ -1,4 +1,3 @@ -invoke~=1.7 mike~=1.1 mkdocs~=1.4 mkdocs-awesome-pages-plugin~=2.8 diff --git a/tasks.py b/tasks.py deleted file mode 100644 index 2ee9394ad..000000000 --- a/tasks.py +++ /dev/null @@ -1,180 +0,0 @@ -"""Repository management tasks powered by `invoke`. - -More information on `invoke` can be found at http://www.pyinvoke.org/. -""" -# pylint: disable=import-outside-toplevel,too-many-locals -import re -import sys -from typing import TYPE_CHECKING -from pathlib import Path - -from invoke import task - -if TYPE_CHECKING: - from typing import Tuple - - from invoke import Context, Result - - -TOP_DIR = Path(__file__).parent.resolve() - - -def update_file( - filename: str, sub_line: "Tuple[str, str]", strip: str = None -) -> None: - """Utility function for tasks to read, update, and write files""" - with open(filename, "r") as handle: - lines = [ - re.sub(sub_line[0], sub_line[1], line.rstrip(strip)) - for line in handle - ] - - with open(filename, "w") as handle: - handle.write("\n".join(lines)) - handle.write("\n") - - -@task( - help={ - "pre-clean": ( - "Remove the 'api_reference' sub directory prior to (re)creation." - ) - } -) -def create_api_reference_docs( - context, pre_clean=False, pre_commit=False -): # pylint: disable=too-many-branches - """Create the API Reference in the documentation""" - import os - import shutil - - def write_file(full_path: Path, content: str) -> None: - """Write file with `content` to `full_path`""" - if full_path.exists(): - with open(full_path, "r") as handle: - cached_content = handle.read() - if content == cached_content: - del cached_content - return - del cached_content - with open(full_path, "w") as handle: - handle.write(content) - - package_dirs = (TOP_DIR / "emmopy", TOP_DIR / "ontopy") - docs_api_ref_dir = TOP_DIR / "docs" / "api_reference" - - unwanted_subdirs = ("__pycache__",) - unwanted_files = ("__init__.py",) - - pages_template = 'title: "{name}"\ncollapse_single_pages: false\n' - md_template = "# {name}\n\n::: {py_path}\n" - - if docs_api_ref_dir.exists() and pre_clean: - shutil.rmtree(docs_api_ref_dir, ignore_errors=True) - if docs_api_ref_dir.exists(): - sys.exit(f"{docs_api_ref_dir} should have been removed!") - docs_api_ref_dir.mkdir(exist_ok=True) - - write_file( - full_path=docs_api_ref_dir / ".pages", - content=pages_template.format(name="API Reference"), - ) - library_dir = TOP_DIR - - for package_dir in package_dirs: - for dirpath, dirnames, filenames in os.walk(package_dir): - for unwanted_dir in unwanted_subdirs: - if unwanted_dir in dirnames: - # Avoid walking into or through unwanted directories - dirnames.remove(unwanted_dir) - - relpath = Path(dirpath).relative_to(library_dir) - - if not (relpath / "__init__.py").exists(): - # Avoid paths that are not included in the public Python API - continue - - # Create `.pages` - docs_sub_dir = docs_api_ref_dir / relpath - docs_sub_dir.mkdir(exist_ok=True) - if str(relpath) != ".": - write_file( - full_path=docs_sub_dir / ".pages", - content=pages_template.format( - name=str(relpath).rsplit("/", maxsplit=1)[-1] - ), - ) - - # Create markdown files - for filename in filenames: - if ( - re.match(r".*\.py$", filename) is None - or filename in unwanted_files - ): - # Not a Python file: We don't care about it! - # Or filename is in the tuple of unwanted files: - # We don't want it! - continue - - basename = filename[: -len(".py")] - py_path = ( - f"{relpath}/{basename}".replace("/", ".") - if str(relpath) != "." - else f"{basename}".replace("/", ".") - ) - md_filename = filename.replace(".py", ".md") - - # For emmopy.emmocheck we want to exclude base clases - template = md_template - if str(relpath) == "emmopy" and basename == "emmocheck": - template += ( - f"{' ' * 4}rendering:\n{' ' * 6}show_bases: false\n" - ) - - write_file( - full_path=docs_sub_dir / md_filename, - content=template.format(name=basename, py_path=py_path), - ) - - if pre_commit: - # Check if there have been any changes. - # List changes if yes. - if TYPE_CHECKING: - context: "Context" = context - - # NOTE: grep returns an exit code of 1 if it doesn't find anything - # (which will be good in this case). - # Concerning the weird last grep command see: - # http://manpages.ubuntu.com/manpages/precise/en/man1/git-status.1.html - result: "Result" = context.run( - "git status --porcelain docs/api_reference | " - "grep -E '^[? MARC][?MD]' || exit 0", - hide=True, - ) - if result.stdout: - sys.exit( - "The following files have been changed/added, please stage " - f"them:\n\n{result.stdout}" - ) - - -@task -def create_docs_index(_): - """Create the documentation index page from README.md""" - readme = TOP_DIR / "README.md" - docs_index = TOP_DIR / "docs" / "index.md" - - with open(readme) as handle: - content = handle.read() - - replacement_mapping = [ - ("docs/", ""), - ("(LICENSE.txt)", "(LICENSE.md)"), - ("(tools)", "(../tools)"), - ] - - for old, new in replacement_mapping: - content = content.replace(old, new) - - with open(docs_index, "w") as handle: - handle.write(content) From a8bf25ac8b696451c01769a501a2948bd2ddb302 Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Thu, 6 Oct 2022 15:03:11 +0200 Subject: [PATCH 09/23] General documentation fixes Fixed the EMMC logo and link (from emmc.info to emmc.eu). Fixed indentation in release instructions. Fixed plugin settings for MkDocs. --- README.md | 4 ++-- docs/developers/release-instructions.md | 13 +++++++------ docs/images/emmc_logo.png | Bin 0 -> 5561 bytes docs/index.md | 4 ++-- mkdocs.yml | 4 +++- 5 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 docs/images/emmc_logo.png diff --git a/README.md b/README.md index 215dd96bb..72135a6b5 100644 --- a/README.md +++ b/README.md @@ -144,9 +144,9 @@ It has mainly been developed by [SINTEF](https://www.sintef.no/), specifically: ### Contributing projects -- [EMMC-CSA](https://emmc.info/about-emmc-csa/); +- [EMMC-CSA](https://emmc.eu/); Grant Agreement No: 723867 - + - [MarketPlace](https://www.the-marketplace-project.eu/); Grant Agreement No: 760173 diff --git a/docs/developers/release-instructions.md b/docs/developers/release-instructions.md index 9d8c7750f..c9f1b5e7c 100644 --- a/docs/developers/release-instructions.md +++ b/docs/developers/release-instructions.md @@ -2,15 +2,16 @@ 1. Create a release on GitHub with a short release description. - Ensure you add a `# ` title to the description. + Ensure you add a `# ` title to the description. + + Set the tag to the version number prefixed with `"v"` and title to the version number as explained above. - Set the tag to the version number prefixed with `"v"` and title to the version number as explained above. 1. Ensure the GitHub Action CD workflows run as expected. !!! danger "The workflow failed" - If something is wrong and the workflow fails **before** publishing the package to PyPI, make sure to remove all traces of the release and tag, fix the bug, and try again. + If something is wrong and the workflow fails **before** publishing the package to PyPI, make sure to remove all traces of the release and tag, fix the bug, and try again. - If something is wrong and the workflow fails **after** publishing the package to PyPI: **DO NOT REMOVE THE RELEASE OR TAG !** + If something is wrong and the workflow fails **after** publishing the package to PyPI: **DO NOT REMOVE THE RELEASE OR TAG !** - Deployment of the documentation should (in theory) be the only thing that has failed. - This can be deployed manually using similar steps as in the workflow. + Deployment of the documentation should (in theory) be the only thing that has failed. + This can be deployed manually using similar steps as in the workflow. diff --git a/docs/images/emmc_logo.png b/docs/images/emmc_logo.png new file mode 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wt~fUhr#9`eejx6FqU$!fp?fGw9D<-_gWvmx_!V^wfa71J%t-K^JI=oqt#!VQX;jV!vvOZqM>jCYK^=%$rlimSIawM4#MAtw;Inc zdg-v>3BXvb6BP5m{q|tkcWf4d^=Qtp_!|;*4nt6n4y~B6O$2DCm-qLA9n7HkRk`Ye zQSIbq6V=gRKj^S%4F=|I*1?R1{ojJ8BcpyBNoBtHIA);#cVIc4&LW|Cm&cNUoPTS~ zw?C!-xJI+QdHeI + - [MarketPlace](https://www.the-marketplace-project.eu/); Grant Agreement No: 760173 diff --git a/mkdocs.yml b/mkdocs.yml index 3467e1a1b..3f43803af 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -17,6 +17,7 @@ theme: features: - navigation.instant - navigation.top + - content.tabs.link repo_name: EMMOntoPy repo_url: https://github.com/emmo-repo/EMMOntoPy @@ -40,7 +41,8 @@ markdown_extensions: - pymdownx.highlight - pymdownx.superfences - pymdownx.inlinehilite - - pymdownx.tabbed + - pymdownx.tabbed: + alternate_style: true - pymdownx.caret - pymdownx.tilde - pymdownx.keys From be634b00d941501e72b59ab4c1e5ff4d02dbdb16 Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Thu, 6 Oct 2022 15:12:36 +0200 Subject: [PATCH 10/23] Remove example pages which are ontodoc templates --- mkdocs.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index 3f43803af..0d42163f2 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -84,7 +84,10 @@ nav: - License: LICENSE.md - Examples and demonstrations: - ... | demo/** - - ... | examples/** + - Examples: + - Generate documentation for EMMO: examples/emmodoc/README.md + - examples/emmodoc/important_concepts.md + - examples/emmodoc/introduction.md - ... | developers/** - Changelog: CHANGELOG.md - ... | api_reference/** From bbc0034ccfe70f35e32ee704ef4ea0acdd81d19e Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Thu, 6 Oct 2022 15:21:38 +0200 Subject: [PATCH 11/23] Update documentation ToC Extend copyright to 2022. --- LICENSE.txt | 2 +- mkdocs.yml | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 28550535c..2da9e5b92 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright 2019 SINTEF +Copyright 2019-2022 SINTEF Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are diff --git a/mkdocs.yml b/mkdocs.yml index 0d42163f2..93a8beb1d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,7 +1,7 @@ site_name: EMMOntoPy site_description: Documentation for the EMMOntoPy library site_url: https://emmo-repo.github.io/EMMOntoPy -copyright: Copyright © 2019-2021 SINTEF +copyright: Copyright © 2019-2022 SINTEF theme: name: material @@ -83,11 +83,13 @@ nav: - Docker: docker-instructions.md - License: LICENSE.md - Examples and demonstrations: - - ... | demo/** + - Demo: + - demo/README.md + - demo/horizontal/README.md + - demo/vertical/README.md - Examples: - - Generate documentation for EMMO: examples/emmodoc/README.md - - examples/emmodoc/important_concepts.md - - examples/emmodoc/introduction.md + - EMMOdoc: examples/emmodoc/README.md + - Jupyter visualization: examples/jupyter-visualization/README.md - ... | developers/** - Changelog: CHANGELOG.md - ... | api_reference/** From fff4a6a60335a615f931995b6e4a2d69656ebf4b Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Thu, 6 Oct 2022 15:46:23 +0200 Subject: [PATCH 12/23] Fix safety options --- .github/workflows/ci_workflow.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_workflow.yml b/.github/workflows/ci_workflow.yml index 27c774176..c9b2d26cd 100644 --- a/.github/workflows/ci_workflow.yml +++ b/.github/workflows/ci_workflow.yml @@ -35,10 +35,10 @@ jobs: # has been released. run_safety: true safety_options: | - --ignore 44715 - --ignore 44716 - --ignore 44717 - --ignore 48547 + --ignore=44715 + --ignore=44716 + --ignore=44717 + --ignore=48547 # Build distribution run_build_package: true From e78899c728095de91c30f0eab92429ab40634c6f Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Thu, 6 Oct 2022 16:14:08 +0200 Subject: [PATCH 13/23] Try to fix pytest CI runs Play around with the sys.path additions for tools. --- tests/tools/conftest.py | 5 +++-- tools/emmocheck | 7 +++++-- tools/ontodoc | 7 ++++--- tools/ontograph | 13 +++++++++---- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/tests/tools/conftest.py b/tests/tools/conftest.py index 5a3fc7c9c..ec4c79080 100644 --- a/tests/tools/conftest.py +++ b/tests/tools/conftest.py @@ -20,7 +20,8 @@ def tool(request: "Dict[str, Any]") -> "ModuleType": original_tool_path: Path = ( Path(__file__).resolve().parent.parent.parent / "tools" / request.param ) - sys.path.append(str(original_tool_path.parent.parent)) + if str(original_tool_path.parent) not in sys.path: + sys.path.append(str(original_tool_path.parent)) assert ( original_tool_path.exists() @@ -29,7 +30,7 @@ def tool(request: "Dict[str, Any]") -> "ModuleType": tool_path = original_tool_path.rename( original_tool_path.with_name(f"{request.param}.py") ) - yield importlib.import_module(f"tools.{request.param}") + yield importlib.import_module(request.param) finally: if tool_path and tool_path.exists(): tool_path.rename(tool_path.with_name(request.param)) diff --git a/tools/emmocheck b/tools/emmocheck index a390fa910..e7c5d161f 100755 --- a/tools/emmocheck +++ b/tools/emmocheck @@ -8,9 +8,12 @@ import os rootdir = os.path.abspath( os.path.realpath((os.path.dirname(os.path.dirname(__file__)))) ) -sys.path.insert(1, rootdir) +if rootdir not in sys.path: + sys.path.insert(1, rootdir) -from emmopy.emmocheck import main # pylint: disable=wrong-import-position +from emmopy.emmocheck import ( # pylint: disable=wrong-import-position,import-error + main, +) if __name__ == "__main__": diff --git a/tools/ontodoc b/tools/ontodoc index 9b325be6c..608e1aae4 100755 --- a/tools/ontodoc +++ b/tools/ontodoc @@ -10,10 +10,11 @@ import subprocess # nosec rootdir = os.path.abspath( os.path.realpath((os.path.dirname(os.path.dirname(__file__)))) ) -sys.path.insert(1, rootdir) +if rootdir not in sys.path: + sys.path.insert(1, rootdir) -from ontopy import World, onto_path -from ontopy.ontodoc import ( +from ontopy import World, onto_path # pylint: disable=import-error +from ontopy.ontodoc import ( # pylint: disable=import-error OntoDoc, get_format, get_style, diff --git a/tools/ontograph b/tools/ontograph index fd66e6c6f..acc185222 100755 --- a/tools/ontograph +++ b/tools/ontograph @@ -10,11 +10,16 @@ import json rootdir = os.path.abspath( os.path.realpath((os.path.dirname(os.path.dirname(__file__)))) ) -sys.path.insert(1, rootdir) +if rootdir not in sys.path: + sys.path.insert(1, rootdir) -from ontopy import World, onto_path -from ontopy.graph import OntoGraph, plot_modules, _default_style -from ontopy.utils import get_label +from ontopy import World, onto_path # pylint: disable=import-error +from ontopy.graph import ( # pylint: disable=import-error + OntoGraph, + plot_modules, + _default_style, +) +from ontopy.utils import get_label # pylint: disable=import-error import owlready2 From 5e8f6408165b28bc7958135e53f7b1e69597ac0d Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Thu, 6 Oct 2022 16:24:28 +0200 Subject: [PATCH 14/23] Update graphviz links in landing page/README --- README.md | 11 +++++------ docs/index.md | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 72135a6b5..d37018f8e 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,10 @@ + # EMMOntoPy *Python API for the Elemental Multiperspective Material Ontology ([EMMO]).* - - ![CI tests](https://github.com/emmo-repo/EMMOntoPy/workflows/CI%20Tests/badge.svg) [![PyPI version](https://badge.fury.io/py/EMMOntoPy.svg)](https://badge.fury.io/py/EMMOntoPy) @@ -103,7 +102,7 @@ pip install EMMOntoPy ### Optional Dependencies -- [Graphviz]: Needed for graph generation. +- [Graphviz][graphviz_website]: Needed for graph generation. With support for generation pdf, png and svg figures for tests and generation of documentation automatically (`ontodoc`). - [pandoc]: Only used for generated documentation from markdown to nicely formatted html or pdf. Tested with v2.1.2. @@ -114,7 +113,7 @@ pip install EMMOntoPy Needed for reasoning. - Optional Python packages: - - [graphviz]: Generation of documentation and graphs. + - [graphviz][graphviz_python]: Generation of documentation and graphs. - [PyYAML]: Required for generating documentation with pandoc. - [blessings]: Clean output for `emmocheck`. - [Pygments]: Coloured output for `emmocheck`. @@ -169,11 +168,11 @@ It has mainly been developed by [SINTEF](https://www.sintef.no/), specifically: [IPython]: https://ipython.org/ [DLite]: https://github.com/SINTEF/dlite/ [pydot]: https://pypi.org/project/pydot/ -[Graphviz]: https://www.graphviz.org/ +[graphviz_website]: https://www.graphviz.org/ [pandoc]: http://pandoc.org/ [XeLaTeX]: https://www.overleaf.com/learn/latex/XeLaTeX/ [pdfLaTeX]: https://www.latex-project.org/ -[graphviz]: https://pypi.org/project/graphviz +[graphviz_python]: https://pypi.org/project/graphviz [PyYAML]: https://pypi.org/project/PyYAML/ [blessings]: https://pypi.org/project/blessings/ [Pygments]: https://pypi.org/project/Pygments/ diff --git a/docs/index.md b/docs/index.md index ee7f1b4e2..5ffd010c1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,11 +1,10 @@ + # EMMOntoPy *Python API for the Elemental Multiperspective Material Ontology ([EMMO]).* - - ![CI tests](https://github.com/emmo-repo/EMMOntoPy/workflows/CI%20Tests/badge.svg) [![PyPI version](https://badge.fury.io/py/EMMOntoPy.svg)](https://badge.fury.io/py/EMMOntoPy) @@ -103,7 +102,7 @@ pip install EMMOntoPy ### Optional Dependencies -- [Graphviz]: Needed for graph generation. +- [Graphviz][graphviz_website]: Needed for graph generation. With support for generation pdf, png and svg figures for tests and generation of documentation automatically (`ontodoc`). - [pandoc]: Only used for generated documentation from markdown to nicely formatted html or pdf. Tested with v2.1.2. @@ -114,7 +113,7 @@ pip install EMMOntoPy Needed for reasoning. - Optional Python packages: - - [graphviz]: Generation of documentation and graphs. + - [graphviz][graphviz_python]: Generation of documentation and graphs. - [PyYAML]: Required for generating documentation with pandoc. - [blessings]: Clean output for `emmocheck`. - [Pygments]: Coloured output for `emmocheck`. @@ -169,11 +168,11 @@ It has mainly been developed by [SINTEF](https://www.sintef.no/), specifically: [IPython]: https://ipython.org/ [DLite]: https://github.com/SINTEF/dlite/ [pydot]: https://pypi.org/project/pydot/ -[Graphviz]: https://www.graphviz.org/ +[graphviz_website]: https://www.graphviz.org/ [pandoc]: http://pandoc.org/ [XeLaTeX]: https://www.overleaf.com/learn/latex/XeLaTeX/ [pdfLaTeX]: https://www.latex-project.org/ -[graphviz]: https://pypi.org/project/graphviz +[graphviz_python]: https://pypi.org/project/graphviz [PyYAML]: https://pypi.org/project/PyYAML/ [blessings]: https://pypi.org/project/blessings/ [Pygments]: https://pypi.org/project/Pygments/ From 03f62bf9dcc0be2e80a0e640b638a65f1f9b6b1d Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Thu, 6 Oct 2022 16:35:40 +0200 Subject: [PATCH 15/23] Only run pytest once in CI --- .github/workflows/ci_workflow.yml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci_workflow.yml b/.github/workflows/ci_workflow.yml index c9b2d26cd..ecee54a0d 100644 --- a/.github/workflows/ci_workflow.yml +++ b/.github/workflows/ci_workflow.yml @@ -88,25 +88,28 @@ jobs: pip install -U setuptools wheel pip install -U -e .[dev] - - name: Test (covering ontopy) - run: pytest -vvv --cov=ontopy --cov-report="xml:coverage_ontopy.xml" --cov-report=term + - name: Test + run: pytest -vvv --cov=ontopy --cov=emmopy --cov-report=xml --cov-report=term - - name: Test (covering emmopy) - run: pytest -vvv --cov=emmopy --cov-report="xml:coverage_emmopy.xml" --cov-report=term + # - name: Test (covering ontopy) + # run: pytest -vvv --cov=ontopy --cov-report="xml:coverage_ontopy.xml" --cov-report=term - - name: Upload ontopy coverage to Codecov - if: matrix.python-version == '3.7' && github.repository == 'emmo-repo/EMMOntoPy' - uses: codecov/codecov-action@v3 - with: - flags: ontopy - files: coverage_ontopy.xml + # - name: Test (covering emmopy) + # run: pytest -vvv --cov=emmopy --cov-report="xml:coverage_emmopy.xml" --cov-report=term - - name: Upload emmopy coverage to Codecov + - name: Upload ontopy coverage to Codecov if: matrix.python-version == '3.7' && github.repository == 'emmo-repo/EMMOntoPy' uses: codecov/codecov-action@v3 - with: - flags: emmopy - files: coverage_emmopy.xml + # with: + # flags: ontopy + # files: coverage_ontopy.xml + + # - name: Upload emmopy coverage to Codecov + # if: matrix.python-version == '3.7' && github.repository == 'emmo-repo/EMMOntoPy' + # uses: codecov/codecov-action@v3 + # with: + # flags: emmopy + # files: coverage_emmopy.xml # - name: Run vertical demo # run: | From fb9e31f822ac5d77f97bb2672e489fe76900c80e Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Thu, 6 Oct 2022 16:39:20 +0200 Subject: [PATCH 16/23] Remove comments in CI workflow --- .github/workflows/ci_workflow.yml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/workflows/ci_workflow.yml b/.github/workflows/ci_workflow.yml index ecee54a0d..3dfe880db 100644 --- a/.github/workflows/ci_workflow.yml +++ b/.github/workflows/ci_workflow.yml @@ -91,25 +91,9 @@ jobs: - name: Test run: pytest -vvv --cov=ontopy --cov=emmopy --cov-report=xml --cov-report=term - # - name: Test (covering ontopy) - # run: pytest -vvv --cov=ontopy --cov-report="xml:coverage_ontopy.xml" --cov-report=term - - # - name: Test (covering emmopy) - # run: pytest -vvv --cov=emmopy --cov-report="xml:coverage_emmopy.xml" --cov-report=term - - - name: Upload ontopy coverage to Codecov + - name: Upload coverage to Codecov if: matrix.python-version == '3.7' && github.repository == 'emmo-repo/EMMOntoPy' uses: codecov/codecov-action@v3 - # with: - # flags: ontopy - # files: coverage_ontopy.xml - - # - name: Upload emmopy coverage to Codecov - # if: matrix.python-version == '3.7' && github.repository == 'emmo-repo/EMMOntoPy' - # uses: codecov/codecov-action@v3 - # with: - # flags: emmopy - # files: coverage_emmopy.xml # - name: Run vertical demo # run: | From 0b6c95d08747f3b1df323560100f159c62a0a350 Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Thu, 6 Oct 2022 16:40:14 +0200 Subject: [PATCH 17/23] Try using minimum pandas v1.1 for Py3.6 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 6606a12dd..c9c4c10ba 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ numpy>=1.19.5,<2 openpyxl>=3.0.9,<3.1 Owlready2>=0.28,!=0.32,!=0.34,<0.39 packaging>=21.0<22 -pandas>=1.2,<1.6 +pandas>=1.1,<1.6 Pygments>=2.7.4,<3 pyparsing>=2.4.7 PyYAML>=5.4.1,<7 From 0b49cad1c1a10344d1bcd886581d6c4074ed1a9a Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Thu, 6 Oct 2022 16:42:25 +0200 Subject: [PATCH 18/23] Use latest Python3.6-supporting pytest --- requirements_dev.txt | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index 0a0daa7c7..9c1ef34aa 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,4 +1,4 @@ pre-commit~=2.20 pylint~=2.15 -pytest~=7.1 +pytest~=7.0 pytest-cov~=4.0 diff --git a/setup.py b/setup.py index 858f091f0..ab9c75aff 100644 --- a/setup.py +++ b/setup.py @@ -82,7 +82,7 @@ def fglob(patt): long_description_content_type="text/markdown", url="https://github.com/emmo-repo/EMMOntoPy", license="BSD", - python_requires=">=3.6.0", + python_requires=">=3.6", classifiers=[ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", From 4d11a6e045f66c8b6a17f01e94aa37af50e6c035 Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Thu, 6 Oct 2022 16:51:41 +0200 Subject: [PATCH 19/23] Update dependencies to minimum Python3.6.15 versions --- requirements_dev.txt | 4 ++-- requirements_docs.txt | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index 9c1ef34aa..e22aa2dd6 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,4 +1,4 @@ -pre-commit~=2.20 -pylint~=2.15 +pre-commit~=2.17 +pylint~=2.13 pytest~=7.0 pytest-cov~=4.0 diff --git a/requirements_docs.txt b/requirements_docs.txt index c1170b8fe..3daa0cd2d 100644 --- a/requirements_docs.txt +++ b/requirements_docs.txt @@ -1,5 +1,5 @@ mike~=1.1 -mkdocs~=1.4 +mkdocs~=1.3 mkdocs-awesome-pages-plugin~=2.8 -mkdocs-material~=8.5 -mkdocstrings[python-legacy]~=0.19.0 +mkdocs-material~=8.2 +mkdocstrings[python-legacy]~=0.17 From b4e908d6ea2b59f7fb9682c18e49ceee3b515944 Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Thu, 6 Oct 2022 16:58:03 +0200 Subject: [PATCH 20/23] Include xlrd dependency for Python 3.6 --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index c9c4c10ba..b7277752d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,3 +12,4 @@ pyparsing>=2.4.7 PyYAML>=5.4.1,<7 rdflib>=4.2.1,<7 semver>=2.8.1,<3 +xlrd>=1.0.0 ; python_version<"3.7" From af366263a5f645f42a856b1e7e95db2c06a21b62 Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Mon, 10 Oct 2022 11:26:43 +0200 Subject: [PATCH 21/23] Better readability in the pre-commit config --- .pre-commit-config.yaml | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8e0f950da..20702edf8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,23 +40,16 @@ repos: hooks: - id: docs-api-reference args: - - --package-dir - - emmopy - - --package-dir - - ontopy - - --special-option - - "emmopy/emmocheck.py,show_bases: false" - - --unwanted-folder - - __pycache__ - - --unwanted-folder - - java + - --package-dir=emmopy + - --package-dir=ontopy + - "--special-option=emmopy/emmocheck.py,show_bases: false" + - --unwanted-folder=__pycache__ + - --unwanted-folder=java files: ^(emmopy|ontopy)/.*\.py$ - id: docs-landing-page args: - - --replacement - - (LICENSE.txt),(LICENSE.md) - - --replacement - - (tools),(../tools) + - --replacement=(LICENSE.txt),(LICENSE.md) + - --replacement=(tools),(../tools) files: ^README.md$ - repo: local From 8c2983ce5f5691f2c1f7bc7a79de4b93cf228b6a Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Mon, 10 Oct 2022 11:27:07 +0200 Subject: [PATCH 22/23] Update EMMC-CSA description in README Co-authored-by: Francesca L. Bleken --- README.md | 4 +++- docs/index.md | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d37018f8e..a8be6efb8 100644 --- a/README.md +++ b/README.md @@ -143,9 +143,11 @@ It has mainly been developed by [SINTEF](https://www.sintef.no/), specifically: ### Contributing projects -- [EMMC-CSA](https://emmc.eu/); +- EMMC-CSA; Grant Agreement No: 723867 + + The [EMMC-ASBL organization](https://emmc.eu/emmc-members/mission/) takes on the efforts of continuing and expanding on the efforts of the CSA. - [MarketPlace](https://www.the-marketplace-project.eu/); Grant Agreement No: 760173 diff --git a/docs/index.md b/docs/index.md index 5ffd010c1..92178f9ec 100644 --- a/docs/index.md +++ b/docs/index.md @@ -143,9 +143,11 @@ It has mainly been developed by [SINTEF](https://www.sintef.no/), specifically: ### Contributing projects -- [EMMC-CSA](https://emmc.eu/); +- EMMC-CSA; Grant Agreement No: 723867 + + The [EMMC-ASBL organization](https://emmc.eu/emmc-members/mission/) takes on the efforts of continuing and expanding on the efforts of the CSA. - [MarketPlace](https://www.the-marketplace-project.eu/); Grant Agreement No: 760173 From 7ee8ce2022a917f4a9f6683b28be5ae4ea8cb56c Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen Date: Mon, 10 Oct 2022 11:54:02 +0200 Subject: [PATCH 23/23] Remove Python 3.6 support Extend testing with Python 3.8-3.10. Add explicit support for Python3.8-3.10 in setup.py (package) metadata. --- .github/workflows/ci_workflow.yml | 3 +-- README.md | 2 +- docs/developers/setup.md | 2 +- docs/index.md | 2 +- emmopy/__init__.py | 4 ++-- ontopy/__init__.py | 4 ++-- requirements.txt | 3 +-- requirements_dev.txt | 6 +++--- requirements_docs.txt | 6 +++--- setup.py | 6 ++++-- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci_workflow.yml b/.github/workflows/ci_workflow.yml index 3dfe880db..48688f76a 100644 --- a/.github/workflows/ci_workflow.yml +++ b/.github/workflows/ci_workflow.yml @@ -67,8 +67,7 @@ jobs: strategy: fail-fast: false matrix: - # Currently supported versions according to setup.py - python-version: ["3.6", "3.7"] + python-version: ["3.7", "3.8", "3.9", "3.10"] steps: - name: Checkout repository diff --git a/README.md b/README.md index a8be6efb8..f66709aa0 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ pip install EMMOntoPy ### Required Dependencies -- [Python] 3.6 or later. +- [Python] 3.7 or later. - [Owlready2] v0.23 or later. ### Optional Dependencies diff --git a/docs/developers/setup.md b/docs/developers/setup.md index 7106a8b7b..3bf84a7df 100644 --- a/docs/developers/setup.md +++ b/docs/developers/setup.md @@ -7,7 +7,7 @@ This section outlines some suggestions as well as conventions used by the EMMOnt ## Setup !!! important "Requirements" - This section expects you to be running on a Unix-like system (e.g., Linux) with *minimum* Python 3.6. + This section expects you to be running on a Unix-like system (e.g., Linux) with *minimum* Python 3.7. ### Virtual environment diff --git a/docs/index.md b/docs/index.md index 92178f9ec..d6f5b8c42 100644 --- a/docs/index.md +++ b/docs/index.md @@ -97,7 +97,7 @@ pip install EMMOntoPy ### Required Dependencies -- [Python] 3.6 or later. +- [Python] 3.7 or later. - [Owlready2] v0.23 or later. ### Optional Dependencies diff --git a/emmopy/__init__.py b/emmopy/__init__.py index a2e8df3f9..fa7822cb0 100644 --- a/emmopy/__init__.py +++ b/emmopy/__init__.py @@ -6,8 +6,8 @@ __version__ = __ontopy_version__ # Ensure correct Python version -if sys.version_info < (3, 6): - raise RuntimeError("emmopy requires Python 3.6 or later") +if sys.version_info < (3, 7): + raise RuntimeError("emmopy requires Python 3.7 or later") # Ensure emmopy is imported before owlready2... if "owlready2" in sys.modules and "emmopy" not in sys.modules: diff --git a/ontopy/__init__.py b/ontopy/__init__.py index 50b7cf870..b269a6411 100644 --- a/ontopy/__init__.py +++ b/ontopy/__init__.py @@ -5,8 +5,8 @@ __version__ = "0.4.0" # Ensure correct Python version -if sys.version_info < (3, 6): - raise RuntimeError("ontopy requires Python 3.6 or later") +if sys.version_info < (3, 7): + raise RuntimeError("ontopy requires Python 3.7 or later") # Ensure ontopy is imported before owlready2... if "owlready2" in sys.modules and "ontopy" not in sys.modules: diff --git a/requirements.txt b/requirements.txt index b7277752d..6606a12dd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,10 +6,9 @@ numpy>=1.19.5,<2 openpyxl>=3.0.9,<3.1 Owlready2>=0.28,!=0.32,!=0.34,<0.39 packaging>=21.0<22 -pandas>=1.1,<1.6 +pandas>=1.2,<1.6 Pygments>=2.7.4,<3 pyparsing>=2.4.7 PyYAML>=5.4.1,<7 rdflib>=4.2.1,<7 semver>=2.8.1,<3 -xlrd>=1.0.0 ; python_version<"3.7" diff --git a/requirements_dev.txt b/requirements_dev.txt index e22aa2dd6..0a0daa7c7 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,4 +1,4 @@ -pre-commit~=2.17 -pylint~=2.13 -pytest~=7.0 +pre-commit~=2.20 +pylint~=2.15 +pytest~=7.1 pytest-cov~=4.0 diff --git a/requirements_docs.txt b/requirements_docs.txt index 3daa0cd2d..c1170b8fe 100644 --- a/requirements_docs.txt +++ b/requirements_docs.txt @@ -1,5 +1,5 @@ mike~=1.1 -mkdocs~=1.3 +mkdocs~=1.4 mkdocs-awesome-pages-plugin~=2.8 -mkdocs-material~=8.2 -mkdocstrings[python-legacy]~=0.17 +mkdocs-material~=8.5 +mkdocstrings[python-legacy]~=0.19.0 diff --git a/setup.py b/setup.py index ab9c75aff..b2d024b46 100644 --- a/setup.py +++ b/setup.py @@ -82,7 +82,7 @@ def fglob(patt): long_description_content_type="text/markdown", url="https://github.com/emmo-repo/EMMOntoPy", license="BSD", - python_requires=">=3.6", + python_requires=">=3.7", classifiers=[ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", @@ -91,8 +91,10 @@ def fglob(patt): "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Information Analysis", "Topic :: Scientific/Engineering :: Visualization",