Skip to content

Commit

Permalink
Merge pull request #21 from savannahghi/develop
Browse files Browse the repository at this point in the history
release v1.0.1
  • Loading branch information
kennedykori committed Mar 21, 2024
2 parents 79db487 + 00aba16 commit d8805d5
Show file tree
Hide file tree
Showing 30 changed files with 427 additions and 500 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
strategy:
matrix:
python-version:
- "3.10"
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Set up project using python ${{ matrix.python-version }}
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
uses: actions/setup-python@v5
with:
cache: pip
python-version: "3.11"
python-version: "3.12"
- name: Install requirements
run: |
python -m pip install --upgrade pip
Expand Down
22 changes: 13 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -11,17 +11,21 @@ repos:
- id: check-vcs-permalinks
- id: check-yaml

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.292"
hooks:
- id: ruff
args: [ --fix, --exit-non-zero-on-fix ]

- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
rev: v3.15.1
hooks:
- id: pyupgrade
args: ["--py310-plus"]
args:
- --py311-plus

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.3.3
hooks:
- id: ruff
args:
- --fix
- --exit-non-zero-on-fix
- id: ruff-format

# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
ci:
Expand Down
41 changes: 31 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,38 @@
# SGHI Commons

[![CI](https://github.com/savannahghi/sghi-commons/actions/workflows/ci.yml/badge.svg)](https://github.com/savannahghi/sghi-commons/actions/workflows/ci.yml)
[![pyversion](https://camo.githubusercontent.com/64bafa7ada773716674e93fd8fbaa3f681e1748865cdcb47cc373579079b767f/68747470733a2f2f696d672e736869656c64732e696f2f707970692f707976657273696f6e732f7365747570746f6f6c732e737667)](https://camo.githubusercontent.com/64bafa7ada773716674e93fd8fbaa3f681e1748865cdcb47cc373579079b767f/68747470733a2f2f696d672e736869656c64732e696f2f707970692f707976657273696f6e732f7365747570746f6f6c732e737667)
[![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Coverage Status](https://coveralls.io/repos/github/savannahghi/sghi-commons/badge.svg?branch=develop)](https://coveralls.io/github/savannahghi/sghi-commons?branch=develop)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/savannahghi/sghi-commons/blob/main/LICENSE)
<h1 align="center" style="border-bottom: none; text-align: center;">SGHI Commons</h1>
<h3 align="center" style="text-align: center;">Collection of useful Python utilities.</h3>
<p align="center" style="text-align: center;">
<img alt="Python Version from PEP 621 TOML" src="https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fgithub.com%2Fsavannahghi%2Fsghi-commons%2Fraw%2Fdevelop%2Fpyproject.toml&logo=python&labelColor=white"/>
<a href="https://microsoft.github.io/pyright/">
<img alt="Checked with pyright" src="https://microsoft.github.io/pyright/img/pyright_badge.svg">
</a>
<a href="https://github.com/astral-sh/ruff">
<img alt="Ruff" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json">
</a>
<a href="https://github.com/pre-commit/pre-commit">
<img alt="pre-commit" src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white">
</a>
<a href="https://github.com/semantic-release/semantic-release">
<img alt="Semantic Release: conventionalcommits" src="https://img.shields.io/badge/semantic--release-conventionalcommits-e10079?logo=semantic-release"/>
</a>
<a href="https://github.com/savannahghi/sghi-commons/blob/develop/LICENSE">
<img alt="GitHub License" src="https://img.shields.io/badge/License-MIT-blue.svg">
</a>
</p>
<p align="center" style="text-align: center;">
<a href="https://github.com/savannahghi/sghi-commons/actions/workflows/ci.yml">
<img alt="CI" src="https://github.com/savannahghi/sghi-commons/actions/workflows/ci.yml/badge.svg">
</a>
<a href="https://coveralls.io/github/savannahghi/sghi-commons?branch=develop">
<img alt="Coverage Status" src="https://img.shields.io/coverallsCoverage/github/savannahghi/sghi-commons?branch=develop&logo=coveralls&link=https%3A%2F%2Fcoveralls.io%2Fgithub%2Fsavannahghi%2Fsghi-commons%3Fbranch%3Ddevelop">
</a>
</p>

---

A collection of utilities and reusable components used throughout our Python
projects. They include:

- Utilities for working with resources that require freeing or cleanup after use.
- Components for defining and accessing application configurations.
- A registry component for storing key-value pairs.
- A signal dispatcher inspired by [PyDispatch](https://grass.osgeo.org/grass83/manuals/libpython/pydispatch.html) and [Django Dispatch](https://docs.djangoproject.com/en/dev/topics/signals/).
Expand Down
14 changes: 14 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## [1.0.1-dev.2](https://github.com/savannahghi/sghi-commons/compare/v1.0.1-dev.1...v1.0.1-dev.2) (2024-03-20)


### Bug Fixes

* **types:** typing on `Comparable` related checkers ([#20](https://github.com/savannahghi/sghi-commons/issues/20)) ([7a741a8](https://github.com/savannahghi/sghi-commons/commit/7a741a8c132f38d753959bdf3fc3edc4ea5f02e0))

## [1.0.1-dev.1](https://github.com/savannahghi/sghi-commons/compare/v1.0.0...v1.0.1-dev.1) (2024-03-20)


### Dependency Updates

* **deps:** add py3.12 support and drop py3.10 ([#13](https://github.com/savannahghi/sghi-commons/issues/13)) ([a763136](https://github.com/savannahghi/sghi-commons/commit/a763136074b61fa7822696ef657b589a4f448b42))

## [1.0.0](https://github.com/savannahghi/sghi-commons/compare/...v1.0.0) (2024-03-20)


Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
("py:class", "sghi.task._IT"), # private type annotations
("py:class", "sghi.task._OT"), # private type annotations
("py:class", "sghi.utils.checkers._Comparable"), # private type annotations
("py:class", "sghi.utils.checkers._CT"), # private type annotations
("py:class", "sghi.utils.checkers._ST"), # private type annotations
("py:class", "sghi.utils.checkers._T"), # private type annotations
("py:class", "sghi.utils.module_loading._T"), # private type annotations
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sghi-commons",
"version": "1.0.0",
"version": "1.0.1-dev.2",
"description": "Collection of utilities and reusable components used throughout our Python projects.",
"directories": {
"doc": "docs"
Expand Down
73 changes: 42 additions & 31 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools~=68.2.0",
"setuptools_scm[toml]~=7.1.0"
"setuptools~=69.2.0",
"setuptools_scm[toml]~=8.0.4"
]

[project]
Expand All @@ -23,8 +23,8 @@ classifiers = [
"Typing :: Typed"
]
dependencies = [
"importlib-metadata>=6.8.0",
"typing-extensions>=4.7",
"importlib-metadata>=7.0.2",
"typing-extensions>=4.10.0",
]
description = "A collection of utilities used throughout SGHI's Python projects."
dynamic = ["version"]
Expand All @@ -36,22 +36,22 @@ maintainers = [
]
name = "sghi-commons"
readme = "README.md"
requires-python = ">=3.10" # Support Python 3.10+.
requires-python = ">=3.11" # Support Python 3.11+.

[project.optional-dependencies]
dev = [
"pre-commit~=3.4.0",
"pre-commit~=3.6.2",
]

docs = [
"furo==2023.8.19",
"furo==2024.1.29",
"jaraco.packaging~=9.4.0",
"rst.linker~=2.4.0",
"Sphinx~=7.2.5",
"Sphinx~=7.2.6",
"sphinx-favicon~=1.0.1",
"sphinx-hoverxref~=1.3.0",
"sphinx-inline-tabs~=2023.4.21",
"sphinx-lint~=0.6.8",
"sphinx-lint~=0.9.1",
"sphinx-notfound-page~=1.0.0",
]

Expand All @@ -60,16 +60,15 @@ test = [
"coveralls~=3.3.1",
"factory-boy~=3.3.0",
"packaging",
"pyright>=1.1.325",
"pytest~=7.4.1",
"pyright>=1.1.354",
"pytest~=8.1.1",
"pytest-cov~=4.1.0",
"pytest-forked~=1.6.0",
"pytest-sugar~=0.9.7",
"pytest-xdist~=3.3.1",
"ruff~=0.0.292",
"tomli~=2.0.1",
"tox~=4.11.1",
"tox-gh-actions~=3.1.3",
"pytest-sugar~=1.0.0",
"pytest-xdist~=3.5.0",
"ruff~=0.3.3",
"tox~=4.14.1",
"tox-gh-actions~=3.2.0",
]

[project.urls]
Expand All @@ -80,7 +79,7 @@ repository = "https://github.com/savannahghi/sghi-commons.git"

[tool.black]
line-length = 79
target-version = ["py310"]
target-version = ["py311"]

[tool.coverage.html]
directory = "coverage"
Expand Down Expand Up @@ -110,7 +109,6 @@ show_missing = true
[tool.coverage.run]
branch = true
omit = [".tox/*", "docs/*", "test/*"]
# include = ["src/**/*.py"]

[tool.isort]
extend_skip = "docs"
Expand Down Expand Up @@ -153,7 +151,7 @@ strictSetInference = true
typeCheckingMode = "basic"

[tool.pytest.ini_options]
addopts = "--cov=sghi --cov-fail-under=100 --cov-report=html --cov-report=term-missing -n auto --junitxml='junitxml_report/report.xml' -vv --durations=10 --cache-clear"
addopts = "--cov=src/sghi --cov-fail-under=100 --cov-report=html --cov-report=term-missing -n auto --junitxml='junitxml_report/report.xml' -vv --durations=10 --cache-clear"
console_output_style = "progress"
log_cli = 1
log_cli_date_format = "%Y-%m-%d %H:%M:%S"
Expand Down Expand Up @@ -181,15 +179,29 @@ exclude = [
"node_modules",
"venv",
]
line-length = 79
src = ["src", "test"]
target-version = "py311"

[tool.ruff.format]
docstring-code-format = true
indent-style = "space"
quote-style = "double"
skip-magic-trailing-comma = false

[tool.ruff.lint]
ignore = [
"ANN002",
"ANN003",
"ANN101",
"ANN102",
"ANN204",
"S101"
"COM812",
"D203",
"D213",
"ISC001",
"S101",
]
line-length = 79
select = [
"A", # flake8-builtins
"ANN", # flake8-annotations
Expand Down Expand Up @@ -222,17 +234,15 @@ select = [
"W", # pycodestyle Warning
"YTT", # flake8-2020
]
src = ["src", "test"]
target-version = "py310"

[tool.ruff.flake8-quotes]
[tool.ruff.lint.flake8-quotes]
inline-quotes = "double"
docstring-quotes = "double"

[tool.ruff.isort]
[tool.ruff.lint.isort]
known-first-party = ["src", "test"]

[tool.ruff.mccabe]
[tool.ruff.lint.mccabe]
max-complexity = 10

[tool.setuptools]
Expand All @@ -248,7 +258,7 @@ root = "."
[tool.tox]
legacy_tox_ini = """
[tox]
env_list = {py310, py311}, coveralls, docs, package
env_list = {py311, py312}, coveralls, docs, package
isolated_build = true
no_package = false
requires =
Expand All @@ -258,13 +268,14 @@ legacy_tox_ini = """
[gh-actions]
python =
3.10: py310
3.11: py311, coveralls, docs, package
3.11: py311
3.12: py312, coveralls, docs, package
[testenv]
commands =
ruff .
ruff check .
ruff format --check .
pyright .
coverage erase
pytest {posargs:.}
Expand Down
4 changes: 2 additions & 2 deletions src/sghi/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""
Global state definitions for SGHI applications.
"""Global state definitions for SGHI applications.
This module defines global properties important to an application. For all
intents and purposes, these properties should be treated and thought of as
Expand All @@ -14,6 +13,7 @@
first use. Whether multiple calls to the ``setup`` should be allowed is not
defined and is left to the application implementors to decide.
"""

from collections.abc import Mapping, Sequence
from typing import Any, Final

Expand Down
Loading

0 comments on commit d8805d5

Please sign in to comment.