Turn any technical book PDF into a Claude Code skill — ready to study, reference, and use while you work.
Python agent-skillsai-agentsbook-to-skillcontext-engineeringdocument-processingedtechknowledge-baseknowledge-managementllmpdf-to-markdownragself-studystudy-tools
fix(extractor): defer annotation evaluation so import works on Python 3.9 (#34)
Randerson Melville06844f4b3780
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 15e3012..501d3ca 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -15,7 +15,7 @@ jobs:strategy:fail-fast: falsematrix:- python-version: ["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- uses: actions/setup-python@v5diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a0f54bb..9ec0525 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,22 @@ All notable changes to **book-to-skill** are documented here.The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).+## [Unreleased]++### Fixed+- **Package now imports on interpreters that evaluate annotations eagerly.**+ Added `from __future__ import annotations` to every module using PEP 604+ unions (`str | None`) — `scripts/extractor/{utils,dependencies}.py`, all+ `scripts/extractor/parsers/*.py`, and `tools/discovery_tax.py`. Before this,+ importing the package under Python 3.9 raised `TypeError: unsupported operand+ type(s) for |: 'type' and 'NoneType'` at import time, so the whole test suite+ failed during collection. The annotations are now lazy (free at runtime), so+ the package imports and runs cleanly on Python 3.9 as well.++### Changed+- CI test matrix now includes Python 3.9 so the import path above is guarded and+ cannot silently re-break.+## [1.1.0] — 2026-06-12### Addeddiff --git a/scripts/extractor/dependencies.py b/scripts/extractor/dependencies.pyindex 224cb27..f48c88b 100644--- a/scripts/extractor/dependencies.py+++ b/scripts/extractor/dependencies.py@@ -1,3 +1,5 @@+from __future__ import annotations+import importlib.utilimport osimport shutildiff --git a/scripts/extractor/parsers/calibre.py b/scripts/extractor/parsers/calibre.pyindex 14471c1..96a6a14 100644--- a/scripts/extractor/parsers/calibre.py+++ b/scripts/extractor/parsers/calibre.py@@ -1,3 +1,5 @@+from __future__ import annotations+import shutilimport subprocessfrom extractor.config import OUTPUT_DIRdiff --git a/scripts/extractor/parsers/docx.py b/scripts/extractor/parsers/docx.pyindex bc7a1d1..e6bf9dc 100644--- a/scripts/extractor/parsers/docx.py+++ b/scripts/extractor/parsers/docx.py@@ -1,3 +1,5 @@+from __future__ import annotations+import zipfilefrom extractor.exceptions import ExtractionErrordiff --git a/scripts/extractor/parsers/epub.py b/scripts/extractor/parsers/epub.pyindex 681108c..f905c23 100644--- a/scripts/extractor/parsers/epub.py+++ b/scripts/extractor/parsers/epub.py@@ -1,3 +1,5 @@+from __future__ import annotations+import posixpathimport reimport zipfilediff --git a/scripts/extractor/parsers/html.py b/scripts/extractor/parsers/html.pyindex 8e38c84..5133f7b 100644--- a/scripts/extractor/parsers/html.py+++ b/scripts/extractor/parsers/html.py@@ -1,3 +1,5 @@+from __future__ import annotations+import htmlimport html.parserfrom extractor.parsers.text import read_text_filediff --git a/scripts/extractor/parsers/pdf.py b/scripts/extractor/parsers/pdf.pyindex 123fa46..614fa7a 100644--- a/scripts/extractor/parsers/pdf.py+++ b/scripts/extractor/parsers/pdf.py@@ -1,3 +1,5 @@+from __future__ import annotations+import shutilimport subprocessdiff --git a/scripts/extractor/parsers/text.py b/scripts/extractor/parsers/text.pyindex 7304f81..56a3b6d 100644--- a/scripts/extractor/parsers/text.py+++ b/scripts/extractor/parsers/text.py@@ -1,3 +1,5 @@+from __future__ import annotations+from pathlib import Pathdiff --git a/scripts/extractor/utils.py b/scripts/extractor/utils.pyindex b5356fc..4a8d656 100644--- a/scripts/extractor/utils.py+++ b/scripts/extractor/utils.py@@ -1,3 +1,5 @@+from __future__ import annotations+import globimport jsonimport osdiff --git a/tools/discovery_tax.py b/tools/discovery_tax.pyindex 96ec016..7c2ff7c 100644--- a/tools/discovery_tax.py+++ b/tools/discovery_tax.py@@ -28,6 +28,8 @@ Usage:[--skill-dir <skill_folder>] [--target-chapter N] [--core-tokens 4000]"""+from __future__ import annotations+import argparseimport reimport sys