From 6c15526d852cbf805cb9205237abbb3a92cc53ba Mon Sep 17 00:00:00 2001 From: Marvin Klerx Date: Wed, 14 Jan 2026 22:14:03 +0100 Subject: [PATCH 1/2] switch to hatchling build system --- .github/workflows/build.yml | 65 ++++++++++++++++++++++++----------- .github/workflows/release.yml | 4 +-- pyproject.toml | 62 +++++++++++++++++++++++++++------ 3 files changed, 97 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a99cfb..8a350f7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,15 +30,36 @@ jobs: with: python-version: '3.12' - - name: Install Build Dependencies - run: | - python -m pip install --upgrade pip - pip install build ruff pytest + - name: Install Hatch + run: pip install hatch - - name: Lint with Ruff - run: ruff check . + - name: Install dependencies + run: hatch env create dev - test-build: + - name: Run ruff lint + run: hatch run dev:lint + + run-acceptance-tests: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Hatch + run: pip install hatch + + - name: Install dependencies + run: hatch env create dev + + - name: Run ruff lint + run: hatch run dev:atest + + test-python-compatibility: runs-on: ubuntu-latest strategy: matrix: @@ -52,19 +73,21 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install Build Dependencies - run: | - python -m pip install --upgrade pip - pip install build pytest - - - name: Build Package - run: python -m build - - - name: Test CLI Command - run: | - pip install . - testdoc --help + - name: Install Hatch + run: pip install hatch + + - name: Install dependencies + run: hatch env create dev + + - name: Build wheel with Hatch + run: hatch build + + - name: Install built wheel + run: pip install dist/*.whl + + - name: Test import + run: python -c "import testdoc" - - name: Run Unit Tests - run: pytest atest/ + - name: Verify CLI usage + run: testdoc --help | grep -q "Welcome to robotframework-testdoc" || exit 1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 45b5dd1..d24036b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,10 +38,10 @@ jobs: python-version: '3.12' - name: Install Hatch - run: pip install twine build + run: pip install twine hatch - name: Build package - run: python -m build + run: hatch build - name: Publish to PyPI env: diff --git a/pyproject.toml b/pyproject.toml index 027992d..34a1ef6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,13 @@ [build-system] -requires = ["setuptools", "setuptools_scm"] -build-backend = "setuptools.build_meta" +requires = ["hatchling"] +build-backend = "hatchling.build" [project] name = "robotframework-testdoc" dynamic = ["version"] description = "A CLI Tool to generate a Test Documentation for your RobotFramework Test Scripts." readme = "README.md" -requires-python = ">=3.7" +requires-python = ">=3.9" authors = [ { name = "Marvin Klerx", email = "marvinklerx20@gmail.com" } ] @@ -16,7 +16,6 @@ license = { text = "Apache-2.0" } classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python", -# "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -30,6 +29,16 @@ dependencies = [ "tomli" ] +[project.optional-dependencies] +dev = [ + "hatch", + "ruff", + "pytest", + "pre-commit", + "mypy", + "robotframework-robocop" +] + [project.scripts] testdoc = "testdoc.cli:main" @@ -37,15 +46,46 @@ testdoc = "testdoc.cli:main" Repository = "https://github.com/MarvKler/robotframework-testdoc" Issues = "https://github.com/MarvKler/robotframework-testdoc/issues" -[tool.setuptools] -include-package-data = true -[tool.setuptools.package-data] -"testdoc" = [ - "html/images/*.svg", - "html/templates/**/*.html", - "default.toml" +[tool.hatch.build.targets.wheel] +require-runtime-dependencies = true +only-include = ["src/testdoc"] +sources = ["src"] +include = [ + "src/testdoc/html/images/*.svg", + "src/testdoc/html/templates/**/*.html", + "src/testdoc/default.toml", +] + +[tool.hatch.build.targets.sdist] +include = [ + "src/testdoc/html/images/*.svg", + "src/testdoc/html/templates/**/*.html", + "src/testdoc/default.toml", + "README.md", +] + +[tool.hatch.version] +path = "src/testdoc/__about__.py" + +[tool.hatch.build] +dev-mode-dirs = ["src"] + +[tool.hatch.envs.types] +extra-dependencies = [ + "mypy>=1.0.0", +] +[tool.hatch.envs.types.scripts] +check = "mypy --install-types --non-interactive {args:src/Tables tests}" + +[tool.hatch.envs.dev] +dependencies = [ + "ruff", + "pytest" ] +[tool.hatch.envs.dev.scripts] +lint = "ruff check ." +atest = "pytest atest/" [tool.ruff] line-length = 150 From 4237e5960617c9839b10ed121914ca7ca307dca3 Mon Sep 17 00:00:00 2001 From: Marvin Klerx Date: Wed, 14 Jan 2026 22:17:17 +0100 Subject: [PATCH 2/2] version check --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a350f7..b88fefe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -88,6 +88,9 @@ jobs: - name: Test import run: python -c "import testdoc" + - name: Check version + run: hatch version + - name: Verify CLI usage run: testdoc --help | grep -q "Welcome to robotframework-testdoc" || exit 1