Skip to content

DSO compatibility on windows#156

Draft
DSchreyer wants to merge 11 commits into
mainfrom
dso-windows
Draft

DSO compatibility on windows#156
DSchreyer wants to merge 11 commits into
mainfrom
dso-windows

Conversation

@DSchreyer

@DSchreyer DSchreyer commented Aug 26, 2025

Copy link
Copy Markdown
Collaborator

Summary

This PR improves Windows compatibility while preserving POSIX behavior (#152):

  • dso compile-config now emits backslashes for !path entries in params.yaml on Windows, and forward slashes on POSIX.
  • DSO_TEMPLATE_LIBRARIES supports absolute Windows paths with drive letters (no accidental split on C:).
  • Template rendering writes UTF-8 with LF line endings and a final newline to satisfy pre-commit checks.
  • find_in_parent no longer recurses past Windows drive/UNC roots.

Rationale

Windows users encountered:

  • Compiled params.yaml using forward slashes.
  • pre-commit failures due to mixed line endings in generated files.
  • Occasional RecursionError when searching above drive roots.
  • Inability to include absolute Windows paths in DSO_TEMPLATE_LIBRARIES.

Changes

  • src/dso/_compile_config.py
    Normalize compiled !path strings to OS-native separators for both relative and absolute cases.
  • src/dso/_templates.py
    • Windows-aware parsing of DSO_TEMPLATE_LIBRARIES that tolerates X:\... entries.
    • _copy_with_render writes files with encoding="utf-8", LF newlines, and a trailing newline.
  • src/dso/_util.py
    Robust root detection in _find_in_parent_abs: stops at drive/UNC roots; safe recurse barrier checks.
  • Tests
    • tests/test_compile_config.py updated to normalize expectations with os.path.normpath and use UTF-8 I/O.
    • Related tests adjusted where needed to avoid hard-coding /.

Backward Compatibility

  • On Windows, params.yaml now contains backslashes for compiled !path entries. Most consumers already accept native separators; if custom tooling expects /, normalize via pathlib/os.path.
  • No CLI/API changes; POSIX behavior unchanged.

Testing

  • Unit tests updated for cross-platform path expectations and UTF-8 I/O.
  • Verified locally:
    • Windows: tests pass; no mixed line-ending failures; no recursion errors.
    • Linux/macOS: unchanged behavior; tests remain green.

Disclaimer

Some changes have been suggested by GPT-5 and Github Copilot. Therefore, some code might not follow best-practices or can lead to issues in specific circumstances. All tests have been passed on windows, but now also need to be passed on linux.

Daniel Schreyer added 3 commits August 26, 2025 15:31
* Added: windows-aware parsing of dso_template libraries
* Changed: Windows path behaviour with backslashes in params.yaml
* Changed: Test expectations to fit new windows compatibility
@DSchreyer

DSchreyer commented Aug 26, 2025

Copy link
Copy Markdown
Collaborator Author

Let's wait and see which CI fails

@DSchreyer

Copy link
Copy Markdown
Collaborator Author

Even though most checks pass, get-config does not work and I am unsure about the watermarking feature. I need to further investigate

@DSchreyer

Copy link
Copy Markdown
Collaborator Author

dso get-config now seems to be working as expected on windows

@DSchreyer DSchreyer requested a review from grst August 26, 2025 14:29
@DSchreyer

Copy link
Copy Markdown
Collaborator Author

Yeah, despite passing all errors there are issues now with this version on linux. dso compile-config outputs an invalid cross-device link error. Will be investigated, but no review is needed for now

@grst grst removed their request for review October 2, 2025 14:00
@grst grst marked this pull request as draft May 13, 2026 13:18
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