futurehouse-client 0.3.20.dev200__tar.gz → 0.3.20.dev208__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {futurehouse_client-0.3.20.dev200/futurehouse_client.egg-info → futurehouse_client-0.3.20.dev208}/PKG-INFO +1 -1
  2. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/clients/rest_client.py +75 -2
  3. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/models/app.py +2 -1
  4. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/version.py +2 -2
  5. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208/futurehouse_client.egg-info}/PKG-INFO +1 -1
  6. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/LICENSE +0 -0
  7. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/README.md +0 -0
  8. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/docs/__init__.py +0 -0
  9. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/docs/client_notebook.ipynb +0 -0
  10. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/__init__.py +0 -0
  11. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/clients/__init__.py +0 -0
  12. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/clients/job_client.py +0 -0
  13. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/models/__init__.py +0 -0
  14. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/models/client.py +0 -0
  15. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/models/rest.py +0 -0
  16. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/py.typed +0 -0
  17. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/utils/__init__.py +0 -0
  18. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/utils/auth.py +0 -0
  19. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/utils/general.py +0 -0
  20. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/utils/module_utils.py +0 -0
  21. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client/utils/monitoring.py +0 -0
  22. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client.egg-info/SOURCES.txt +0 -0
  23. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client.egg-info/dependency_links.txt +0 -0
  24. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client.egg-info/requires.txt +0 -0
  25. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/futurehouse_client.egg-info/top_level.txt +0 -0
  26. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/pyproject.toml +0 -0
  27. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/setup.cfg +0 -0
  28. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/tests/test_client.py +0 -0
  29. {futurehouse_client-0.3.20.dev200 → futurehouse_client-0.3.20.dev208}/tests/test_rest.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: futurehouse-client
3
- Version: 0.3.20.dev200
3
+ Version: 0.3.20.dev208
4
4
  Summary: A client for interacting with endpoints of the FutureHouse service.
5
5
  Author-email: FutureHouse technical staff <hello@futurehouse.org>
6
6
  License: Apache License
@@ -1568,6 +1568,79 @@ class RestClient:
1568
1568
  f"An unexpected error occurred during world model creation: {e}"
1569
1569
  ) from e
1570
1570
 
1571
+ @retry(
1572
+ stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
1573
+ wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
1574
+ retry=retry_if_connection_error,
1575
+ )
1576
+ def get_project_by_name(self, name: str) -> UUID:
1577
+ """Get a project UUID by name.
1578
+
1579
+ Args:
1580
+ name: The name of the project to find
1581
+
1582
+ Returns:
1583
+ UUID of the project as a string
1584
+
1585
+ Raises:
1586
+ ProjectError: If no project is found, multiple projects are found, or there's an error
1587
+ """
1588
+ try:
1589
+ # Get projects filtered by name (backend now filters by name and owner)
1590
+ response = self.client.get(
1591
+ "/v0.1/projects", params={"limit": 2, "name": name}
1592
+ )
1593
+ response.raise_for_status()
1594
+ projects = response.json()
1595
+ except HTTPStatusError as e:
1596
+ raise ProjectError(
1597
+ f"Error getting project by name: {e.response.status_code} - {e.response.text}"
1598
+ ) from e
1599
+ except Exception as e:
1600
+ raise ProjectError(f"Error getting project by name: {e}") from e
1601
+ if len(projects) == 0:
1602
+ raise ProjectError(f"No project found with name '{name}'")
1603
+ if len(projects) > 1:
1604
+ raise ProjectError(
1605
+ f"Multiple projects found with name '{name}'. Found {len(projects)} projects."
1606
+ )
1607
+
1608
+ return UUID(projects[0]["id"])
1609
+
1610
+ @retry(
1611
+ stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
1612
+ wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
1613
+ retry=retry_if_connection_error,
1614
+ )
1615
+ async def aget_project_by_name(self, name: str) -> UUID:
1616
+ """Asynchronously get a project UUID by name.
1617
+
1618
+ Args:
1619
+ name: The name of the project to find
1620
+
1621
+ Returns:
1622
+ UUID of the project as a string
1623
+
1624
+ Raises:
1625
+ ProjectError: If no project is found, multiple projects are found, or there's an error
1626
+ """
1627
+ try:
1628
+ response = await self.async_client.get(
1629
+ "/v0.1/projects", params={"limit": 2, "name": name}
1630
+ )
1631
+ response.raise_for_status()
1632
+ projects = response.json()
1633
+ except Exception as e:
1634
+ raise ProjectError(f"Error getting project by name: {e}") from e
1635
+ if len(projects) == 0:
1636
+ raise ProjectError(f"No project found with name '{name}'")
1637
+ if len(projects) > 1:
1638
+ raise ProjectError(
1639
+ f"Multiple projects found with name '{name}'. Found {len(projects)} projects."
1640
+ )
1641
+
1642
+ return UUID(projects[0]["id"])
1643
+
1571
1644
  @retry(
1572
1645
  stop=stop_after_attempt(MAX_RETRY_ATTEMPTS),
1573
1646
  wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
@@ -1602,7 +1675,7 @@ class RestClient:
1602
1675
  wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
1603
1676
  retry=retry_if_connection_error,
1604
1677
  )
1605
- def add_task_to_project(self, project_id: str, trajectory_id: str) -> None:
1678
+ def add_task_to_project(self, project_id: UUID, trajectory_id: str) -> None:
1606
1679
  """Add a trajectory to a project.
1607
1680
 
1608
1681
  Args:
@@ -1667,7 +1740,7 @@ class RestClient:
1667
1740
  wait=wait_exponential(multiplier=RETRY_MULTIPLIER, max=MAX_RETRY_WAIT),
1668
1741
  retry=retry_if_connection_error,
1669
1742
  )
1670
- async def aadd_task_to_project(self, project_id: str, trajectory_id: str) -> None:
1743
+ async def aadd_task_to_project(self, project_id: UUID, trajectory_id: str) -> None:
1671
1744
  """Asynchronously add a trajectory to a project.
1672
1745
 
1673
1746
  Args:
@@ -647,6 +647,8 @@ class RuntimeConfig(BaseModel):
647
647
 
648
648
 
649
649
  class TaskRequest(BaseModel):
650
+ model_config = ConfigDict(extra="forbid")
651
+
650
652
  task_id: UUID | None = Field(
651
653
  default=None,
652
654
  description="Optional task identifier",
@@ -655,7 +657,6 @@ class TaskRequest(BaseModel):
655
657
  project_id: UUID | None = Field(
656
658
  default=None,
657
659
  description="Optional group identifier for the task",
658
- alias="project_id",
659
660
  )
660
661
  name: "str | JobNames" = Field(
661
662
  description="Name of the crow to execute eg. paperqa-crow"
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.3.20.dev200'
21
- __version_tuple__ = version_tuple = (0, 3, 20, 'dev200')
20
+ __version__ = version = '0.3.20.dev208'
21
+ __version_tuple__ = version_tuple = (0, 3, 20, 'dev208')
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: futurehouse-client
3
- Version: 0.3.20.dev200
3
+ Version: 0.3.20.dev208
4
4
  Summary: A client for interacting with endpoints of the FutureHouse service.
5
5
  Author-email: FutureHouse technical staff <hello@futurehouse.org>
6
6
  License: Apache License