Files
chroma/clients/python/build_python_thin_client.sh
Hammad Bashir bdc1841e22 Add a thin client (#610)
## Description of changes
*Summarize the changes made by this PR.*
 - Improvements & Bug fixes
	 - Typing cleanup
- Changes embedding function defaults to work through the default params
as opposed to via None so that None now means - NO embedding function as
opposed to use the default. This is technically a breaking change.
 - New functionality
- Adds a thin client that restricts what you can create to the REST api
client and builds it separately so it can be published to its own pypi
package. The thin client restricts the default embedding function to be
None always - forcing manual specification of the embedding function
while using the thin client.
- The thin client is built with its own pyproject.toml with a limited
set of dependencies and a is_thin_client.py file that acts as a compile
flag. The build script stages the toml, places the two files in the
right place, performs the build and then tears down the changes.
	 
Addresses #289 

## Test plan
The existing tests should cover this configuration. We can add CI for
the thin-client in the future.

## Documentation Changes
We will add a section on the docs that explains the thin client and its
limitations.
2023-05-31 14:23:10 -07:00

47 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Define the paths to the existing and new toml files
existing_toml="pyproject.toml"
thin_client_toml="clients/python/pyproject.toml"
# Define the path to the thin client flag script
is_thin_client_py="clients/python/is_thin_client.py"
is_thin_client_target="chromadb/is_thin_client.py"
# Define the path to the existing readme and new readme for packaging
existing_readme="README.md"
thin_client_readme="clients/python/README.md"
# Stage the existing toml file
staged_toml="staged_pyproject.toml"
mv "$existing_toml" "$staged_toml"
# Stage the existing readme file
staged_readme="staged_README.md"
mv "$existing_readme" "$staged_readme"
function cleanup {
# Teardown: Remove the new toml file and put the old one back
rm "$existing_toml"
mv "$staged_toml" "$existing_toml"
rm "$is_thin_client_target"
# Teardown: Remove the new readme file and put the old one back
rm "$existing_readme"
mv "$staged_readme" "$existing_readme"
}
trap cleanup EXIT
# Copy the new toml file in place
cp "$thin_client_toml" "$existing_toml"
# Copy the thin client flag script in place
cp "$is_thin_client_py" "$is_thin_client_target"
# Copy the new readme file in place
cp "$thin_client_readme" "$existing_readme"
python -m build