Migrate from os.path to pathlib for file path handling#654
Open
zliang-akamai wants to merge 3 commits intolinode:devfrom
Open
Migrate from os.path to pathlib for file path handling#654zliang-akamai wants to merge 3 commits intolinode:devfrom
zliang-akamai wants to merge 3 commits intolinode:devfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates several file-path handling call sites from os.path APIs to pathlib.Path, aligning the SDK and docs with modern Python path handling.
Changes:
- Replaced
os.path.isfile/os.path.expanduserchecks withPath(...).expanduser().is_file()in key/cert loading helpers. - Updated StackScript file detection to use
Path.is_file(). - Updated Sphinx
docs/conf.pyto usepathlibwhen inserting the project root intosys.path.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| linode_api4/objects/nodebalancer.py | Uses Path(...).expanduser().is_file() for SSL cert/key file loading. |
| linode_api4/groups/profile.py | Uses Path(...).expanduser().is_file() for SSH public key loading from a file. |
| linode_api4/groups/linode.py | Uses Path.is_file() for StackScript “script is a file path” detection. |
| linode_api4/common.py | Uses Path(...).expanduser().is_file() for authorized_keys file loading. |
| docs/conf.py | Switches sys.path insertion to pathlib and updates the inline guidance comment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dawiddzhafarov
previously approved these changes
Mar 2, 2026
ezilber-akamai
previously approved these changes
Mar 3, 2026
b837819
ezilber-akamai
approved these changes
Mar 3, 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.
📝 Description
Migrate low-level OS APIs to
pathlibfor handling file paths.✔️ How to Test