Skip to content
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
42 changes: 10 additions & 32 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
---
name: build

# -----------------
# Control variables (GitHub Secrets)
# -----------------
#
# At the GitHub 'organisation' or 'project' level you must have the following
# GitHub 'Repository Secrets' defined (i.e. via 'Settings -> Secrets'): -
#
# (none)
#
# -----------
# Environment (GitHub Environments)
# -----------
#
# Environment (none)

on:
push:
branches:
Expand All @@ -32,30 +17,23 @@ jobs:
strategy:
matrix:
python-version:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
- '3.14'
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install requirements
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build
pip install -r requirements.txt
pip install -r build-requirements.txt
run: pip install uv
- name: Static Analysis
run: |
pre-commit run --all-files
pyroma .
uv run pre-commit run --all-files
- name: Build
run: |
python -m build --sdist --wheel --outdir dist/
run: uv build
- name: Compile Documentation
run: |
pip install -r docs-requirements.txt
sphinx-build -b html docs _readthedocs/html/
env:
PYTHONPATH: ./src
run: uv run sphinx-build -b html docs _readthedocs/html/
59 changes: 33 additions & 26 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,52 @@
---
name: publish

# Actions for any tag.

# -----------------
# Control variables (GitHub Secrets)
# -----------------
#
# None
#
# -----------
# Environment (GitHub Environments)
# -----------
#
# Environment (none)
# Publish the application to PyPI
name: publish

on:
push:
tags:
- '**'

jobs:
build-and-publish:
build:
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
uses: rlespinasse/github-slug-action@v5
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build
python-version: '3.14'
- name: Install build dependencies
run: pip install uv
- name: Build
run: |
python -m build --sdist --wheel --outdir dist/
uv version $GITHUB_REF_SLUG
uv build
- name: Store the distribution
uses: actions/upload-artifact@v5
with:
name: python-package-distribution
path: dist/

publish:
name: Publish to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/im-squonk2-client
permissions:
id-token: write
steps:
- name: Download distribution
uses: actions/download-artifact@v6
with:
name: python-package-distribution
path: dist/
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 0 additions & 2 deletions .mypy.ini

This file was deleted.

59 changes: 24 additions & 35 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
minimum_pre_commit_version: 2.20.0
minimum_pre_commit_version: 4.5.1
exclude: ^(docs|tests)

repos:
Expand All @@ -9,7 +9,7 @@ repos:

# Conventional Commit message checker (commitizen)
- repo: https://github.com/commitizen-tools/commitizen
rev: v2.28.1
rev: v4.13.9
hooks:
- id: commitizen
stages:
Expand All @@ -20,7 +20,7 @@ repos:

# Standard pre-commit rules
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v6.0.0
hooks:
- id: check-case-conflict
- id: check-executables-have-shebangs
Expand All @@ -30,39 +30,28 @@ repos:
- id: trailing-whitespace
args:
- --markdown-linebreak-ext=md
# Black (uncompromising) Python code formatter
- repo: https://github.com/psf/black
rev: 24.2.0

# Checking packaging
- repo: https://github.com/regebro/pyroma
rev: 5.0.1
hooks:
- id: black
args:
- --target-version
- py310
# MyPy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
- id: pyroma

# Ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.6
hooks:
- id: mypy
files: ^src
- id: ruff-check
args:
- --ignore-missing-imports
additional_dependencies:
- types-protobuf
- types-PyYAML
- types-python-dateutil
- types-pytz
- types-requests
# Pylint
# To check import errors we need to install every package
# used by the DM. This is often impractical on the client,
# and so we disable import errors on pre-commit and rely
# on this category of test in the CI stage. Consequently,
# pylint may pass on pre-commit but fail in CI - but at least
# the user has done 90% of the lint checks before the code
# hits the server.
- repo: https://github.com/pycqa/pylint
rev: v3.1.0
- --fix
- id: ruff-format

# Ty (Experimental)
- repo: local
hooks:
- id: pylint
args:
- --disable=import-error
- id: ty
name: ty check
entry: ty check .
language: system
pass_filenames: false
always_run: true
12 changes: 0 additions & 12 deletions .pylintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ version: 2
build:
os: ubuntu-20.04
tools:
python: "3.10"
python: "3.11"
commands:
- pip install --upgrade pip
- pip install -r requirements.txt
Expand Down
23 changes: 12 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,40 @@ The project uses: -
- [pre-commit] to enforce linting of files prior to committing them to the
repository
- [Commitizen] to enforce a [Convention Commit] commit message format
- [Black] as a code formatter
- [ruff] as a code linter and formatter
- [uv] for project management

You **MUST** comply with these choices in order to contribute to the project.

To get started review the pre-commit utility and the conventional commit style
and then set-up your local clone by following the **Installation** and
**Quick Start** sections: -

pip install --upgrade pip
pip install -r build-requirements.txt
pre-commit install -t commit-msg -t pre-commit
uv venv
uv sync --group dev
uv run pre-commit install -t commit-msg -t pre-commit

Now the project's rules will run on every commit, and you can check the
current health of your clone with: -

pre-commit run --all-files
uv run pre-commit run --all-files

## Local Development
You can build and install the package locally using the same process used
by the GitHib Actions: -

pip install build
rm -rf /dist/*
python -m build --sdist --wheel --outdir dist/
pip install dist/im-squonk2-client-*.tar.gz
rm -rf dist/*
uv build
pip install dist/im_squonk2_client-*.tar.gz

And then uninstall using pip: -

pip uninstall -y im-squonk2-client
pip uninstall im-squonk2-client -y

---

[black]: https://black.readthedocs.io/en/stable
[ruff]: https://docs.astral.sh/ruff
[commitizen]: https://commitizen-tools.github.io/commitizen/
[conventional commit]: https://www.conventionalcommits.org/en/v1.0.0/
[pre-commit]: https://pre-commit.com
[uv]: https://docs.astral.sh/uv/
4 changes: 0 additions & 4 deletions build-requirements.txt

This file was deleted.

3 changes: 0 additions & 3 deletions docs-requirements.txt

This file was deleted.

24 changes: 12 additions & 12 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,31 @@
#
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
sys.path.append(os.path.abspath(
os.path.join(os.path.dirname(__file__), "../src")
))

sys.path.insert(0, os.path.abspath(".."))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../src")))

# -- Project information -----------------------------------------------------

project = 'Squonk2 Python Client'
copyright = '2022, Alan Christie'
author = 'Alan Christie'
project = "Squonk2 Python Client"
copyright = "2022, Alan Christie"
author = "Alan Christie"

# The full version, including alpha/beta/rc tags
release = '1.0'
release = "1.0"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
extensions = [
"sphinx.ext.autodoc",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand All @@ -49,9 +49,9 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path = ["_static"]
3 changes: 2 additions & 1 deletion examples/calc_rdkit_props.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'https://data-manager.xchem-dev.diamond.ac.uk/data-manager-api' or set the
API URL programmatically with a call to DmApi.set_api_url().
"""

import os
import sys
import time
Expand Down Expand Up @@ -89,7 +90,7 @@

# We can now use the 'task_id' to query the state of the running Job
# (an instance). When we receive 'done' the Job's finished.
ITERATIONS = 0
ITERATIONS = 0 # pylint: disable=invalid-name
while True:
if ITERATIONS > 10:
print("TIMEOUT")
Expand Down
4 changes: 2 additions & 2 deletions examples/get_token.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
"""Get and print a Squonk2 access token.
"""
"""Get and print a Squonk2 access token."""

import argparse
import os

Expand Down
Loading