Skip to content

Import the other two scripts rather than load them by hand - #168

Merged
andiwand merged 1 commit into
mainfrom
claude/plain-imports
Aug 17, 2026
Merged

Import the other two scripts rather than load them by hand#168
andiwand merged 1 commit into
mainfrom
claude/plain-imports

Conversation

@andiwand

Copy link
Copy Markdown
Member

store-copy.py reached two other scripts by opening them and running them
through importlib, because a hyphen is not something Python can import:

listing = load(ROOT / "scripts" / "store-listing.py", "store_listing")
changelog = load(ROOT / ".github" / "scripts" / "changelog-section.py", "changelog_section")

Both are renamed, and the load helper is gone:

import changelog_section as changelog
import store_listing as listing

Running a script puts its own directory first on the import path, so a plain
import finds a sibling with nothing set from outside. That only works if the
sibling is actually there, so changelog-section.py moves out of
.github/scripts - the release workflow was its only reader when it was filed
with the workflows, and store-copy.py writes the store text out of the same
section. resolve-version.py follows it so the folder goes rather than keeping
one file, and .github/scripts no longer exists.

Underscores are for the three files something imports; the scripts that are only
ever run keep their hyphens.

Not changed

No behaviour anywhere - every edit is a name, a path, or an import.

Checked

Each script run against 1.40: changelog_section.py prints the section,
store_listing.py reports what the release would refuse, resolve-version.py
resolves, and store-copy.py --help proves both imports resolve - from the
repository root and from /, since the import path follows the script and not
the working directory. The executable bit survived both moves, which the
workflow needs to run them by path. scripts/format.sh is clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01E6tn8P25cBDmrA67zrhfwN

The store copy script reached the listing and the changelog by opening
those files and running them, because neither was named something Python
can say. Both are renamed.

The changelog reader moves out of the workflow folder while we are here,
and the version reader with it, so every script sits in one place and a
script that needs another one is simply next to it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E6tn8P25cBDmrA67zrhfwN
@andiwand
andiwand merged commit 7bb268f into main Aug 17, 2026
4 checks passed
@andiwand
andiwand deleted the claude/plain-imports branch August 17, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant