From af1e9915f67ec5804c53cc9f0ea28c60974fac9a Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Tue, 20 Jun 2023 19:07:41 -0500 Subject: [PATCH 1/6] Remove Google Analytics key and add extensions --- .../workflows/u24_element_release_call.yml | 2 -- docs/.docker/pip_requirements.txt | 2 ++ docs/docker-compose.yaml | 3 --- docs/mkdocs.yaml | 19 ++++++------------- 4 files changed, 8 insertions(+), 18 deletions(-) diff --git a/.github/workflows/u24_element_release_call.yml b/.github/workflows/u24_element_release_call.yml index fa8deba..4324cca 100644 --- a/.github/workflows/u24_element_release_call.yml +++ b/.github/workflows/u24_element_release_call.yml @@ -17,7 +17,6 @@ jobs: secrets: TWINE_USERNAME: ${{secrets.TWINE_TEST_USERNAME}} TWINE_PASSWORD: ${{secrets.TWINE_TEST_PASSWORD}} - GOOGLE_ANALYTICS_KEY: ${{secrets.GOOGLE_ANALYTICS_KEY}} call_u24_elements_release_alpine: if: >- github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'datajoint' && !contains(github.event.workflow_run.head_branch, 'test') @@ -27,4 +26,3 @@ jobs: secrets: TWINE_USERNAME: ${{secrets.TWINE_USERNAME}} TWINE_PASSWORD: ${{secrets.TWINE_PASSWORD}} - GOOGLE_ANALYTICS_KEY: ${{secrets.GOOGLE_ANALYTICS_KEY}} diff --git a/docs/.docker/pip_requirements.txt b/docs/.docker/pip_requirements.txt index dbe8a35..ae44fb5 100644 --- a/docs/.docker/pip_requirements.txt +++ b/docs/.docker/pip_requirements.txt @@ -8,3 +8,5 @@ mkdocs-gen-files mkdocs-literate-nav mkdocs-exclude-search mkdocs-markdownextradata-plugin +mkdocs-jupyter +mkdocs-section-index \ No newline at end of file diff --git a/docs/docker-compose.yaml b/docs/docker-compose.yaml index 8c9e407..af309e6 100644 --- a/docs/docker-compose.yaml +++ b/docs/docker-compose.yaml @@ -1,6 +1,4 @@ # MODE="LIVE|QA|PUSH" PACKAGE=element_event UPSTREAM_REPO=https://github.com/datajoint/element-event.git HOST_UID=$(id -u) docker compose -f docs/docker-compose.yaml up --build -# -# navigate to http://localhost/ version: "2.4" services: docs: @@ -14,7 +12,6 @@ services: - PACKAGE - UPSTREAM_REPO - MODE - - GOOGLE_ANALYTICS_KEY - PATCH_VERSION volumes: - ../docs:/main/docs diff --git a/docs/mkdocs.yaml b/docs/mkdocs.yaml index b355daa..e3db9ff 100644 --- a/docs/mkdocs.yaml +++ b/docs/mkdocs.yaml @@ -42,17 +42,14 @@ nav: # UPSTREAM_REPO=https://github.com/datajoint/element-{ELEMENT}.git \ # HOST_UID=$(id -u) docker compose -f docs/docker-compose.yaml up --build # ``` -# 02. Site analytics depend on a local environment variable GOOGLE_ANALYTICS_KEY -# You can find this in LastPass or declare with any string to suprress errors -# 03. The API section will pull docstrings. +# 02. The API section will pull docstrings. # A. Follow google styleguide e.g., # https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html # With typing suggestions: https://docs.python.org/3/library/typing.html # B. To pull a specific workflow fork, change ./docs/src/api/make_pages.py#L19 -# 04. To see your fork of the workflow-{element} in this render, change the +# 03. To see your fork of the workflow-{element} in this render, change the # URL in ./docs/src/api/make_pages.py#L19 to your fork. -# 05. For redirecting options For redirect options, see 'redirects' below. -# 06. To deploy this site on your fork, +# 04. To deploy this site on your fork, # A. declare a branch called gh-pages # B. go to the your fork > settings > pages # C. direct pages to render from the gh-pages branch at root @@ -87,9 +84,6 @@ theme: plugins: - markdownextradata: {} - search - # - redirects: # OPTIONAL REDIRECTS - # redirect_maps: - # "index.md": "getting_started.md" - mkdocstrings: default_handler: python handlers: @@ -126,13 +120,12 @@ markdown_extensions: linenums: true - pymdownx.inlinehilite - pymdownx.snippets - + - pymdownx.magiclink # Displays bare URLs as links + - pymdownx.tasklist: # Renders check boxes in tasks lists + custom_checkbox: true extra: PATCH_VERSION: !ENV PATCH_VERSION generator: false # Disable watermark - analytics: - provider: google - property: !ENV GOOGLE_ANALYTICS_KEY version: provider: mike social: From efbeeaecaafd9306424d9aecbce161e2000a3610 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Tue, 20 Jun 2023 19:08:12 -0500 Subject: [PATCH 2/6] Update link --- .github/ISSUE_TEMPLATE/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index d31fbac..b3d197d 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,5 @@ blank_issues_enabled: false contact_links: - name: DataJoint Contribution Guideline - url: https://docs.datajoint.org/python/community/02-Contribute.html + url: https://datajoint.com/docs/community/contribute/ about: Please make sure to review the DataJoint Contribution Guidelines \ No newline at end of file From 6ce07bca8302c46edb6116c9f6c22e3d7344e4f6 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Tue, 20 Jun 2023 19:09:30 -0500 Subject: [PATCH 3/6] Update GitHub Actions workflows --- .../anchored_u24_element_before_release.yaml | 28 --------- .../anchored_u24_element_release_call.yaml | 59 ------------------- .../anchored_u24_element_tag_to_release.yaml | 25 -------- .github/.staging_workflows/normalize.sh | 23 -------- .github/make-dev.sh | 2 - .github/make-prod.sh | 2 - .github/make-test.sh | 2 - .github/run-act.sh | 7 --- .github/workflows/release.yaml | 18 ++++++ .github/workflows/test.yaml | 32 ++++++++++ .../workflows/u24_element_before_release.yaml | 17 ------ .../workflows/u24_element_release_call.yml | 28 --------- .../workflows/u24_element_tag_to_release.yaml | 14 ----- 13 files changed, 50 insertions(+), 207 deletions(-) delete mode 100644 .github/.staging_workflows/anchored_u24_element_before_release.yaml delete mode 100644 .github/.staging_workflows/anchored_u24_element_release_call.yaml delete mode 100644 .github/.staging_workflows/anchored_u24_element_tag_to_release.yaml delete mode 100644 .github/.staging_workflows/normalize.sh delete mode 100644 .github/make-dev.sh delete mode 100644 .github/make-prod.sh delete mode 100644 .github/make-test.sh delete mode 100644 .github/run-act.sh create mode 100644 .github/workflows/release.yaml create mode 100644 .github/workflows/test.yaml delete mode 100644 .github/workflows/u24_element_before_release.yaml delete mode 100644 .github/workflows/u24_element_release_call.yml delete mode 100644 .github/workflows/u24_element_tag_to_release.yaml diff --git a/.github/.staging_workflows/anchored_u24_element_before_release.yaml b/.github/.staging_workflows/anchored_u24_element_before_release.yaml deleted file mode 100644 index d1d6e43..0000000 --- a/.github/.staging_workflows/anchored_u24_element_before_release.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: u24_element_before_release - -on: - pull_request: - push: - branches: - - '**' - tags-ignore: - - '**' - workflow_dispatch: - -anchor-dev-build-call: &dev-build-call - uses: yambottle/djsciops-cicd/.github/workflows/u24_element_build.yaml@main - -anchor-test-build-call: &test-build-call - uses: yambottle/djsciops-cicd/.github/workflows/u24_element_build.yaml@main - -anchor-prod-build-call: &prod-build-call - uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_build.yaml@main - -jobs: - call_context_check: - uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main - call_u24_elements_build_alpine: - !!merge <<: *$STAGE-build-call - with: - py_ver: 3.9 - image: djbase \ No newline at end of file diff --git a/.github/.staging_workflows/anchored_u24_element_release_call.yaml b/.github/.staging_workflows/anchored_u24_element_release_call.yaml deleted file mode 100644 index 2b809f2..0000000 --- a/.github/.staging_workflows/anchored_u24_element_release_call.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: u24_element_release_call - -on: - workflow_run: - workflows: ["u24_element_tag_to_release"] - types: - - completed - -anchor-dev-release-call: &dev-release-call - uses: yambottle/djsciops-cicd/.github/workflows/u24_element_release.yaml@main - -anchor-test-release-call: &test-release-call - uses: yambottle/djsciops-cicd/.github/workflows/u24_element_release.yaml@main - -anchor-prod-release-call: &prod-release-call - uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_release.yaml@main - -anchor-dev-release-if: &dev-release-if - if: >- - github.event.workflow_run.conclusion == 'success' && - github.repository_owner == 'yambottle' && - !contains(github.event.workflow_run.head_branch, 'test') - -anchor-test-release-if: &test-release-if - if: >- - github.event.workflow_run.conclusion == 'success' && - github.repository_owner == 'yambottle' && - !contains(github.event.workflow_run.head_branch, 'test') - -anchor-prod-release-if: &prod-release-if - if: >- - github.event.workflow_run.conclusion == 'success' && - github.repository_owner == 'datajoint' && - !contains(github.event.workflow_run.head_branch, 'test') - -jobs: - call_context_check: - uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main - test_call_u24_elements_release_alpine: - if: >- - github.event.workflow_run.conclusion == 'success' && - ( contains(github.event.workflow_run.head_branch, 'test') || - (github.event.workflow_run.event == 'pull_request')) - !!merge <<: *$STAGE-release-call - with: - py_ver: 3.9 - twine_repo: testpypi - secrets: - TWINE_USERNAME: ${{secrets.TWINE_TEST_USERNAME}} - TWINE_PASSWORD: ${{secrets.TWINE_TEST_PASSWORD}} - - call_u24_elements_release_alpine: - !!merge <<: *$STAGE-release-if - !!merge <<: *$STAGE-release-call - with: - py_ver: 3.9 - secrets: - TWINE_USERNAME: ${{secrets.TWINE_USERNAME}} - TWINE_PASSWORD: ${{secrets.TWINE_PASSWORD}} \ No newline at end of file diff --git a/.github/.staging_workflows/anchored_u24_element_tag_to_release.yaml b/.github/.staging_workflows/anchored_u24_element_tag_to_release.yaml deleted file mode 100644 index cc6be67..0000000 --- a/.github/.staging_workflows/anchored_u24_element_tag_to_release.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: u24_element_tag_to_release - -on: - push: - tags: - - '*.*.*' - - 'test*.*.*' - -anchor-dev-build-call: &dev-build-call - uses: yambottle/djsciops-cicd/.github/workflows/u24_element_build.yaml@main - -anchor-test-build-call: &test-build-call - uses: yambottle/djsciops-cicd/.github/workflows/u24_element_build.yaml@main - -anchor-prod-build-call: &prod-build-call - uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_build.yaml@main - -jobs: - call_context_check: - uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main - call_u24_elements_build_alpine: - !!merge <<: *$STAGE-build-call - with: - py_ver: 3.9 - image: djbase \ No newline at end of file diff --git a/.github/.staging_workflows/normalize.sh b/.github/.staging_workflows/normalize.sh deleted file mode 100644 index e15479c..0000000 --- a/.github/.staging_workflows/normalize.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# For Github Action that doesn't support anchor yet... -# https://github.com/actions/runner/issues/1182 -# yq is not the version from pypi with the same name. - -export STAGE=${1:-prod} -# .yaml in .staging_workflows has to be named using a prefix, e.g., 'anchored_', this will be removed when normalizing -PREFIX=${2:-anchored_} -SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) - -run_yq() { - local src_file - local filename - local target - for src_file in "${SCRIPT_DIR}"/*.y*ml; do - [[ ! -f ${src_file} ]] && continue - filename=$(basename "$src_file") - target="${SCRIPT_DIR}"/../workflows/${filename#"$PREFIX"} - envsubst '${STAGE}' <"$src_file" | yq e 'explode(.) | del(.anchor-*)' >"$target" - done -} - -run_yq \ No newline at end of file diff --git a/.github/make-dev.sh b/.github/make-dev.sh deleted file mode 100644 index e9bdb38..0000000 --- a/.github/make-dev.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -bash ./.staging_workflows/normalize.sh dev \ No newline at end of file diff --git a/.github/make-prod.sh b/.github/make-prod.sh deleted file mode 100644 index 806e39e..0000000 --- a/.github/make-prod.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -bash ./.staging_workflows/normalize.sh prod \ No newline at end of file diff --git a/.github/make-test.sh b/.github/make-test.sh deleted file mode 100644 index 3870e77..0000000 --- a/.github/make-test.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -bash ./.staging_workflows/normalize.sh test \ No newline at end of file diff --git a/.github/run-act.sh b/.github/run-act.sh deleted file mode 100644 index 4ae9cdf..0000000 --- a/.github/run-act.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) -bash $SCRIPT_DIR/.staging_workflows/normalize.sh dev -cd .. -act -P ubuntu-latest=drewyangdev/ubuntu:act-latest \ - --secret-file $SCRIPT_DIR/.test/.secrets \ - --artifact-server-path $SCRIPT_DIR/.test/artifacts/ \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..b814a09 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,18 @@ +name: Release +on: + workflow_dispatch: +jobs: + make_github_release: + uses: datajoint/.github/.github/workflows/make_github_release.yaml@main + pypi_release: + needs: make_github_release + uses: datajoint/.github/.github/workflows/pypi_release.yaml@main + secrets: + TWINE_USERNAME: ${{secrets.TWINE_USERNAME}} + TWINE_PASSWORD: ${{secrets.TWINE_PASSWORD}} + with: + UPLOAD_URL: ${{needs.make_github_release.outputs.release_upload_url}} + mkdocs_release: + uses: datajoint/.github/.github/workflows/mkdocs_release.yaml@main + permissions: + contents: write \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..79bfb64 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,32 @@ +name: Test +on: + push: + pull_request: + workflow_dispatch: +jobs: + tests: + runs-on: ubuntu-latest + strategy: + matrix: + py_ver: ["3.9", "3.10"] + mysql_ver: ["8.0", "5.7"] + include: + - py_ver: "3.8" + mysql_ver: "5.7" + - py_ver: "3.7" + mysql_ver: "5.7" + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{matrix.py_ver}} + uses: actions/setup-python@v4 + with: + python-version: ${{matrix.py_ver}} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 "black[jupyter]" + - name: Run style tests + run: | + python_version=${{matrix.py_ver}} + black element_event --check --verbose --target-version py${python_version//.} + diff --git a/.github/workflows/u24_element_before_release.yaml b/.github/workflows/u24_element_before_release.yaml deleted file mode 100644 index 692cf82..0000000 --- a/.github/workflows/u24_element_before_release.yaml +++ /dev/null @@ -1,17 +0,0 @@ -name: u24_element_before_release -on: - pull_request: - push: - branches: - - '**' - tags-ignore: - - '**' - workflow_dispatch: -jobs: - call_context_check: - uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main - call_u24_elements_build_alpine: - uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_build.yaml@main - with: - py_ver: 3.9 - image: djbase diff --git a/.github/workflows/u24_element_release_call.yml b/.github/workflows/u24_element_release_call.yml deleted file mode 100644 index 4324cca..0000000 --- a/.github/workflows/u24_element_release_call.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: u24_element_release_call -on: - workflow_run: - workflows: ["u24_element_tag_to_release"] - types: - - completed -jobs: - call_context_check: - uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main - test_call_u24_elements_release_alpine: - if: >- - github.event.workflow_run.conclusion == 'success' && ( contains(github.event.workflow_run.head_branch, 'test') || (github.event.workflow_run.event == 'pull_request')) - uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_release.yaml@main - with: - py_ver: 3.9 - twine_repo: testpypi - secrets: - TWINE_USERNAME: ${{secrets.TWINE_TEST_USERNAME}} - TWINE_PASSWORD: ${{secrets.TWINE_TEST_PASSWORD}} - call_u24_elements_release_alpine: - if: >- - github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'datajoint' && !contains(github.event.workflow_run.head_branch, 'test') - uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_release.yaml@main - with: - py_ver: 3.9 - secrets: - TWINE_USERNAME: ${{secrets.TWINE_USERNAME}} - TWINE_PASSWORD: ${{secrets.TWINE_PASSWORD}} diff --git a/.github/workflows/u24_element_tag_to_release.yaml b/.github/workflows/u24_element_tag_to_release.yaml deleted file mode 100644 index 57334e9..0000000 --- a/.github/workflows/u24_element_tag_to_release.yaml +++ /dev/null @@ -1,14 +0,0 @@ -name: u24_element_tag_to_release -on: - push: - tags: - - '*.*.*' - - 'test*.*.*' -jobs: - call_context_check: - uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main - call_u24_elements_build_alpine: - uses: dj-sciops/djsciops-cicd/.github/workflows/u24_element_build.yaml@main - with: - py_ver: 3.9 - image: djbase From c24f0bc23009d48a1896d34a0264b4e65e96121f Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Tue, 20 Jun 2023 19:11:45 -0500 Subject: [PATCH 4/6] Update version and changelog --- CHANGELOG.md | 7 +++++++ element_event/version.py | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8dd553..639abef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention. +## [0.2.3] - 2023-06-20 + ++ Update - GitHub Actions workflows ++ Fix - Remove Google Analytics key ++ Add - GitHub Issue Templates + ## [0.2.2] - 2023-05-11 + Fix - `.ipynb` dark mode output for all notebooks. @@ -37,6 +43,7 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and + Add - AlignmentEvent design to capture windows relative to an event + Add - Black formatting into code base +[0.2.3]: https://github.com/datajoint/element-event/releases/tag/0.2.3 [0.2.2]: https://github.com/datajoint/element-event/releases/tag/0.2.2 [0.2.1]: https://github.com/datajoint/element-event/releases/tag/0.2.1 [0.2.0]: https://github.com/datajoint/element-event/releases/tag/0.2.0 diff --git a/element_event/version.py b/element_event/version.py index e427d33..fd93127 100644 --- a/element_event/version.py +++ b/element_event/version.py @@ -1,2 +1,2 @@ """Package metadata.""" -__version__ = "0.2.2" +__version__ = "0.2.3" From 471ce8c09805a154ddc5770255bcc8b432e37a83 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Tue, 20 Jun 2023 19:12:41 -0500 Subject: [PATCH 5/6] Update readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index d55a026..03d1d6b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![PyPI version](https://badge.fury.io/py/element-event.svg)](http://badge.fury.io/py/element-event) + # DataJoint Element - Experimental trials + `element-event` features a DataJoint pipeline design for event, trial, and block management. From 7ff3d4ce4bd87a52aa3e7d6ea5ddebd791b0b89a Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Tue, 20 Jun 2023 19:20:25 -0500 Subject: [PATCH 6/6] Format with black --- element_event/trial.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/element_event/trial.py b/element_event/trial.py index 1b535a9..adbb8dc 100644 --- a/element_event/trial.py +++ b/element_event/trial.py @@ -96,7 +96,7 @@ class Attribute(dj.Part): """Extra Block attributes to fully describe a block Attributes: - Block (foreign key): Block table primary key. + Block (foreign key): Block table primary key. attribute_name ( varchar(32) ): Name of block attribute attribute_value ( varchar(2000) ): Optional. Block attribute value attribute_blob (longblob): Optional. Block attribute numerical numerical data