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
32 changes: 22 additions & 10 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
# Release Process

1. Write NEWS entries in the same format as usual.
## Pre-Release

git shortlog 0.6.0.. | grep -i -v trivial | grep -v Merge > NEWS.new
Write NEWS entries in the same format as usual:

git shortlog <last-tag>.. | grep -i -v trivial | grep -v Merge > NEWS.new
# add entries to ./docs/source/versionhistory.rst

Commit changes to git:
## Release

Commit changes and create an annotated git tag
(package version is auto-derived from the tag):

# MAKE SURE THAT setup.py IS ALSO CORRECT
export release_ver="0.6.1"
git commit -a -m "Release ${release_ver}"
git tag -s -f -m "Release ${release_ver}" "${release_ver}"
git commit -a -m "Release X.Y.Z"
git tag -s -m "Release X.Y.Z" X.Y.Z
rm -rf dist/
make pkg
./env/bin/twine upload dist/uswid-${release_ver}*
./env/bin/twine upload dist/uswid-*
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

## Post-Release

Do post release version bump in setup.py:
Push commits and tags:

git commit -a -m "trivial: post release version bump"
git push
git push --tags

## Notes

- Version is automatically derived from git tags using setuptools_scm
- `uswid/_version.py` is generated at build time
- No manual version updates are required
- Release flow: commit → tag → build → upload
42 changes: 42 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[build-system]
requires = [
"setuptools>=77",
"setuptools-scm>=8",
]
build-backend = "setuptools.build_meta"

[project]
name = "uswid"
authors = [{name = "Richard Hughes", email = "richard@hughsie.com"}]
license = "BSD-2-Clause-Patent"
license-files = ["LICENSE"]
keywords = ["swid", "sbom", "coswid"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Topic :: Utilities",
"Topic :: System :: Archiving",
]
description = "A pure-python library for embedding CoSWID data"
readme = "README.md"
dependencies = [
"cbor2",
"lxml",
"pefile",
"importlib-metadata >= 1.0 ; python_version < '3.8'",
]
dynamic = [
"version",
]
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

[project.urls]
Homepage = "https://github.com/hughsie/python-uswid"

[project.scripts]
uswid = "uswid.cli:main"

[tool.setuptools_scm]
version_scheme = "guess-next-dev"
local_scheme = "no-local-version"
version_file = "uswid/_version.py"
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

setup(
name="uswid",
version="0.6.1",
license="BSD-2-Clause-Patent",
license_files=[
"LICENSE",
Expand Down
16 changes: 16 additions & 0 deletions uswid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 Richard Hughes <richard@hughsie.com>
# (c) Copyright 2026 HP Development Company, L.P.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent

try:
from ._version import version as __version__
except (ImportError, AttributeError):
__version__ = "0.0.0+unknown"
else:
if __version__ == "0.0.0":
try:
from importlib.metadata import PackageNotFoundError, version as _meta_version
except ImportError:
from importlib_metadata import PackageNotFoundError, version as _meta_version

try:
__version__ = _meta_version("uswid")
except PackageNotFoundError:
__version__ = "0.0.0+unknown"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
from uswid.container import uSwidContainer
from uswid.link import uSwidLink, uSwidLinkRel, uSwidLinkUse
from uswid.hash import uSwidHash, uSwidHashAlg
Expand Down
8 changes: 8 additions & 0 deletions uswid/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This file is generated by setuptools_scm at build time.
# Do not edit manually.
#
# When building from a git tag, this will contain the exact
# released version (e.g. "0.6.0").
# On development branches, this will be a ".devN" version.

version = "0.0.0"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
4 changes: 3 additions & 1 deletion uswid/format_cyclonedx.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import uuid
from datetime import datetime, timezone

from uswid import __version__

from .container import uSwidContainer
from .format import uSwidFormatBase
from .component import uSwidComponent, uSwidComponentType
Expand Down Expand Up @@ -346,7 +348,7 @@ def save(self, container: uSwidContainer) -> bytes:

# generator
metadata["tools"] = [
{"vendor": "uSWID Authors", "name": "uSWID", "version": "0.4.0"}
{"vendor": "uSWID Authors", "name": "uSWID", "version": __version__}
]
if metadata_authors:
data_metadata_authors: List[Dict[str, str]] = []
Expand Down
5 changes: 3 additions & 2 deletions uswid/test_uswid.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# allows us to run this from the project root
sys.path.append(os.path.realpath("."))

from . import __version__ as tool_version
from .container import uSwidContainer
from .errors import NotSupportedError
from .link import uSwidLink, uSwidLinkRel
Expand Down Expand Up @@ -190,7 +191,7 @@ def test_format_inf(self):
{
"vendor": "uSWID Authors",
"name": "uSWID",
"version": "0.4.0"
"version": "@USWID_VERSION@"
}
],
"authors": [
Expand Down Expand Up @@ -283,7 +284,7 @@ def test_format_inf(self):
"dependsOn": "pkg:github/tianocore/edk2@202411#BaseLib"
}
]
}""",
}""".replace("@USWID_VERSION@", tool_version),
)

def test_vcs_verfmt(self):
Expand Down
Loading