Skip to content

Add API V2 support#97

Merged
stuartdietrich merged 9 commits intomasterfrom
taskapi-v2
Feb 24, 2025
Merged

Add API V2 support#97
stuartdietrich merged 9 commits intomasterfrom
taskapi-v2

Conversation

@stuartdietrich
Copy link
Copy Markdown
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

name: Black Formatting Check # Only validation, without re-formatting
command: |
black --check -t py36 .
black --check --exclude 'scaleapi/api_client/*' -t py38 .
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

response.get("next_token"),
)

def v2_get_tasks(
Copy link
Copy Markdown
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
Copy Markdown
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