Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Migrate from os.path to pathlib for file path handling#654

Merged
zliang-akamai merged 3 commits intolinode:devlinode/linode_api4-python:devfrom
zliang-akamai:zhiwei/pathlib-migrationzliang-akamai/linode_api4-python:zhiwei/pathlib-migrationCopy head branch name to clipboard
Mar 5, 2026
Merged

Migrate from os.path to pathlib for file path handling#654
zliang-akamai merged 3 commits intolinode:devlinode/linode_api4-python:devfrom
zliang-akamai:zhiwei/pathlib-migrationzliang-akamai/linode_api4-python:zhiwei/pathlib-migrationCopy head branch name to clipboard

Conversation

@zliang-akamai
Copy link
Member

📝 Description

Migrate low-level OS APIs to pathlib for handling file paths.

✔️ How to Test

pytest ./test/unit/linode_client_test.py -k test_ssh_key_create
pytest test/unit/linode_client_test.py -k test_instance_create

@zliang-akamai zliang-akamai requested a review from a team as a code owner February 28, 2026 06:35
@zliang-akamai zliang-akamai requested review from dawiddzhafarov and ezilber-akamai and removed request for a team February 28, 2026 06:35
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.expanduser checks with Path(...).expanduser().is_file() in key/cert loading helpers.
  • Updated StackScript file detection to use Path.is_file().
  • Updated Sphinx docs/conf.py to use pathlib when inserting the project root into sys.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.

docs/conf.py Show resolved Hide resolved
linode_api4/common.py Show resolved Hide resolved
linode_api4/groups/profile.py Show resolved Hide resolved
linode_api4/groups/linode.py Show resolved Hide resolved
dawiddzhafarov
dawiddzhafarov previously approved these changes Mar 2, 2026
ezilber-akamai
ezilber-akamai previously approved these changes Mar 3, 2026
@zliang-akamai zliang-akamai merged commit 34fbbab into linode:dev Mar 5, 2026
12 checks passed
@zliang-akamai zliang-akamai deleted the zhiwei/pathlib-migration branch March 5, 2026 19:58
@zliang-akamai zliang-akamai added the improvement for improvements in existing functionality in the changelog. label Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement for improvements in existing functionality in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.