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 diff --git a/.github/workflows/development.yaml b/.github/workflows/development.yaml deleted file mode 100644 index 77314d1..0000000 --- a/.github/workflows/development.yaml +++ /dev/null @@ -1,147 +0,0 @@ -name: Development -on: - pull_request: - push: - tags: - - '*.*.*' -jobs: - test-changelog: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Get changelog entry - id: changelog_reader - uses: guzman-raphael/changelog-reader-action@v5 - with: - path: ./CHANGELOG.md - - name: Verify changelog parsing - env: - TAG_NAME: ${{steps.changelog_reader.outputs.version}} - RELEASE_NAME: Release ${{steps.changelog_reader.outputs.version}} - BODY: ${{steps.changelog_reader.outputs.changes}} - PRERELEASE: ${{steps.changelog_reader.outputs.status == 'prereleased'}} - DRAFT: ${{steps.changelog_reader.outputs.status == 'unreleased'}} - run: | - echo "TAG_NAME=${TAG_NAME}" - echo "RELEASE_NAME=${RELEASE_NAME}" - echo "BODY=${BODY}" - echo "PRERELEASE=${PRERELEASE}" - echo "DRAFT=${DRAFT}" - build: - needs: test-changelog - runs-on: ubuntu-latest - strategy: - matrix: - include: - - py_ver: 3.8 - distro: alpine - image: djbase - env: - PY_VER: ${{matrix.py_ver}} - DISTRO: ${{matrix.distro}} - IMAGE: ${{matrix.image}} - DOCKER_CLIENT_TIMEOUT: "120" - COMPOSE_HTTP_TIMEOUT: "120" - steps: - - uses: actions/checkout@v2 - - name: Compile image - run: | - export PKG_NAME=$(python3 -c "print([p for p in __import__('setuptools').find_packages() if '.' not in p][0])") - export PKG_VERSION=$(cat ${PKG_NAME}/version.py | awk -F\" '/__version__ = / {print $2}') - export HOST_UID=$(id -u) - docker-compose -f docker-compose-build.yaml up --exit-code-from element --build - IMAGE=$(docker images --filter "reference=datajoint/${PKG_NAME}*" \ - --format "{{.Repository}}") - TAG=$(docker images --filter "reference=datajoint/${PKG_NAME}*" --format "{{.Tag}}") - docker save "${IMAGE}:${TAG}" | \ - gzip > "image-${PKG_NAME}-${PKG_VERSION}-py${PY_VER}-${DISTRO}.tar.gz" - echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_ENV - echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_ENV - - name: Add image artifact - uses: actions/upload-artifact@v2 - with: - name: image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py${{matrix.py_ver}}-${{matrix.distro}} - path: "image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py${{matrix.py_ver}}-\ - ${{matrix.distro}}.tar.gz" - retention-days: 1 - - if: matrix.py_ver == '3.8' && matrix.distro == 'alpine' - name: Add pip artifacts - uses: actions/upload-artifact@v2 - with: - name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}} - path: dist - retention-days: 1 - publish-release: - if: github.event_name == 'push' - needs: build - runs-on: ubuntu-latest - env: - TWINE_USERNAME: ${{secrets.twine_username}} - TWINE_PASSWORD: ${{secrets.twine_password}} - outputs: - release_upload_url: ${{steps.create_gh_release.outputs.upload_url}} - steps: - - uses: actions/checkout@v2 - - name: Determine package version - run: | - PKG_NAME=$(python3 -c "print([p for p in __import__('setuptools').find_packages() if '.' not in p][0])") - SDIST_PKG_NAME=$(echo ${PKG_NAME} | sed 's|_|-|g') - PKG_VERSION=$(cat ${PKG_NAME}/version.py | awk -F\" '/__version__ = / {print $2}') - echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_ENV - echo "PKG_VERSION=${PKG_VERSION}" >> $GITHUB_ENV - echo "SDIST_PKG_NAME=${SDIST_PKG_NAME}" >> $GITHUB_ENV - - name: Get changelog entry - id: changelog_reader - uses: guzman-raphael/changelog-reader-action@v5 - with: - path: ./CHANGELOG.md - version: ${{env.PKG_VERSION}} - - name: Create GH release - id: create_gh_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - with: - tag_name: ${{steps.changelog_reader.outputs.version}} - release_name: Release ${{steps.changelog_reader.outputs.version}} - body: ${{steps.changelog_reader.outputs.changes}} - prerelease: ${{steps.changelog_reader.outputs.status == 'prereleased'}} - draft: ${{steps.changelog_reader.outputs.status == 'unreleased'}} - - name: Fetch image artifact - uses: actions/download-artifact@v2 - with: - name: image-${{env.PKG_NAME}}-${{env.PKG_VERSION}}-py3.8-alpine - - name: Fetch pip artifacts - uses: actions/download-artifact@v2 - with: - name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}} - path: dist - - name: Publish pip release - run: | - export HOST_UID=$(id -u) - docker load < "image-${{env.PKG_NAME}}-${PKG_VERSION}-py3.8-alpine.tar.gz" - docker-compose -f docker-compose-build.yaml run \ - -e TWINE_USERNAME=${TWINE_USERNAME} -e TWINE_PASSWORD=${TWINE_PASSWORD} element \ - sh -lc "pip install twine && python -m twine upload dist/*" - - name: Determine pip artifact paths - run: | - echo "PKG_WHEEL_PATH=$(ls dist/${PKG_NAME}-*.whl)" >> $GITHUB_ENV - echo "PKG_SDIST_PATH=$(ls dist/${SDIST_PKG_NAME}-*.tar.gz)" >> $GITHUB_ENV - - name: Upload pip wheel asset to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - with: - upload_url: ${{steps.create_gh_release.outputs.upload_url}} - asset_path: ${{env.PKG_WHEEL_PATH}} - asset_name: pip-${{env.PKG_NAME}}-${{env.PKG_VERSION}}.whl - asset_content_type: application/zip - - name: Upload pip sdist asset to release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - with: - upload_url: ${{steps.create_gh_release.outputs.upload_url}} - asset_path: ${{env.PKG_SDIST_PATH}} - asset_name: pip-${{env.SDIST_PKG_NAME}}-${{env.PKG_VERSION}}.tar.gz - asset_content_type: application/gzip 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..75603f8 --- /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_animal --check --verbose --target-version py${python_version//.} + diff --git a/.github/workflows/u24_element_before_release.yml b/.github/workflows/u24_element_before_release.yml deleted file mode 100644 index 692cf82..0000000 --- a/.github/workflows/u24_element_before_release.yml +++ /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.yml b/.github/workflows/u24_element_tag_to_release.yml deleted file mode 100644 index 57334e9..0000000 --- a/.github/workflows/u24_element_tag_to_release.yml +++ /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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7abe606..893dab6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,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.1.7] - 2023 05-11 +## [0.1.8] - 2023-06-20 + ++ Update - GitHub Actions workflows ++ Fix - Remove Google Analytics key + +## [0.1.7] - 2023-05-11 + Fix - `.ipynb` dark mode output for all notebooks. + Update - CHANGELOG markdown from "-" to "+" for consistency with other @@ -53,6 +58,7 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and + Add - `subject` schema + Add - `genotyping` schema +[0.1.8]: https://github.com/datajoint/element-animal/releases/tag/0.1.8 [0.1.7]: https://github.com/datajoint/element-animal/releases/tag/0.1.7 [0.1.6]: https://github.com/datajoint/element-animal/releases/tag/0.1.6 [0.1.5]: https://github.com/datajoint/element-animal/releases/tag/0.1.5 diff --git a/README.md b/README.md index 4db9134..faa8b81 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![PyPI version](https://badge.fury.io/py/element-animal.svg)](http://badge.fury.io/py/element-animal) + # Element Animal DataJoint Element for storing animal meta data, genotype, and surgery information. diff --git a/docs/.docker/pip_requirements.txt b/docs/.docker/pip_requirements.txt index 9a1b23f..ae44fb5 100644 --- a/docs/.docker/pip_requirements.txt +++ b/docs/.docker/pip_requirements.txt @@ -7,4 +7,6 @@ mdx-truly-sane-lists mkdocs-gen-files mkdocs-literate-nav mkdocs-exclude-search -mkdocs-markdownextradata-plugin \ No newline at end of file +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 181ab0a..b6491c5 100644 --- a/docs/docker-compose.yaml +++ b/docs/docker-compose.yaml @@ -1,6 +1,4 @@ # MODE="LIVE|QA|PUSH" PACKAGE=element_animal UPSTREAM_REPO=https://github.com/datajoint/element-animal.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 6edfa1c..8ebf099 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 suppress 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: diff --git a/element_animal/subject.py b/element_animal/subject.py index f5f8f0a..f706105 100644 --- a/element_animal/subject.py +++ b/element_animal/subject.py @@ -11,7 +11,7 @@ def activate( *, create_schema: bool = True, create_tables: bool = True, - linking_module: bool = True + linking_module: bool = True, ): """Activate this schema. diff --git a/element_animal/surgery.py b/element_animal/surgery.py index e8c8427..d3e8ae2 100644 --- a/element_animal/surgery.py +++ b/element_animal/surgery.py @@ -16,7 +16,7 @@ def activate( *, create_schema: bool = True, create_tables: bool = True, - linking_module: bool = True + linking_module: bool = True, ): """Activate this schema. @@ -131,8 +131,6 @@ class ImplantationType(dj.Lookup): class Implantation(dj.Manual): """Implantation of a device - WRT: With Respect To - Attributes: Session (foreign key): Session primary key location_id (int): ID of of brain location @@ -143,9 +141,9 @@ class Implantation(dj.Manual): dv ( float ): In mm, dorso-ventral axis. Ventral negative dv_reference (projected attribute): Coordinate reference theta ( float, nullable ): Elevation in degrees. - Rotation about ml-axis [0, 180] WRT Z + Rotation about ml-axis [0, 180] relative to z-axis phi ( float, nullable ): Azimuth in degrees. - Rotations about dv-axis [0, 360] WRT X + Rotations about dv-axis [0, 360] relative to x-axis beta ( float, nullable ): Rotation about shank in degrees. Rotation about the shank [-180, 180]. Clockwise is increasing. 0 is the probe-front facing anterior diff --git a/element_animal/version.py b/element_animal/version.py index f5d1ec6..10bc5c5 100644 --- a/element_animal/version.py +++ b/element_animal/version.py @@ -1,2 +1,2 @@ """Package metadata.""" -__version__ = "0.1.7" +__version__ = "0.1.8"