Skip to content
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Check out the repository
uses: actions/checkout@v6
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: '3.x'
- name: Install dependencies
Expand All @@ -55,9 +55,9 @@ jobs:
needs: build-test
steps:
- name: Check out the repository
uses: actions/checkout@v6
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ jobs:
Write-Host "GITHUB_PATH: $env:PATH"
Write-Host "CAIROCFFI_DLL_DIRECTORIES: $env:CAIROCFFI_DLL_DIRECTORIES"
- name: Check out the repository
uses: actions/checkout@v6
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/documentation_testbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ jobs:
Write-Host "GITHUB_PATH: $env:PATH"
Write-Host "CAIROCFFI_DLL_DIRECTORIES: $env:CAIROCFFI_DLL_DIRECTORIES"
- name: Check out the repository
uses: actions/checkout@v6
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v6
uses: actions/checkout@v7
- name: Run Labeler
uses: crazy-max/ghaction-github-labeler@v6.0.0
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ jobs:
strategy:
matrix:
os: [ windows-latest ]
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
python-version: [ '3.11', '3.12', '3.13', '3.14' ]
runs-on: ${{ matrix.os }}
steps:
- name: Check out the repository
uses: actions/checkout@v6
uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ build-backend = "hatchling.build"
name = "utils-COMobjects"
description = "Package with various utilities to support COM object development with Python based on PyWin32"
readme = "README.md"
requires-python = ">=3.10"
requires-python = ">=3.11"
# only license identifier from https://spdx.org/licenses/ are allowed
license = { text = "GPL-3.0-only" }
# keywords for easier look-up on PyPI
Expand All @@ -26,7 +26,6 @@ authors = [
# options under https://pypi.org/classifiers/
classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
Expand Down Expand Up @@ -111,8 +110,8 @@ bump_map = {"feat" = "MINOR", "fix" = "PATCH", "BREAKING CHANGE" = "MAJOR"}
# with Initial Commit in changelog
commit_parser ="^(?P<change_type>[Ii]nitial [Cc]ommit|feat|fix|refactor|perf|docs|style|test|chore|build|ci|revert|BREAKING CHANGE)(\\((?P<scope>[^)]+)\\))?(:\\s(?P<message>.*))?"
changelog_pattern = "^([Ii]nitial [Cc]ommit|feat|fix|docs|style|refactor|perf|test|chore|build|ci|revert|BREAKING CHANGE).*"
change_type_map = { feat = "Features", fix = "Bug fixes", refactor = "Refactoring", perf = "performance improvements", docs = "Documentation", style = "Code style", test = "Testing", chore = "Chores", build = "Build system", ci = "Continuous Integration" }
change_type_order = ["BREAKING CHANGE", "feat", "fix", "refactor", "perf", "docs", "style", "test", "chore", "build", "ci"]
change_type_map = { feat = "Features", fix = "Bug fixes", refactor = "Code refactoring", perf = "Performance improvements", docs = "Documentation", style = "Code style", test = "Testing", chore = "Chores", build = "Build system", ci = "Continuous Integration" }
change_type_order = ["BREAKING CHANGE", "Features", "Bug fixes", "Code refactoring", "Performance improvements", "Documentation", "Code style", "Testing", "Chore", "Build System", "Continuous Integration", "Initial Commit"]


##################
Expand Down Expand Up @@ -327,7 +326,7 @@ debug = "cov --no-cov -s --pdb --pdbcls=IPython.core.debugger:Pdb {args}"
# Hatch testing environment matrix for various Python versions replacing the functionality of tox
[[tool.hatch.envs.test.matrix]]
template = ["test"]
python = ["3.10", "3.11", "3.12", "3.13", "3.14"]
python = ["3.11", "3.12", "3.13", "3.14"]

# Hatch default linting environment for "hatch fmt"
[tool.hatch.envs.hatch-static-analysis]
Expand Down
22 changes: 16 additions & 6 deletions src/utils_COMobjects/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@

# ruff and mypy per file settings
# others
# ruff: noqa: PLC0415
# ruff: noqa: E302, PLC0415

# fmt: off


def _get_hatch_version():
"""Compute the most up-to-date version number in a development environment.

Returns `None` if Hatchling is not installed, e.g. in a production environment.

For more details, see <https://github.com/maresb/hatch-vcs-footgun-example/>.
"""
import os
# preparation for Pathlib
# from pathlib import path

try:
from hatchling.metadata.core import ProjectMetadata
Expand All @@ -33,9 +33,19 @@ def _get_hatch_version():
err_msg = "pyproject.toml not found although hatchling is installed"
raise RuntimeError(err_msg)
root = os.path.dirname(pyproject_toml)
metadata = ProjectMetadata(root=root, plugin_manager=PluginManager())
# Version can be either statically set in pyproject.toml or computed dynamically:
return metadata.core.version or metadata.hatch.version.cached
# preparation for Pathlib
# root = Path(pyproject_toml).parent
# Temporarily set cwd to project root for PEP 517 compliance.
old_cwd = os.getcwd()
# preparation for Pathlib
# old_cwd = Path.cwd()
os.chdir(root)
try:
metadata = ProjectMetadata(root=str(root), plugin_manager=PluginManager())
# Version can be static in pyproject.toml or computed dynamically:
return metadata.core.version or metadata.hatch.version.cached
finally:
os.chdir(old_cwd)


def _get_importlib_metadata_version():
Expand Down