Conversation
….path improvements Add missing but commonly-needed functions to the Os module: - os.makedirs(path, exist_ok) overload using keyword arg emission so callers can write os.makedirs(dir, true) without specifying mode - os.walk / os.walk(topdown) for directory tree traversal - os.getpid() and os.getppid() to query current/parent process IDs - os.path.isabs to test if a path is absolute - os.path.islink to test if a path is a symbolic link - os.path.realpath to resolve symlinks and canonicalize a path - os.path.getsize to get the size of a file in bytes Also adds 7 new tests to TestOs.fs covering all new members. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Change os.path.getsize return type from int to int64 to handle files >= 2 GiB - Reorder getpid/getppid next to getenv; move walk near rmdir for grouping - Improve walk test to assert dirpath="." and that subdirs+files match listdir - Add getppid test - Add walk(topdown=false) test using a controlled temp dir - Use unique /tmp paths and clean up after makedirs/walk tests - Revert CHANGELOG.md addition (AGENTS.md forbids modifying CHANGELOG) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This is an automated pull request from Repo Assist, an AI assistant for this repository.
Summary
Extends
Os.fswith several commonly-needed functions that were missing from the module, including the most-requested patternos.makedirs(path, exist_ok=True).Changes
New
osfunctionsos.makedirs(path, exist_ok)os.makedirs(path, exist_ok=bool)os.makedirs(path, mode, exist_ok)os.makedirs(path, mode, bool)os.walk(top)os.walk(top)(dirpath, dirnames, filenames)tuplesos.walk(top, topdown)os.walk(top, topdown=bool)os.getpid()os.getpid()os.getppid()os.getppid()New
os.pathfunctionsos.path.isabs(path)os.path.isabs(path)os.path.islink(path)os.path.islink(path)os.path.realpath(path)os.path.realpath(path)os.path.getsize(path)os.path.getsize(path)Tests
7 new tests added to
test/TestOs.fs.Motivation
The most common pain point is
os.makedirs(path, exist_ok=True)— the previous binding forced callers to also supplymode, which is unusual. The new overload uses[<Emit("$0.makedirs($1, exist_ok=$2)")>]to passexist_okas a keyword argument.os.walkis one of Python's most widely-used directory traversal functions and was absent entirely.Trade-offs
makedirs(path * mode * exist_ok)overload is preserved for backward compatibility.Note
🔒 Integrity filter blocked 10 items
The following items were blocked because they don't meet the GitHub integrity level.
list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".To allow these resources, lower
min-integrityin your GitHub frontmatter: