Skip to content
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

Remove dependency on pyproject.toml in site package #1777

Merged
merged 4 commits into from
Jan 8, 2025
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
40 changes: 20 additions & 20 deletions py/core/main/api/v3/users_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -1537,9 +1537,6 @@ async def create_user_api_key(
403,
)

print("name =", name)
print("description =", description)

api_key = await self.services.auth.create_user_api_key(
id, name=name, description=description
)
Expand Down Expand Up @@ -1753,28 +1750,31 @@ async def get_user_limits(
"x-codeSamples": [
{
"lang": "Python",
"source": """
from r2r import R2RClient
"source": textwrap.dedent(
"""
from r2r import R2RClient

client = R2RClient()
client.login(...) # Or some other auth flow
client = R2RClient()
client.login(...) # Or some other auth flow

metadata_update = {
"some_key": "some_value",
"old_key": ""
}
updated_user = client.users.patch_metadata("550e8400-e29b-41d4-a716-446655440000", metadata_update)
print(updated_user)
""",
metadata_update = {
"some_key": "some_value",
"old_key": ""
}
updated_user = client.users.patch_metadata("550e8400-e29b-41d4-a716-446655440000", metadata_update)
""",
),
},
{
"lang": "cURL",
"source": """
curl -X PATCH "https://api.example.com/v3/users/550e8400-e29b-41d4-a716-446655440000/metadata" \\
-H "Authorization: Bearer YOUR_API_TOKEN" \\
-H "Content-Type: application/json" \\
-d '{"some_key":"some_value","old_key":""}'
""",
"source": textwrap.dedent(
"""
curl -X PATCH "https://api.example.com/v3/users/550e8400-e29b-41d4-a716-446655440000/metadata" \\
-H "Authorization: Bearer YOUR_API_TOKEN" \\
-H "Content-Type: application/json" \\
-d '{"some_key":"some_value","old_key":""}'
""",
),
},
]
},
Expand Down
9 changes: 2 additions & 7 deletions py/core/telemetry/telemetry_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
import uuid
from concurrent.futures import ThreadPoolExecutor
from functools import wraps
from importlib import metadata
from pathlib import Path
from typing import Optional

import toml

from core.telemetry.events import ErrorEvent, FeatureUsageEvent
from core.telemetry.posthog import telemetry_client

Expand All @@ -25,11 +24,7 @@ class ProductTelemetryClient:
def version(self) -> str:
if self._version is None:
try:
pyproject_path = (
Path(__file__).parent.parent.parent / "pyproject.toml"
)
pyproject_data = toml.load(pyproject_path)
self._version = pyproject_data["tool"]["poetry"]["version"]
self._version = metadata.version("r2r")
except Exception as e:
logger.error(
f"Error reading version from pyproject.toml: {str(e)}"
Expand Down
6 changes: 4 additions & 2 deletions py/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "r2r"
readme = "README.md"
version = "3.3.22"
version = "3.3.23"

description = "SciPhi R2R"
authors = ["Owen Colegrove <owen@sciphi.ai>"]
Expand All @@ -16,7 +16,9 @@ include = [
"compose.full.yaml",
"compose.full_with_replicas.yaml",
"pyproject.toml",
"migrations/**/*"
"migrations/**/*",
"r2r/**/*.yaml",
"r2r/**/*.toml"
]
packages = [
{ include = "r2r" },
Expand Down
8 changes: 2 additions & 6 deletions py/r2r/__init__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import logging
from pathlib import Path

import toml
from importlib import metadata

from sdk.async_client import R2RAsyncClient
from sdk.models import R2RException
from sdk.sync_client import R2RClient

logger = logging.getLogger()

pyproject_path = Path(__file__).parent.parent / "pyproject.toml"
pyproject_data = toml.load(pyproject_path)
__version__ = pyproject_data["tool"]["poetry"]["version"]
__version__ = metadata.version("r2r")

__all__ = [
"R2RAsyncClient",
Expand Down
Loading