-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[ENH] Always pass Tenant and DB as query params #1558
Open
beggers
wants to merge
21
commits into
main
Choose a base branch
from
beggers/tenant-db-only-as-params
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
2594e6a
Make tenant and db always query params
beggers f1df710
client too
beggers 0651c07
Merge branch 'main' into beggers/tenant-db-only-as-params
beggers 19ea6f3
Pick up a small ism
beggers b10ffc1
Merge branch 'beggers/tenant-db-only-as-params' of github.com:chroma-…
beggers 7fe8255
correctly check for no tenant or db passed
beggers e3aab58
merge main
beggers 0ab2549
debug strings so i can docker compose this
beggers 9cd19e2
Just do tenant and db as query params onw
beggers 4305785
Merge branch 'main' into beggers/tenant-db-only-as-params
beggers 6aee0be
github workflow to keep this working in the future
beggers a158b02
downgrade fastapi and generate client
beggers 9445ac6
s/requirements-dev/requirements_dev/
beggers c3d7b29
s/client/clients/
beggers 56bdf18
what happens if we just remove node version
beggers 808a3e2
use bash, use python
beggers 2181364
fail bash scirpt if generation fails
beggers 946e378
fi
beggers d85c3ef
okay okay okay genapi actually exits correctly now
beggers a51e252
swap arguments
beggers 4c7e737
Fix tests, allow tenant and db to be undefined in user-facing api
beggers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Chroma Test JS Client Generation | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
- '**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
generate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
- name: Install Python Dependencies | ||
run: pip install -r requirements.txt && pip install -r requirements_dev.txt | ||
- name: Run Server | ||
run: python -m chromadb.cli.cli run & | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: Install Dependencies | ||
run: yarn | ||
working-directory: ./clients/js | ||
- name: Generate | ||
run: yarn genapi | ||
working-directory: ./clients/js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,6 @@ | ||
from functools import partial | ||
from typing import Any, Callable, Dict, Optional, Sequence, cast | ||
from typing import Any, Callable, Dict, cast | ||
from chromadb.api import ServerAPI | ||
from chromadb.auth import AuthzResourceTypes | ||
|
||
|
||
def find_key_with_value_of_type( | ||
type: AuthzResourceTypes, **kwargs: Any | ||
) -> Dict[str, Any]: | ||
from chromadb.server.fastapi.types import ( | ||
CreateCollection, | ||
CreateDatabase, | ||
CreateTenant, | ||
) | ||
|
||
for key, value in kwargs.items(): | ||
if type == AuthzResourceTypes.DB and isinstance(value, CreateDatabase): | ||
return dict(value) | ||
elif type == AuthzResourceTypes.COLLECTION and isinstance( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note: this was never used in the |
||
value, CreateCollection | ||
): | ||
return dict(value) | ||
elif type == AuthzResourceTypes.TENANT and isinstance(value, CreateTenant): | ||
return dict(value) | ||
return {} | ||
|
||
|
||
def attr_from_resource_object( | ||
type: AuthzResourceTypes, | ||
additional_attrs: Optional[Sequence[str]] = None, | ||
**kwargs: Any, | ||
) -> Callable[..., Dict[str, Any]]: | ||
def _wrap(**wkwargs: Any) -> Dict[str, Any]: | ||
obj = find_key_with_value_of_type(type, **wkwargs) | ||
if additional_attrs: | ||
obj.update({k: wkwargs["function_kwargs"][k] | ||
for k in additional_attrs}) | ||
return obj | ||
|
||
return partial(_wrap, **kwargs) | ||
|
||
|
||
def attr_from_collection_lookup( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only change to this file: remove a layer of indentation to make the code marginally cleaner