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
5 changes: 3 additions & 2 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry==1.8.5
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- run: pipx inject poetry poetry-dynamic-versioning # https://github.com/python-poetry/poetry/issues/10028
- run: poetry install

- name: lint
Expand Down
24 changes: 5 additions & 19 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,17 @@ jobs:
steps:
- uses: actions/checkout@v4

- run: git fetch --prune --unshallow --tags

- run: pipx install poetry==1.8.5
- run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
cache: "poetry"

- run: poetry install
- run: pipx inject poetry poetry-dynamic-versioning # https://github.com/python-poetry/poetry/issues/10028

- run: poetry self add poetry-version-plugin
- run: poetry install

- run: poetry build

Expand Down Expand Up @@ -77,21 +75,11 @@ jobs:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v2.1.1
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'

publish-docs:
name: Publish documentation 📚 to GitHub Pages
Expand All @@ -105,9 +93,7 @@ jobs:
steps:
- uses: actions/checkout@v4

- run: git fetch --prune --unshallow --tags

- run: pipx install poetry==1.8.5
- run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry==1.8.5
run: pipx install poetry

- uses: actions/setup-python@v5
with:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,23 @@ jobs:
tests:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- run: pipx install poetry==1.8.5
- run: pipx install poetry

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

- run: pipx inject poetry poetry-dynamic-versioning # https://github.com/python-poetry/poetry/issues/10028

- run: poetry install

- name: Test (Linux or MacOS)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ An online version is generated and available [here](https://intercreate.github.i

### Install Dependencies

- poetry==1.8.5: https://python-poetry.org/docs/#installation
- poetry: https://python-poetry.org/docs/#installation

### Create the venv

Expand Down
1,500 changes: 784 additions & 716 deletions poetry.lock

Large diffs are not rendered by default.

59 changes: 45 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,55 @@
[tool.poetry]
[project]
name = "smpclient"
version = "0"
dynamic = ["version"]
description = "Simple Management Protocol (SMP) Client for remotely managing MCU firmware"
authors = [
"J.P. Hutchins <jphutchins@gmail.com>",
"J.P. Hutchins <jp@intercreate.io",
{ name = "JP Hutchins", email = "jphutchins@gmail.com" },
{ name = "JP Hutchins", email = "jp@intercreate.io" },
]
repository = "https://github.com/intercreate/smpclient"
documentation = "https://intercreate.github.io/smpclient"
readme = "README.md"
license = "Apache-2.0"
requires-python = ">=3.9,<3.14"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Topic :: Software Development :: Libraries",
"Framework :: AsyncIO",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
]

[project.urls]
Homepage = "https://www.intercreate.io"
Documentation = "https://intercreate.github.io/smpclient"
Repository = "https://github.com/intercreate/smpclient.git"
Issues = "https://github.com/intercreate/smpclient/issues"

[tool.poetry]
packages = [{ include = "smpclient" }]

[tool.poetry.scripts]
version = "0.0.0"
[project.scripts]
mcuimg = "smpclient.mcuboot:mcuimg"

[tool.poetry-version-plugin]
source = "git-tag"
[tool.poetry.requires-plugins]
poetry-dynamic-versioning = { version = ">=1.0.0,<2.0.0", extras = ["plugin"] }

[tool.poetry-dynamic-versioning]
strict = true
enable = true
vcs = "git"
style = "semver"
metadata = true
tagged-metadata = true
dirty = true
fix-shallow-repository = true
pattern = '(?P<base>\d+\.\d+\.\d+)'
format-jinja = "{% if distance == 0 %}{{ base }}{% else %}{{ base }}-dev{{ distance }}+g{{ commit }}{% endif %}{% if dirty %}.dirty{% endif %}"

[tool.poetry.dependencies]
python = ">=3.8.1, <3.14"
pyserial = "^3.5"
smp = "^3.1.1"
intelhex = "^2.3.0"
Expand All @@ -38,6 +68,7 @@ pytest-asyncio = "^0.23.2"
types-pyserial = "^3.5.0.11"
tox = "^4.15.0"
pydoclint = "^0.5.8"
poetry-dynamic-versioning = "^1.7.1"

[tool.poetry.group.doc.dependencies]
mkdocstrings = { extras = ["python"], version = "^0.26.1" }
Expand All @@ -50,7 +81,7 @@ smp = "^3.1.1"
[tool.black]
line-length = 100
skip-string-normalization = true
extend-exclude = "dutfirmware|.venv|tests/fixtures|.tox"
extend-exclude = "dutfirmware|.venv|tests/fixtures|.tox|.poetry"

[tool.isort]
profile = "black"
Expand All @@ -60,7 +91,7 @@ skip = [".venv", "dutfirmware", ".tox"]

[tool.mypy]
disallow_untyped_defs = true
exclude = ['.venv', 'dutfirmware', '.tox']
exclude = ['.venv', 'dutfirmware', '.tox', '.poetry']

[tool.pydoclint]
style = "google"
Expand Down Expand Up @@ -104,5 +135,5 @@ legacy_tox_ini = """
"""

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
build-backend = "poetry_dynamic_versioning.backend"
6 changes: 3 additions & 3 deletions tests/test_base64.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

from smpclient.transport.serial import _base64_cost, _base64_max

if not hasattr(random, 'randbytes'): # for python3.8
if not hasattr(random, 'randbytes'):
from os import urandom

def randbytes(n: int) -> bytes:
"""Generate `n` random bytes."""
return urandom(n)

random.randbytes = randbytes # type: ignore # for python3.8
random.randbytes = randbytes


def test_base64_sizing() -> None:
Expand All @@ -24,6 +24,6 @@ def test_base64_sizing() -> None:

for size in range(1, 0xFFFF):
assert 0 <= size - _base64_cost(_base64_max(size)) < 4
data = random.randbytes(_base64_max(size)) # type: ignore # for python3.8
data = random.randbytes(_base64_max(size))
encoded = b64encode(data)
assert 0 <= size - len(encoded) < 4
Loading