Skip to content

Partial pathlib port#233

Merged
fsimonis merged 4 commits into
developfrom
pathlib-port
Mar 12, 2025
Merged

Partial pathlib port#233
fsimonis merged 4 commits into
developfrom
pathlib-port

Conversation

@fsimonis
Copy link
Copy Markdown
Member

@fsimonis fsimonis commented Mar 6, 2025

Main changes of this PR

This PR ports ASTE python script to using pathlib.Path.

The creative coding styles of precice-aste-partition and precice-aste-evaluate make them a challenge to port.

Author's checklist

  • I used the pre-commit hook and used pre-commit run --all to apply all available hooks.
  • I added a test to cover the proposed changes in our test suite.
  • I updated the documentation in docs/README.md.
  • I added a changelog entry in ./changelog-entries/ (create if necessary).
  • I updated potential breaking changes in the tutorial precice/tutorials/aste-turbine.

@davidscn
Copy link
Copy Markdown
Member

davidscn commented Mar 6, 2025

Could you say something about the motivation to use pathlib over os.path?

@fsimonis
Copy link
Copy Markdown
Member Author

fsimonis commented Mar 6, 2025

Could you say something about the motivation to use pathlib over os.path?

Best to take a look at PEP 428. In general:

  • Object-oriented interface instead of relying on str
  • Support for chaining and easier queries
  • Doesn't mix with buildins by default. Which can easily result in bugs when using str

@fsimonis fsimonis merged commit 143d0ac into develop Mar 12, 2025
@fsimonis fsimonis deleted the pathlib-port branch March 12, 2025 14:54
@davidscn davidscn mentioned this pull request Mar 31, 2025
5 tasks
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