Skip to content

Commit

Permalink
MRG: Merge pull request #112 from octue/move-children-schema-to-strands
Browse files Browse the repository at this point in the history
Move children schema to strands
  • Loading branch information
cortadocodes committed Apr 25, 2024
2 parents 2497c8a + 78a71c6 commit 47b9cc4
Show file tree
Hide file tree
Showing 14 changed files with 95 additions and 235 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/python-ci.yml
Expand Up @@ -11,30 +11,25 @@ on:
jobs:
check-semantic-version:
if: "!contains(github.event.head_commit.message, 'skipci')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: octue/check-semantic-version@1.0.0.beta-9
with:
path: setup.py
breaking_change_indicated_by: minor
uses: octue/workflows/.github/workflows/check-semantic-version.yml@main
with:
path: setup.py
breaking_change_indicated_by: minor

run-tests:
if: "!contains(github.event.head_commit.message, 'skipci')"
runs-on: ubuntu-latest
env:
USING_COVERAGE: '3.8'
USING_COVERAGE: '3.9'
strategy:
matrix:
python: [3.8]
python: ['3.8', '3.9']
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

Expand All @@ -45,10 +40,11 @@ jobs:
run: tox

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

publish:
if: "!contains(github.event.head_commit.message, 'skipci')"
Expand All @@ -62,9 +58,9 @@ jobs:
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: "3.9"

- name: Make package
run: |
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/release.yml
Expand Up @@ -12,16 +12,16 @@ jobs:
if: "github.event.pull_request.merged == true"
runs-on: ubuntu-latest
env:
USING_COVERAGE: '3.8'
USING_COVERAGE: '3.9'
strategy:
matrix:
python: [ 3.8 ]
python: ['3.8', '3.9']
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

Expand All @@ -32,10 +32,11 @@ jobs:
run: tox

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}

release:
needs: run-tests
Expand Down Expand Up @@ -68,7 +69,7 @@ jobs:
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.8

Expand Down
32 changes: 10 additions & 22 deletions .github/workflows/update-pull-request.yml
@@ -1,30 +1,18 @@
# This workflow updates the pull request description with an auto-generated section containing the categorised commit
# message headers of the commits since the last pull request merged into main. The auto generated section is enveloped
# between two comments: "<!--- START AUTOGENERATED NOTES --->" and "<!--- END AUTOGENERATED NOTES --->". Anything
# outside these in the description is left untouched. Auto-generated updates can be skipped for a commit if
# message headers of the pull request's commits. The auto generated section is enveloped between two comments:
# "<!--- START AUTOGENERATED NOTES --->" and "<!--- END AUTOGENERATED NOTES --->". Anything outside these in the
# description is left untouched. Auto-generated updates can be skipped for a commit if
# "<!--- SKIP AUTOGENERATED NOTES --->" is added to the pull request description.

name: update-pull-request

# Only trigger for pull requests into main branch.
on:
pull_request:
branches:
- main
on: [pull_request]

jobs:
description:
if: "!contains(github.event.pull_request.body, '<!--- SKIP AUTOGENERATED NOTES --->')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: octue/generate-pull-request-description@1.0.0.beta-2
id: pr-description
with:
pull_request_url: ${{ github.event.pull_request.url }}
api_token: ${{ secrets.GITHUB_TOKEN }}
- name: Update pull request body
uses: riskledger/update-pr-description@v2
with:
body: ${{ steps.pr-description.outputs.pull_request_description }}
token: ${{ secrets.GITHUB_TOKEN }}
uses: octue/workflows/.github/workflows/generate-pull-request-description.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: read
pull-requests: write
13 changes: 6 additions & 7 deletions .pre-commit-config.yaml
Expand Up @@ -41,17 +41,16 @@ repos:
- id: pydocstyle

- repo: https://github.com/thclark/pre-commit-sphinx
rev: 0.0.1
rev: 0.0.3
hooks:
- id: build-docs
language_version: python3
additional_dependencies:
- 'Sphinx>=2,<3'
- 'sphinx-rtd-theme==0.5.0'
- 'sphinx-tabs==1.2.1'
- 'sphinx-charts==0.0.4'
- 'scipy~=1.5.2'
- 'jsonschema~=3.2.0'
- 'Sphinx'
- 'sphinx-rtd-theme'
- 'sphinx-tabs'
- 'sphinx-charts'
- 'jsonschema'

