Skip to content

Commit

Permalink
Add support for python 3.13
Browse files Browse the repository at this point in the history
Remove support for python 3.8.

Upgrade all dependencies

Replaced sphinx docs googleanalytics module as current one is
deprecated.

Reformatted code using new version of black..

Use new merge-requires github action

AB#10062
  • Loading branch information
eccles committed Nov 19, 2024
1 parent e533cdf commit fd4dcd0
Show file tree
Hide file tree
Showing 35 changed files with 252 additions and 198 deletions.
1 change: 1 addition & 0 deletions .env.tools
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export TOOLS_BUILDNUMBER=20241115.3
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python Quality Control
name: Build and test

on: [pull_request]
on:
workflow_call:

jobs:
build:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12" ]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13" ]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -66,7 +67,6 @@ jobs:
./scripts/unittests.sh
shell: bash
- name: Run type-hint checks
if: ${{ matrix.python-version != '3.12' }}
run: |
./scripts/version.sh
python3 -m pyright --stats archivist
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/merge-rtequires.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow configures the repository specific choices of which CI builds
# must pass in order for a build to merge. This allows a sinlge global teraform
# configured rule to require a "well known" check in each repository. Whilst
# granting repository stakeholders the ability configure what workflows are
# appropriate to satisfy that check.
name: Merge Requires
on:
push:

jobs:
ci:
if: ${{ github.event_name != 'release' }}
secrets: inherit
uses: ./.github/workflows/ci.yml
release:
if: ${{ github.event_name == 'release' }}
secrets: inherit
uses: ./.github/workflows/package.yml

merge-checks-ok:
runs-on: ubuntu-latest
needs: [ci]
steps:
- name: ok
run: |
echo "It's working!"
release-checks-ok:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' }}
needs: [ci, release]
steps:
- name: ok
run: |
echo "Houston we have cleared the tower"
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package
name: Package and Publish

on:
release:
types: [created]
workflow_call:

jobs:
deploy:
build:

runs-on: ubuntu-latest

Expand Down
24 changes: 12 additions & 12 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,11 @@ To run the unittests:
task unittests
```

##### Python 3.9
##### Python 3.10

To build the docker builder image with Python 3.9:
To build the docker builder image with Python 3.10:
```bash
task builder-3.9
task builder-3.10
```

To check the style
Expand All @@ -217,11 +217,11 @@ To run the unittests:
task unittests
```

##### Python 3.10
##### Python 3.11

To build the docker builder image with Python 3.10:
To build the docker builder image with Python 3.11:
```bash
task builder-3.10
task builder-3.11
```

To check the style
Expand All @@ -234,11 +234,11 @@ To run the unittests:
task unittests
```

##### Python 3.11
##### Python 3.12

To build the docker builder image with Python 3.11:
To build the docker builder image with Python 3.12:
```bash
task builder-3.11
task builder-3.12
```

To check the style
Expand All @@ -251,11 +251,11 @@ To run the unittests:
task unittests
```

##### Python 3.12
##### Python 3.13

To build the docker builder image with Python 3.12:
To build the docker builder image with Python 3.13:
```bash
task builder-3.12
task builder-3.13
```

To check the style
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ documented at https://docs.datatrails.ai
Support
=======

This package currently is tested against Python versions 3.8,3.9,3.10,3.11 and 3.12.
This package currently is tested against Python versions 3.9,3.10,3.11, 3.12 and 3.13.

The current default version is 3.8 - this means that this package will not
use any features specific to versions 3.9 and later.
The current default version is 3.9 - this means that this package will not
use any features specific to versions 3.10 and later.

After End of Life of a particular Python version, support is offered on a best effort
basis. We may ask you to update your Python version to help solve the problem,
Expand Down
10 changes: 5 additions & 5 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ tasks:
- ./scripts/builder.sh pip-audit -r requirements.txt

builder:
desc: Build a docker environment with the right dependencies and utilities
cmds:
- ./scripts/build.sh "3.8"

builder-3.9:
desc: Build a docker environment with the right dependencies and utilities
cmds:
- ./scripts/build.sh "3.9"
Expand All @@ -41,6 +36,11 @@ tasks:
cmds:
- ./scripts/build.sh "3.12"

builder-3.13:
desc: Build a docker environment with the right dependencies and utilities
cmds:
- ./scripts/build.sh "3.13"

