Skip to content

Commit fb73697

Browse files
authored
bug - 236: fix CI issues (#237)
## Summary This PR fixes the GitHub Actions test failures caused by Hatch 1.16.1's stricter enforcement of PEP 503 normalization. ## Changes - **pyproject.toml**: Renamed `async_http` to `async-http` in `[project.optional-dependencies]` to comply with PEP 503 normalization - **makefile**: Added `make hatch-upgrade` command to help developers upgrade Hatch to match CI version - **docs/releases/0.11.md**: Added bugfix entry documenting the issue and fix ## Problem All GitHub Actions test workflows were failing with: ``` ValueError: Feature `async-http` of field `tool.hatch.envs.hatch-test.py3.X-pysparkY.features` is not defined in the dynamic field `project.optional-dependencies` ``` ## Root Cause - GitHub Actions uses Hatch 1.16.1 which enforces PEP 503 normalization (underscores → hyphens) - Local environments using Hatch 1.14.1 didn't enforce this, causing tests to pass locally but fail in CI - The `async_http` feature was being normalized to `async-http` during validation but the definition used an underscore ## Testing - Upgraded local Hatch to 1.16.1 - Verified tests now pass with the fix: `hatch test --python=3.12 -i version=pyspark352r` - The `async_http` tests are passing successfully ## Impact This unblocks all PRs and restores CI functionality. The fix aligns with Python packaging standards (PEP 503). Fixes #236 --------- Co-authored-by: Danny Meijer <10511979+dannymeijer@users.noreply.github.com>
1 parent e5636b5 commit fb73697

4 files changed

Lines changed: 42 additions & 15 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,9 @@ jobs:
7070
matrix:
7171
# os: [ubuntu-latest, windows-latest, macos-latest] # FIXME: Add Windows and macOS
7272
os: [ubuntu-latest]
73-
python-version: ['3.9', '3.10', '3.11', '3.12']
73+
python-version: ['3.10', '3.11', '3.12']
7474
pyspark-version: ['33', '34', '35', '35r', '352', '352r']
7575
exclude:
76-
- python-version: '3.9'
77-
pyspark-version: '35'
78-
- python-version: '3.9'
79-
pyspark-version: '352'
80-
- python-version: '3.9'
81-
pyspark-version: '35r'
82-
- python-version: '3.9'
83-
pyspark-version: '352r'
8476
- python-version: '3.10'
8577
pyspark-version: '352'
8678
- python-version: '3.10'

docs/releases/0.11.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,21 @@ For users currently using v0.10, no breaking changes have been introduced. This
3636

3737
<small> by @dannymeijer </small>
3838

39+
!!! bug "bugfix - PR [#237](https://github.com/Nike-Inc/koheesio/pull/237), related issue [#236](https://github.com/Nike-Inc/koheesio/issues/236)"
40+
#### *Build/CI*: Fix PEP 503 normalization for optional dependencies
41+
42+
Fixed GitHub Actions test failures caused by Hatch 1.16.1's stricter enforcement of PEP 503 package name normalization.
43+
44+
**Root Cause:**
45+
Hatch 1.16.1 (used in GitHub Actions) enforces PEP 503 normalization which converts underscores to hyphens in package extra names. The `async_http` optional dependency in `pyproject.toml` was being normalized to `async-http` when Hatch validated the features list, but the definition still used `async_http`, causing a mismatch.
46+
47+
**Fix:**
48+
- Renamed `async_http` to `async-http` in `[project.optional-dependencies]` to match PEP 503 normalization
49+
- Added `make hatch-upgrade` command to help developers keep their Hatch version aligned with CI
50+
- Added delta-spark version constraints per PySpark version to prevent incompatibility issues
51+
52+
**Impact:**
53+
All GitHub Actions test workflows were failing across all Python and PySpark version combinations. This prevented any PRs from being merged. The fix aligns with Python packaging standards and ensures local development environments can match CI behavior.
54+
55+
<small> by @dannymeijer </small>
56+

makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,24 @@ hatch-install:
4141
fi
4242
init: hatch-install
4343

44+
.PHONY: hatch-upgrade ## setup - Upgrade Hatch to the latest version
45+
hatch-upgrade:
46+
@echo "Upgrading Hatch..."
47+
@if command -v brew >/dev/null 2>&1 && brew list hatch >/dev/null 2>&1; then \
48+
echo "Upgrading via Homebrew..."; \
49+
brew upgrade hatch; \
50+
elif command -v pipx >/dev/null 2>&1; then \
51+
echo "Upgrading via pipx..."; \
52+
pipx upgrade hatch; \
53+
elif command -v pip >/dev/null 2>&1; then \
54+
echo "Upgrading via pip..."; \
55+
pip install --upgrade hatch; \
56+
else \
57+
echo "Could not find hatch installation method. Please upgrade manually."; \
58+
exit 1; \
59+
fi
60+
@hatch --version
61+
4462
.PHONY: sync ## hatch - Update dependencies if you changed project dependencies in pyproject.toml
4563
.PHONY: update ## hatch - alias for sync (if you are used to poetry, thi is similar to running `poetry update`)
4664
sync:

pyproject.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ classifiers = [
2929
"Natural Language :: English",
3030
"Operating System :: OS Independent",
3131
"Programming Language :: Python",
32-
"Programming Language :: Python :: 3.9",
3332
"Programming Language :: Python :: 3.10",
3433
"Programming Language :: Python :: 3.11",
3534
"Programming Language :: Python :: 3.12",
@@ -55,7 +54,7 @@ Project = "https://github.com/orgs/Nike-Inc/projects/4"
5554

5655
[project.optional-dependencies]
5756
async = ["nest-asyncio>=1.6.0"]
58-
async_http = [
57+
async-http = [
5958
"aiohttp[speedups]>=3.9.5",
6059
"aiohttp-retry>=2.8.3",
6160
"nest-asyncio>=1.6.0",
@@ -267,10 +266,6 @@ cov-combine = "coverage combine"
267266
cov-report = "coverage report"
268267

269268

270-
[[tool.hatch.envs.hatch-test.matrix]]
271-
python = ["3.9"]
272-
version = ["pyspark33", "pyspark34"]
273-
274269
[[tool.hatch.envs.hatch-test.matrix]]
275270
python = ["3.10"]
276271
version = ["pyspark33", "pyspark34", "pyspark35", "pyspark35r"]
@@ -289,14 +284,18 @@ matrix.version.extra-dependencies = [
289284
{ value = "pyspark>=3.3,<3.4", if = ["pyspark33"] },
290285
{ value = "spark-expectations>=2.1.0", if = ["pyspark33"] },
291286
{ value = "pandas<2", if = ["pyspark33"] },
287+
{ value = "delta-spark>=2.2,<3.0", if = ["pyspark33"] },
292288
{ value = "pyspark>=3.4,<3.5", if = ["pyspark34"] },
293289
{ value = "spark-expectations>=2.1.0", if = ["pyspark34"] },
290+
{ value = "delta-spark>=2.2,<3.0", if = ["pyspark34"] },
294291
# FIXME: Delta with PySpark 3.5.6 has a bug with overwrite:
295292
# https://github.com/delta-io/delta/issues/4671
296293
{ value = "pyspark>=3.5,<3.5.6", if = ["pyspark35"] },
297294
{ value = "pyspark[connect]>=3.5,<3.5.6", if = ["pyspark35r"] },
295+
{ value = "delta-spark>=3.0", if = ["pyspark35", "pyspark35r"] },
298296
{ value = "pyspark==3.5.2", if = ["pyspark352"] },
299297
{ value = "pyspark[connect]==3.5.2", if = ["pyspark352r"] },
298+
{ value = "delta-spark>=3.0", if = ["pyspark352", "pyspark352r"] },
300299
]
301300

302301
name.".*".env-vars = [

0 commit comments

Comments
 (0)