Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move children schema to strands remove use of deprecated module #112

Merged
merged 15 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions .github/workflows/python-ci.yml
Original file line number Diff line number Diff line change
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/[email protected]
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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.

Loading
Loading