check:
desc: Check the style, bug and quality of the code
deps: [about]
Expand Down
1 change: 0 additions & 1 deletion archivist/notebooks/Checking the Dog's Weight.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"from json import dumps as json_dumps\n",
"from os import getenv\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"from json import dumps as json_dumps\n",
"from os import getenv\n",
"\n",
Expand Down
1 change: 0 additions & 1 deletion archivist/notebooks/Feeding the Dog Hourly.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"from json import dumps as json_dumps\n",
"from os import getenv\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"from json import dumps as json_dumps\n",
"from os import getenv\n",
"\n",
Expand Down
1 change: 0 additions & 1 deletion archivist/notebooks/Feeding the Dog.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"from json import dumps as json_dumps\n",
"from os import getenv\n",
"\n",
Expand Down
1 change: 0 additions & 1 deletion archivist/notebooks/Playing Fetch Every 5 Minutes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"from json import dumps as json_dumps\n",
"from os import getenv\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"from json import dumps as json_dumps\n",
"from os import getenv\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"from json import dumps as json_dumps\n",
"from os import getenv\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"from json import dumps as json_dumps\n",
"from os import getenv\n",
"\n",
Expand Down
1 change: 0 additions & 1 deletion archivist/notebooks/Sharing Artist Asset with User.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"from json import dumps as json_dumps\n",
"from os import getenv\n",
"\n",
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"nbsphinx",
"sphinx_gallery.load_style",
"sphinx_rtd_theme",
"sphinxcontrib.googleanalytics",
"sphinxcontrib.spelling",
"sphinx.ext.autodoc",
"sphinx.ext.autosectionlabel",
Expand Down Expand Up @@ -62,6 +63,7 @@

source_suffix = [ '.md', '.rst']

googleanalytics_id = 'G-7K46H3KK7N' # Provided by Google in your dashboard
# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand All @@ -84,7 +86,6 @@

html_theme = 'sphinx_rtd_theme'
html_theme_options = {
'analytics_id': 'G-7K46H3KK7N', # Provided by Google in your dashboard
'logo_only': True,
}

Expand Down
2 changes: 1 addition & 1 deletion docs/features.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The definitive guide to the REST API is defined here: https://docs.datatrails.ai
This python SDK offers a number of advantages over a simple
REST api (in any language):

* versioned package for the python 3.8,3.9,3.10,3.11,3.12 ecosystem.
* versioned package for the python 3.9,3.10,3.11,3.12,3.13 ecosystems.
* automatic confirmation of assets and events: just set **confirm=True** when
creating the asset or event and a sophisticated retry and exponential backoff
algorithm will take care of everything (optional).
Expand Down
20 changes: 8 additions & 12 deletions docs/notebooks/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
#
# jupyter notebooks
#
# python 3.12 is unsupported as it reuires pyzmq 25.1.1 which
# is a dependency of notebook.
ipython~=8.12.3; python_version < '3.12'
# pin notebook at version 6. version7 does not support the various
# extensions - upgrade to notebook v7 is a future PR when
# it has stabilised.
notebook~=6.4; python_version < '3.12'
jupyter~=1.0; python_version < '3.12'
jupyter-console~=6.6; python_version < '3.12'
jupyter-contrib-nbextensions~=0.7; python_version < '3.12'
jupyter-nbextensions-configurator~=0.6; python_version < '3.12'
python-dotenv[cli]~=1.0; python_version < '3.12'
ipython~=8.13.0; python_version < '3.10'
ipython~=8.20; python_version >= '3.10'
notebook~=7.2
jupyter~=1.0
jupyter-console~=6.6
jupyter-contrib-nbextensions~=0.7
jupyter-nbextensions-configurator~=0.6
python-dotenv[cli]~=1.0

9 changes: 5 additions & 4 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#
# this is used for pushing to github pages
#
# sphinx 7.2 does not support 3.8
sphinx~=7.1
sphinx-rtd-theme~=1.3
sphinx~=7.4; python_version < '3.10'
sphinx~=8.1; python_version >= '3.10'
sphinx-rtd-theme~=3.0
sphinxcontrib-spelling~=8.0
sphinx-gallery~=0.14
sphinxcontrib-googleanalytics~=0.4
sphinx-gallery~=0.18
nbsphinx~=0.9

-r notebooks/requirements.txt
5 changes: 3 additions & 2 deletions functests/execattachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,9 @@ def test_attachment_upload_and_download_strict(self):
attachment = self.arch.attachments.upload(fd)
file_uuid = attachment["identity"]

with open(self.DATATRAILS_IMAGE_DOWNLOAD_PATH, "wb") as fd, self.assertRaises(
ArchivistBadRequestError
with (
open(self.DATATRAILS_IMAGE_DOWNLOAD_PATH, "wb") as fd,
self.assertRaises(ArchivistBadRequestError),
):
attachment = self.arch.attachments.download(
file_uuid, fd, params={"strict": "true"}
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
requires = [ "setuptools>=61.0", "wheel", "setuptools-git-versioning", ]
build-backend = "setuptools.build_meta"

[tool.black]
target-version = ["py39", "py310", "py311", "py312", "py313"]

[tool.coverage.report]
fail_under = 100
exclude_lines = [
Expand Down Expand Up @@ -260,6 +263,7 @@ valid-metaclass-classmethod-first-arg = ["cls"]

# Maximum number of arguments for function / method.
max-args = 7
max-positional-arguments = 6

# Maximum number of attributes for a class (see R0902).
max-attributes = 7
Expand Down
Loading

0 comments on commit fd4dcd0

Please sign in to comment.