Skip to content

Reorganize platforms directory by platform instead of by type#32

Merged
gb119 merged 6 commits intomainfrom
copilot/refactor-checker-platform-code
Feb 10, 2026
Merged

Reorganize platforms directory by platform instead of by type#32
gb119 merged 6 commits intomainfrom
copilot/refactor-checker-platform-code

Conversation

Copy link
Contributor

Copilot AI commented Feb 10, 2026

Platform-specific code was split across platforms/{platform}.py (data) and platforms/checkers/{platform}.py (checker classes), making it unclear which code belonged together.

Changes

Before:

platforms/
├── windows.py, darwin.py, posix.py          # Data (system_paths, invalid_chars)
└── checkers/
    └── windows.py, darwin.py, posix.py      # Checker classes

After:

platforms/
├── windows/
│   ├── checker.py                           # WindowsPathChecker
│   └── paths.py                             # system_paths, invalid_chars, reserved_names
├── darwin/
│   ├── checker.py                           # DarwinPathChecker
│   └── paths.py                             # system_paths, invalid_chars
└── posix/
    ├── checker.py                           # PosixPathChecker
    └── paths.py                             # system_paths, invalid_chars

Import Updates

In checker.py factory function:

# Before
from .platforms.checkers.windows import WindowsPathChecker

# After
from .platforms.windows.checker import WindowsPathChecker

In platform checker modules:

# Before
from ..windows import invalid_chars, system_paths

# After
from .paths import invalid_chars, system_paths

All platform-specific code now colocated by platform. No functional changes.

Original prompt

checker.py is getting a bit big. It contains classes for specific platforms and it might be better to use the platforms subpackage to contain all the relevant pltform specific code - but we would nee ot be careful of circular imports just moving the existing classes to the existing submodules within the platforms subpackages. Consider the best way to separate out the platform specific code to separate modules/packages within the platforms subpackage.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 10, 2026 10:29
Co-authored-by: gb119 <4428426+gb119@users.noreply.github.com>
Co-authored-by: gb119 <4428426+gb119@users.noreply.github.com>
Co-authored-by: gb119 <4428426+gb119@users.noreply.github.com>
Co-authored-by: gb119 <4428426+gb119@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor platform-specific code into subpackage Refactor: Extract platform-specific checkers to platforms/checkers submodule Feb 10, 2026
Copilot AI requested a review from gb119 February 10, 2026 10:36
Copilot AI changed the title Refactor: Extract platform-specific checkers to platforms/checkers submodule Refactor: Extract platform-specific PathChecker implementations to platforms subpackage Feb 10, 2026
Co-authored-by: gb119 <4428426+gb119@users.noreply.github.com>
Copilot AI changed the title Refactor: Extract platform-specific PathChecker implementations to platforms subpackage Reorganize platforms directory by platform instead of by type Feb 10, 2026
@gb119 gb119 marked this pull request as ready for review February 10, 2026 11:41
@gb119 gb119 merged commit 313dba4 into main Feb 10, 2026
16 checks passed
@gb119 gb119 deleted the copilot/refactor-checker-platform-code branch February 10, 2026 11:41
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.

2 participants