From 8e76643e6da423d544278b1f0ef32021b6eec4d7 Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Wed, 15 Mar 2023 13:18:55 -0700 Subject: [PATCH 1/6] updated sqlite-historian index.rst --- docs/source/index.rst | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index 4ff19a6..15ea446 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,22 +1,27 @@ -Welcome to VOLTTRON Sqlite Historian's documentation! -=================================== +SQLite Historian +================ -**VOLTTRON Sqlite Historian** is ... +This is a VOLTTRON historian agent that stores its data in a sqlite database. It depends on +`volttron-lib-sql-historian `_ and extends the class +`SQLHistorian `_ -Check out the :doc:`usage` section for further information, including -how to :ref:`installation` the project. +Configuration +------------- -.. note:: +The following is a minimal configuration file that uses a relative path to the database. - This project is under active development. +:: -Contents --------- + { + "connection": { + "type": "sqlite", + "params": { + "database": "data/historian.sqlite" + } + } +} -.. toctree:: +All the above parameters are mandatory. - usage - agent - quick-start - fail-url-test-on-purpose +TODO- update SQLHistorian rst, link to that From fe4a546474eb481dc1f361add1657626baf0a82f Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Thu, 16 Mar 2023 14:16:43 -0700 Subject: [PATCH 2/6] minor fix --- docs/source/index.rst | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index 15ea446..d9b8301 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -3,7 +3,7 @@ SQLite Historian This is a VOLTTRON historian agent that stores its data in a sqlite database. It depends on `volttron-lib-sql-historian `_ and extends the class -`SQLHistorian `_ +`SQLHistorian `_ Configuration ------------- @@ -23,5 +23,12 @@ The following is a minimal configuration file that uses a relative path to the d All the above parameters are mandatory. -TODO- update SQLHistorian rst, link to that +Optional Configuration +---------------------- + +In addition to the above configuration, SQLite Historian can be configured using all the available configurations +exposed by the SQLHistorian and BaseHistorian. Please refer to +:ref:`SQL Historian Configurations ` and +:ref:`Base Historian Configurations ` + From 229aee9090c6a7b186c6ae247ed7fba232393eed Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Thu, 16 Mar 2023 14:22:00 -0700 Subject: [PATCH 3/6] minor fix --- docs/source/index.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index d9b8301..2090d43 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -26,9 +26,9 @@ All the above parameters are mandatory. Optional Configuration ---------------------- -In addition to the above configuration, SQLite Historian can be configured using all the available configurations -exposed by the SQLHistorian and BaseHistorian. Please refer to -:ref:`SQL Historian Configurations ` and -:ref:`Base Historian Configurations ` +In addition to the above configuration, SQLite Historian can optionally be configured using all the available +configurations exposed by the SQLHistorian and BaseHistorian. Please refer to +:ref:`SQL Historian ` and :ref:`Base Historian Configurations ` +for more details From c8fadc04070b0b96c1666eadd8ffd5e547ea5dc7 Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Wed, 10 May 2023 15:05:31 -0700 Subject: [PATCH 4/6] updated workflows and version of python and ubuntu --- .github/workflows/dispatch-to-pypi.yml | 39 -------- .../workflows/downstream-test-response.yml | 24 ----- .github/workflows/make-release.yml | 59 +++++++++++++ .github/workflows/publish-to-pypi.yml | 40 --------- .github/workflows/run-downstream-tests.yml | 88 ------------------- .github/workflows/run-tests.yml | 35 ++++---- README.md | 6 +- pyproject.toml | 37 ++++---- 8 files changed, 94 insertions(+), 234 deletions(-) delete mode 100644 .github/workflows/dispatch-to-pypi.yml delete mode 100644 .github/workflows/downstream-test-response.yml create mode 100644 .github/workflows/make-release.yml delete mode 100644 .github/workflows/publish-to-pypi.yml delete mode 100644 .github/workflows/run-downstream-tests.yml diff --git a/.github/workflows/dispatch-to-pypi.yml b/.github/workflows/dispatch-to-pypi.yml deleted file mode 100644 index b114704..0000000 --- a/.github/workflows/dispatch-to-pypi.yml +++ /dev/null @@ -1,39 +0,0 @@ ---- -# Documentation located -# https://github.com/marketplace/actions/publish-python-poetry-package -name: Dispatch to PyPi - -on: - workflow_dispatch: - -defaults: - run: - shell: bash - -env: - LANG: en_US.utf-8 - LC_ALL: en_US.utf-8 - PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} - -jobs: - - publish_to_pypi: - - runs-on: ubuntu-22.04 - - steps: - - 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 hosted by GitHub!" - - run: echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.7 - with: - # These are only needed when using test.pypi - #repository_name: testpypi - #repository_url: https://test.pypi.org/legacy/ - pypi_token: ${{ secrets.PYPI_TOKEN }} - ignore_dev_requirements: "yes" \ No newline at end of file diff --git a/.github/workflows/downstream-test-response.yml b/.github/workflows/downstream-test-response.yml deleted file mode 100644 index 279376f..0000000 --- a/.github/workflows/downstream-test-response.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Respond to downstream test runs as part of downstream testing - - -on: - repository_dispatch: - # To add more test responses from volttron modular repos, - # put the name of the event type in the list below. - # The name of the event type should come from Workflow - # that is triggering this workflow. - # For example, 'VOLTTRON/volttron-listener-agent` repo has a workflow - # called downstream-testing-dispatch.yml that will send a repository - # dispatch to this repo using with an event type called "listener-downstream-testing-response" - types: [sqlite-downstream-testing-response] - -jobs: - test-response: - runs-on: ubuntu-22.04 - - steps: - - name: Repository Dispatch Triggered - run: | - echo "πŸŽ‰ The job was automatically triggered by a ${{ github.event_name }} event." - echo "Event '${{ github.event.action }}' received from '${{ github.event.client_payload.repository }}'" - echo "Payload from downstream workflow: '${{ toJson(github.event.client_payload) }}'" \ No newline at end of file diff --git a/.github/workflows/make-release.yml b/.github/workflows/make-release.yml new file mode 100644 index 0000000..4449eb1 --- /dev/null +++ b/.github/workflows/make-release.yml @@ -0,0 +1,59 @@ +name: Make full release + +on: + workflow_dispatch: + inputs: + publish-to-test-pypi: + description: 'Publish to test pypi instead of pypi' + required: false + default: false + type: boolean + bump-rule: + description: 'Rule for computing next release version' + required: false + default: 'prerelease' + type: choice + options: + - patch + - minor + - major + - prepatch + - preminor + - premajor + - prerelease + release-version: + description: 'Version number to use(instead of computing). Should be of the format x.y.z[rcn]. Do not use hyphens.' + required: false + default: '' + type: string + merge-strategy: + description: 'Merge strategy and strategy options. Used only in case of merge conflicts' + required: false + default: '' + type: string + +defaults: + run: + shell: bash + +env: + LANG: en_US.utf-8 + LC_ALL: en_US.utf-8 + PYTHON_VERSION: '3.10' + +jobs: + call-deploy-release: + permissions: + contents: write # To push a branch + pull-requests: write # To create a PR from that branch + + uses: eclipse-volttron/github-tooling/.github/workflows/deploy-release.yml@main + with: + merge-strategy: ${{ inputs.merge-strategy }} + release-version: ${{ inputs.release-version }} + bump-rule: ${{ inputs.bump-rule }} + run-tests-wait: 600 + publish-to-test-pypi: false + secrets: + git-token: ${{ secrets.AUTO_PROJECT_PAT }} + pypi-token: ${{ secrets.PYPI_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml deleted file mode 100644 index b378626..0000000 --- a/.github/workflows/publish-to-pypi.yml +++ /dev/null @@ -1,40 +0,0 @@ ---- -# Documentation located -# https://github.com/marketplace/actions/publish-python-poetry-package -name: Publish to PyPi - -on: - release: - types: [published] - -defaults: - run: - shell: bash - -env: - LANG: en_US.utf-8 - LC_ALL: en_US.utf-8 - PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} - -jobs: - - publish_to_pypi: - - runs-on: ubuntu-22.04 - - steps: - - 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 hosted by GitHub!" - - run: echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.7 - with: - # These are only needed when using test.pypi - #repository_name: testpypi - #repository_url: https://test.pypi.org/legacy/ - pypi_token: ${{ secrets.PYPI_TOKEN }} - ignore_dev_requirements: "yes" diff --git a/.github/workflows/run-downstream-tests.yml b/.github/workflows/run-downstream-tests.yml deleted file mode 100644 index dddaa2f..0000000 --- a/.github/workflows/run-downstream-tests.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: Start downstream tests - -on: - push: - branches: - - main - pull_request: - branches: - - develop - -env: - LANG: en_US.utf-8 - LC_ALL: en_US.utf-8 - PYTHON_VERSION: '3.10' - EVENT_TYPE: downstream-testing - -jobs: - initiate_downstream_testing: - strategy: - matrix: - # To add more Volttron modular repos that need to be tested against a version of volttron-core, - # add the name of repo to the list below. - # The name of the repo takes the following form: / - # For example, to add the OpenADR agent repo, use the following name: - # VOLTTRON/volttron-openadr-ven - repo: [ eclipse-volttron/volttron-sqlite-historian ] - # , 'VOLTTRON/volttron-openadr-ven' ] - - runs-on: ubuntu-22.04 - - steps: - - run: env - - 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 hosted by GitHub!" - - run: echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - - #---------------------------------------------- - # check-out repo and set-up python - #---------------------------------------------- - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Set up Python ${{ env.PYTHON_VERSION }} - id: setup-python - uses: actions/setup-python@v2 - with: - python-version: ${{ env.PYTHON_VERSION }} - - #---------------------------------------------- - # ----- install & configure poetry ----- - #---------------------------------------------- - - name: Install Poetry - uses: snok/install-poetry@v1 - with: - virtualenvs-create: true - virtualenvs-in-project: true - installer-parallel: true - - #---------------------------------------------- - # install your root project, if required - #---------------------------------------------- - - name: Install library - run: poetry install --no-interaction - - - name: Create build artifacts - run: | - poetry build -vvv - - - name: Check if wheels were built - run: | - ls -lh dist - - - name: Upload wheels as artifact - uses: actions/upload-artifact@v2 - with: - name: dist - path: dist - - - run: echo "Workflow run_id ${{ github.run_id }}" - - - name: Repository Dispatch - uses: peter-evans/repository-dispatch@v1.1.3 - with: - token: ${{ secrets.ACTION_HOOK_TOKEN }} - repository: ${{ matrix.repo }} - event-type: ${{ env.EVENT_TYPE }} - client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "repository": "${{ github.repository }}", "api_url": "${{ github.api_url }}", "run_id": "${{ github.run_id }}" }' \ No newline at end of file diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 0622890..2187c2d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -14,6 +14,9 @@ on: - reopened paths: - '**.py' + - '**.yaml' + - '**.yml' + - '**.toml' defaults: run: @@ -23,15 +26,15 @@ env: LANG: en_US.utf-8 LC_ALL: en_US.utf-8 PYTHON_VERSION: '3.10' - PROJECT_NAME: volttron-lib-base-historian + PROJECT_NAME: volttron-sqlite-historian jobs: run-tests: strategy: matrix: - os: ["ubuntu-20.04", "ubuntu-22.04"] - python: ["3.8", "3.9", "3.10"] + os: [ "ubuntu-22.04" ] + python: [ "3.10", "3.11" ] runs-on: ${{ matrix.os }} @@ -58,26 +61,18 @@ jobs: - name: Install Poetry uses: snok/install-poetry@v1 with: - version: 1.2.2 virtualenvs-create: true virtualenvs-in-project: true installer-parallel: true -# #---------------------------------------------- -# # load cached venv if cache exists -# #---------------------------------------------- -# - name: Load cached venv -# id: cached-poetry-dependencies -# uses: actions/cache@v2.1.7 -# with: -# path: .venv -# key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} -# #---------------------------------------------- -# # install dependencies if cache does not exist -# #---------------------------------------------- -# - name: Install dependencies -# if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' -# run: poetry install --no-interaction --no-root + #---------------------------------------------- + # install your root project, and run tests. + #---------------------------------------------- + - name: Check file existence + id: check_files + uses: andstor/file-existence-action@v2 + with: + files: tests #---------------------------------------------- # install your root project, and run tests. @@ -85,5 +80,5 @@ jobs: - name: Install library and run tests run: | poetry install --no-interaction - poetry add --group dev pytest-github-actions-annotate-failure + poetry add --group dev pytest-github-actions-annotate-failures poetry run pytest --cov=src tests/test_sqlite_historian_integration.py diff --git a/README.md b/README.md index f6f0cd2..1e52d16 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ +[![Eclipse VOLTTRONβ„’](https://img.shields.io/badge/Eclips%20VOLTTRON--red.svg)](https://volttron.readthedocs.io/en/latest/) +![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg) +![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg) [![Run Pytests](https://github.com/eclipse-volttron/volttron-sqlite-historian/actions/workflows/run-test.yml/badge.svg)](https://github.com/eclipse-volttron/volttron-sqlite-historian/actions/workflows/run-test.yml) [![pypi version](https://img.shields.io/pypi/v/volttron-sqlite-historian.svg)](https://pypi.org/project/volttron-sqlite-historian/) +![Passing?](https://github.com/VOLTTRON/volttron-sqlite-historian/actions/workflows/run-tests.yml/badge.svg) VOLTTRON historian agent that stores data into a SQLite database ## Requirements - - Python >= 3.8 + - Python >= 3.10 ## Installation diff --git a/pyproject.toml b/pyproject.toml index 3f72771..b50158c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,11 @@ +[build-system] +requires = ["poetry-core>=1.2.0"] +build-backend = "poetry.core.masonry.api" + [tool.poetry] name = "volttron-sqlite-historian" -version = "0.2.0-rc" -description = "None" +version = "0.2.0rc" +description = "VOLTTRON historian that store data in sqlite3 database" authors = ["VOLTTRON Team "] license = "Apache License 2.0" readme = "README.md" @@ -11,8 +15,8 @@ keywords = [] packages = [ { include = "historian", from = "src" } ] [tool.poetry.dependencies] -python = ">=3.8,<4.0" -volttron-lib-sql-historian="^0.2.0rc0" +python = ">=3.10,<4.0" +volttron-lib-sql-historian="^0.1.1a8" [tool.poetry.group.dev.dependencies] # formatting, quality, tests @@ -26,13 +30,18 @@ safety = "^1.10.3" mypy = "^0.942" coverage = "^6.3.2" pytest-cov = "^3.0.0" -Sphinx = "^4.5.0" -sphinx-rtd-theme = "^1.0.0" +Sphinx = "^6.0.0" +sphinx-rtd-theme = "^1.2.0" #volttron-lib-sql-historian = {path = "../volttron-lib-sql-historian", develop = true} #volttron-lib-base-historian = {path = "../volttron-lib-base-historian", develop = true} #volttron-testing = {path = "../volttron-testing", develop = true} #volttron = {path = "../volttron-core", develop = true} +[tool.yapf] +based_on_style = "pep8" +spaces_before_comment = 4 +column_limit = 99 +split_before_logical_operator = true [tool.yapfignore] ignore_patterns = [ @@ -42,21 +51,5 @@ ignore_patterns = [ "docs/**" ] -[tool.yapf] -based_on_style = "pep8" -spaces_before_comment = 4 -column_limit = 99 -split_before_logical_operator = true - [tool.poetry.scripts] volttron-sqlite-historian = "historian.sql.historian:main" - -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" - -# tasks -git-changelog = ">=0.5.0" -httpx = ">=0.16.1" -jinja2-cli = ">=0.7.0" -toml = ">=0.10.2" From 9d0623ba39eb2b33695371741f6b7d48c78b6701 Mon Sep 17 00:00:00 2001 From: Chandrika Sivaramakrishnan Date: Wed, 10 May 2023 16:19:01 -0700 Subject: [PATCH 5/6] added volttron-testing to dependency --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index b50158c..9a26ffb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ coverage = "^6.3.2" pytest-cov = "^3.0.0" Sphinx = "^6.0.0" sphinx-rtd-theme = "^1.2.0" +volttron-testing = "^0.4.0rc3" #volttron-lib-sql-historian = {path = "../volttron-lib-sql-historian", develop = true} #volttron-lib-base-historian = {path = "../volttron-lib-base-historian", develop = true} #volttron-testing = {path = "../volttron-testing", develop = true} From 03a379fe155dda7005b2ad157055e41a590fa381 Mon Sep 17 00:00:00 2001 From: Craig <3979063+craig8@users.noreply.github.com> Date: Fri, 12 May 2023 09:59:11 -0700 Subject: [PATCH 6/6] Don't run if base ref is main --- .github/workflows/deploy-pre-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy-pre-release.yml b/.github/workflows/deploy-pre-release.yml index 62868de..d1e048e 100644 --- a/.github/workflows/deploy-pre-release.yml +++ b/.github/workflows/deploy-pre-release.yml @@ -19,6 +19,7 @@ env: jobs: deploy-pre-release: + if: github.ref_name != 'main' runs-on: ubuntu-22.04 steps: - run: echo "πŸŽ‰ The job was automatically triggered by a ${{ github.event_name }} event."