Skip to content

Add API V2 support #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 24, 2025
Merged

Add API V2 support #97

merged 9 commits into from
Feb 24, 2025

Conversation

stuartdietrich
Copy link
Contributor

Pull Request Summary

Description

Please include a summary of the changes. Please also include the relevant context and motivation. List any dependencies and assumptions that are required for this change.

Added client for V2 endpoints and utility function v2_get_tasks. Updated requirements and python version to >=3.8 to support the new client.

How did you test your code?

Which of the following have you done to test your changes? Please describe the tests that you ran to verify your changes.

  • Created new unit tests in tests/ for the newly implemented methods
  • Updated existing unit tests in tests/ to cover changes made to existing methods

Added tests for v2_get_tasks and v2.get_task - leaving commented until they can pass for other users.

Checklist

Please make sure all items in this checklist have been fulfilled before sending your PR out for review!

  • I have commented my code in details, particularly in hard-to-understand areas
  • I have updated Readme.rst document with examples for newly implemented public methods
  • I have reviewed Deployment and Publishing Guide for Python SDK document
  • I incremented the SDK version in _version.py (unless this PR only updates the documentation).
  • In order to release a new version, a "Release Summary" needs to be prepared and published after the merge

@@ -17,11 +17,11 @@ jobs:
- run:
name: Black Formatting Check # Only validation, without re-formatting
command: |
black --check -t py36 .
black --check --exclude 'scaleapi/api_client/*' -t py38 .
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a way to run it through black after we generate. We run the typescript one through prettier

Copy link
Collaborator

Choose a reason for hiding this comment

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

not a big deal if it's not easy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah there's also some others in the precommit, can try to do something similar next time

@@ -318,6 +330,83 @@ def tasks(self, **kwargs) -> Tasklist:
response.get("next_token"),
)

def v2_get_tasks(
Copy link
Collaborator

Choose a reason for hiding this comment

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

so you can do like:

client = ScaleClient()
client.v2_get_tasks(...)
client.v2.get_tasks(...)

right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, where v2. exposes the auto-generated and v2_get_tasks is to match existing get_tasks pagination

@stuartdietrich stuartdietrich merged commit 74ea1de into master Feb 24, 2025
1 check passed
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