Skip to content

allow datasetId on project creation #70

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 3 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ htmlcov/
nosetests.xml
coverage.xml
*.cover

.idea
18 changes: 14 additions & 4 deletions scaleapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import IO, Dict, Generator, Generic, List, TypeVar, Union
from typing import IO, Dict, Generator, Generic, List, Optional, TypeVar, Union

from scaleapi.batches import Batch, BatchStatus
from scaleapi.evaluation_tasks import EvaluationTask
Expand Down Expand Up @@ -782,20 +782,29 @@ def create_project(
params: Dict = None,
rapid: bool = False,
studio: bool = False,
dataset_id: Optional[str] = None,
) -> Project:
"""Creates a new project.
https://docs.scale.com/reference#project-creation

Args:
project_name (str):
Project name

task_type (TaskType):
Task Type i.e. `TaskType.ImageAnnotation`

params (Dict):
Project parameters to be specificed.
Project parameters to be specified.
i.e. `{'instruction':'Please label the kittens'}`
rapid (bool):
Copy link

Choose a reason for hiding this comment

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

Two boolean variables that are only valid when xor'd. Great 🙈

Kudos on the doc string though!

Whether the project being created is a
Scale Rapid project
studio (bool):
Whether the project being created is a
Scale Studio project
dataset_id (str):
Link this project to an existing Nucleus dataset.
All tasks annotated in this project will
be synced to the given dataset.

Returns:
Project: [description]
Expand All @@ -807,6 +816,7 @@ def create_project(
params=params,
rapid=rapid,
studio=studio,
datasetId=dataset_id,
)
projectdata = self.api.post_request(endpoint, body=payload)
return Project(projectdata, self)
Expand Down