- repo: https://github.com/windpioneers/pre-commit-hooks
rev: 0.0.5
Expand Down
16 changes: 16 additions & 0 deletions .readthedocs.yaml
@@ -0,0 +1,16 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

version: 2

build:
os: ubuntu-22.04
tools:
python: "3.10"

sphinx:
configuration: docs/source/conf.py

python:
install:
- requirements: docs/requirements.txt
12 changes: 5 additions & 7 deletions docs/requirements.txt
@@ -1,8 +1,6 @@

# Required by the python script for building documentation
Sphinx>=2,<3
sphinx-rtd-theme==0.5.0
sphinx-tabs==1.2.1
sphinx-charts==0.0.4
scipy~=1.5.2
jsonschema~=3.2.0
Sphinx
sphinx-rtd-theme
sphinx-tabs
sphinx-charts
jsonschema
2 changes: 1 addition & 1 deletion docs/source/_ext/sphinx_accordion/accordion.py
Expand Up @@ -246,7 +246,7 @@ def setup(app):
if 'add_script_file' in dir(app):
app.add_script_file(path)
else:
app.add_javascript(path)
app.add_js_file(path)

app.connect('html-page-context', update_context)
app.connect('build-finished', copy_assets)
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -16,7 +16,7 @@

setup(
name="twined",
version="0.5.3",
version="0.5.4",
py_modules=[],
install_requires=["jsonschema ~= 4.4.0", "python-dotenv"],
url="https://www.github.com/octue/twined",
Expand All @@ -33,6 +33,7 @@
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Operating System :: OS Independent",
],
python_requires=">=3.6",
Expand Down
18 changes: 8 additions & 10 deletions tests/test_children.py
Expand Up @@ -5,24 +5,22 @@


class TestChildrenTwine(BaseTestCase):
"""Tests related to the twine itself - ensuring that valid and invalid
`children` entries in a twine file work as expected
"""
"""Tests ensuring that valid and invalid `children` entries in a twine file work as expected."""

def test_invalid_children_dict_not_array(self):
"""Ensures InvalidTwine exceptions are raised when instantiating twines where `children` entry is incorrectly
specified as a dict, not an array
"""Ensure that `InvalidTwine` exceptions are raised when instantiating twines where `children` entry is
incorrectly specified as a dict, not an array.
"""
with self.assertRaises(exceptions.InvalidTwine):
Twine(source="""{"children": {}}""")

def test_invalid_children_no_key(self):
"""Ensures InvalidTwine exceptions are raised when instantiating twines where a child
is specified without the required `key` field
"""Ensure that `InvalidTwine` exceptions are raised when instantiating twines where a child is specified without
the required `key` field.
"""
source = """
{
"children": [{"purpose": "The purpose.", "notes": "Here are some notes.", "filters": "tags:gis"}]
"children": [{"purpose": "The purpose.", "notes": "Here are some notes."}]
}
"""

Expand All @@ -33,7 +31,7 @@ def test_valid_children(self):
"""Ensures that a twine with one child can be instantiated correctly."""
source = """
{
"children": [{"key": "gis", "purpose": "The purpose.", "notes": "Some notes.", "filters": "tags:gis"}]
"children": [{"key": "gis", "purpose": "The purpose.", "notes": "Some notes."}]
}
"""
self.assertEqual(len(Twine(source=source).children), 1)
Expand All @@ -49,7 +47,7 @@ class TestChildrenValidation(BaseTestCase):

VALID_TWINE_WITH_CHILDREN = """
{
"children": [{"key": "gis", "purpose": "The purpose", "notes": "Some notes.", "filters": "tags:gis"}]
"children": [{"key": "gis", "purpose": "The purpose", "notes": "Some notes."}]
}
"""

Expand Down
2 changes: 1 addition & 1 deletion tox.ini
@@ -1,5 +1,5 @@
[tox]
envlist = {py38}
envlist = {py38,py39}

[testenv]
setenv =
Expand Down
Empty file added twined/schema/__init__.py
Empty file.
39 changes: 0 additions & 39 deletions twined/schema/children_schema.json

This file was deleted.

0 comments on commit 47b9cc4

Please sign in to comment.