weaviate-cli 2.1.3.dev1__tar.gz → 3.0.0__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 (70) hide show
  1. weaviate_cli-3.0.0/.github/workflows/main.yaml +79 -0
  2. weaviate_cli-3.0.0/.github/workflows/release.yaml +71 -0
  3. weaviate_cli-3.0.0/.gitignore +11 -0
  4. weaviate_cli-3.0.0/.pre-commit-config.yaml +14 -0
  5. weaviate_cli-3.0.0/CONTRIBUTING.md +68 -0
  6. weaviate_cli-3.0.0/Dockerfile +10 -0
  7. weaviate_cli-3.0.0/LICENSE +27 -0
  8. weaviate_cli-3.0.0/MANIFEST.in +1 -0
  9. weaviate_cli-3.0.0/Makefile +24 -0
  10. weaviate_cli-3.0.0/PKG-INFO +154 -0
  11. weaviate_cli-3.0.0/README.md +118 -0
  12. weaviate_cli-3.0.0/cli.py +55 -0
  13. weaviate_cli-3.0.0/publish.md +8 -0
  14. weaviate_cli-3.0.0/pyproject.toml +19 -0
  15. weaviate_cli-3.0.0/requirements-dev.txt +13 -0
  16. weaviate_cli-3.0.0/setup.cfg +66 -0
  17. weaviate_cli-3.0.0/setup.py +4 -0
  18. weaviate_cli-3.0.0/test/README.md +41 -0
  19. weaviate_cli-3.0.0/test/integration/test_integration.py +207 -0
  20. weaviate_cli-3.0.0/test/unittests/conftest.py +23 -0
  21. weaviate_cli-3.0.0/test/unittests/test_cli.py +49 -0
  22. weaviate_cli-3.0.0/test/unittests/test_managers/test_collection_manager.py +228 -0
  23. weaviate_cli-3.0.0/test/unittests/test_managers/test_config_manager.py +42 -0
  24. weaviate_cli-3.0.0/test/unittests/test_managers/test_data_manager.py +66 -0
  25. weaviate_cli-3.0.0/test/unittests/test_managers/test_shard_manager.py +119 -0
  26. weaviate_cli-3.0.0/test/unittests/test_utils.py +97 -0
  27. weaviate_cli-3.0.0/weaviate_cli/__init__.py +6 -0
  28. weaviate_cli-3.0.0/weaviate_cli/commands/create.py +259 -0
  29. weaviate_cli-3.0.0/weaviate_cli/commands/delete.py +117 -0
  30. weaviate_cli-3.0.0/weaviate_cli/commands/get.py +93 -0
  31. weaviate_cli-3.0.0/weaviate_cli/commands/query.py +68 -0
  32. weaviate_cli-3.0.0/weaviate_cli/commands/restore.py +62 -0
  33. weaviate_cli-3.0.0/weaviate_cli/commands/update.py +219 -0
  34. weaviate_cli-3.0.0/weaviate_cli/datasets/__init__.py +2 -0
  35. weaviate_cli-3.0.0/weaviate_cli/datasets/movies.json +148711 -0
  36. weaviate_cli-3.0.0/weaviate_cli/managers/backup_manager.py +76 -0
  37. weaviate_cli-3.0.0/weaviate_cli/managers/collection_manager.py +262 -0
  38. weaviate_cli-3.0.0/weaviate_cli/managers/config_manager.py +105 -0
  39. weaviate_cli-3.0.0/weaviate_cli/managers/data_manager.py +520 -0
  40. weaviate_cli-3.0.0/weaviate_cli/managers/shard_manager.py +91 -0
  41. weaviate_cli-3.0.0/weaviate_cli/managers/tenant_manager.py +316 -0
  42. weaviate_cli-3.0.0/weaviate_cli/utils.py +55 -0
  43. weaviate_cli-3.0.0/weaviate_cli.egg-info/PKG-INFO +154 -0
  44. weaviate_cli-3.0.0/weaviate_cli.egg-info/SOURCES.txt +51 -0
  45. weaviate_cli-3.0.0/weaviate_cli.egg-info/entry_points.txt +2 -0
  46. weaviate_cli-3.0.0/weaviate_cli.egg-info/not-zip-safe +1 -0
  47. weaviate_cli-3.0.0/weaviate_cli.egg-info/requires.txt +5 -0
  48. weaviate_cli-3.0.0/weaviate_cli.egg-info/top_level.txt +2 -0
  49. weaviate-cli-2.1.3.dev1/PKG-INFO +0 -61
  50. weaviate-cli-2.1.3.dev1/README.rst +0 -49
  51. weaviate-cli-2.1.3.dev1/cli.py +0 -127
  52. weaviate-cli-2.1.3.dev1/semi/commands/data.py +0 -311
  53. weaviate-cli-2.1.3.dev1/semi/commands/misc.py +0 -26
  54. weaviate-cli-2.1.3.dev1/semi/commands/schema.py +0 -68
  55. weaviate-cli-2.1.3.dev1/semi/config/config_values.py +0 -2
  56. weaviate-cli-2.1.3.dev1/semi/config/configuration.py +0 -87
  57. weaviate-cli-2.1.3.dev1/semi/config/manage.py +0 -50
  58. weaviate-cli-2.1.3.dev1/semi/prompt.py +0 -52
  59. weaviate-cli-2.1.3.dev1/semi/version.py +0 -5
  60. weaviate-cli-2.1.3.dev1/setup.cfg +0 -4
  61. weaviate-cli-2.1.3.dev1/setup.py +0 -29
  62. weaviate-cli-2.1.3.dev1/weaviate_cli.egg-info/PKG-INFO +0 -61
  63. weaviate-cli-2.1.3.dev1/weaviate_cli.egg-info/SOURCES.txt +0 -20
  64. weaviate-cli-2.1.3.dev1/weaviate_cli.egg-info/entry_points.txt +0 -4
  65. weaviate-cli-2.1.3.dev1/weaviate_cli.egg-info/requires.txt +0 -2
  66. weaviate-cli-2.1.3.dev1/weaviate_cli.egg-info/top_level.txt +0 -2
  67. {weaviate-cli-2.1.3.dev1/semi → weaviate_cli-3.0.0/test}/__init__.py +0 -0
  68. {weaviate-cli-2.1.3.dev1/semi → weaviate_cli-3.0.0/weaviate_cli}/commands/__init__.py +0 -0
  69. {weaviate-cli-2.1.3.dev1/semi/config → weaviate_cli-3.0.0/weaviate_cli/managers}/__init__.py +0 -0
  70. {weaviate-cli-2.1.3.dev1 → weaviate_cli-3.0.0}/weaviate_cli.egg-info/dependency_links.txt +0 -0
@@ -0,0 +1,79 @@
1
+ name: Main
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - '**'
9
+ pull_request:
10
+
11
+ jobs:
12
+ lint-and-format:
13
+ name: Run Linter and Formatter
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.11"
20
+ - run: pip install -r requirements-dev.txt
21
+ - name: "Black"
22
+ run: black --check cli.py weaviate_cli test
23
+ - name: "Check release for pypi"
24
+ run: |
25
+ python -m build
26
+ python -m twine check dist/*
27
+
28
+ unit-tests:
29
+ name: Run Unit Tests
30
+ needs: [lint-and-format]
31
+ runs-on: ubuntu-latest
32
+ strategy:
33
+ matrix:
34
+ version: [ "3.9", "3.10", "3.11", "3.12" ]
35
+ steps:
36
+ - uses: actions/checkout@v3
37
+ - uses: actions/setup-python@v4
38
+ with:
39
+ python-version: ${{ matrix.version }}
40
+ - run: pip install -e .
41
+ - name: Run unit tests with pytest
42
+ run: |
43
+ pip install pytest-html
44
+ pytest test/unittests --html=test-report-${{ matrix.version }}.html --self-contained-html
45
+ - name: Upload test results
46
+ if: always()
47
+ uses: actions/upload-artifact@v3
48
+ with:
49
+ name: test-results-${{ matrix.version }}
50
+ path: test-report-${{ matrix.version }}.html
51
+
52
+ integration-tests:
53
+ needs: [unit-tests]
54
+ env:
55
+ WEAVIATE_VERSION: "1.27.0"
56
+ MODULES: "text2vec-transformers,text2vec-contextionary"
57
+ name: Run Integration Tests
58
+ runs-on: ubuntu-latest
59
+ strategy:
60
+ matrix:
61
+ version: [ "3.9", "3.10", "3.11", "3.12" ]
62
+ steps:
63
+ - uses: actions/checkout@v3
64
+ - uses: actions/setup-python@v4
65
+ with:
66
+ python-version: ${{ matrix.version }}
67
+ - run: pip install -e .
68
+ - name: Start up Weaviate cluster
69
+ uses: weaviate/weaviate-local-k8s@v2
70
+ with:
71
+ workers: 1
72
+ replicas: 1
73
+ weaviate-version: ${{ env.WEAVIATE_VERSION }}
74
+ modules: ${{ env.MODULES }}
75
+ enable-backup: true
76
+ - name: Run integration tests with pytest
77
+ run: |
78
+ pip install pytest-html
79
+ pytest test/integration/ --html=test-report-${{ matrix.version }}.html --self-contained-html
@@ -0,0 +1,71 @@
1
+ name: Build and Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '**'
7
+
8
+ jobs:
9
+ build-package:
10
+ name: Build a package
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout
14
+ uses: actions/checkout@v4
15
+ with:
16
+ fetch-depth: 0
17
+ - name: Set up Python 3.11
18
+ uses: actions/setup-python@v4
19
+ with:
20
+ python-version: "3.11"
21
+ - name: Install dependencies
22
+ run: pip install -r requirements-dev.txt
23
+ - name: Build a binary wheel
24
+ run: python -m build
25
+ - name: Create Wheel Artifacts
26
+ uses: actions/upload-artifact@v4
27
+ with:
28
+ path: "dist/*.whl"
29
+ name: weaviate-cli-wheel
30
+ retention-days: 30
31
+ gh-release:
32
+ name: Create a GitHub Release on new tags
33
+ needs: [build-package]
34
+ if: startsWith(github.ref, 'refs/tags')
35
+ runs-on: ubuntu-latest
36
+ permissions:
37
+ contents: write
38
+ steps:
39
+ - name: Download build artifact to append to release
40
+ uses: actions/download-artifact@v4
41
+ with:
42
+ name: weaviate-cli-wheel
43
+ path: dist
44
+ - name: Release
45
+ uses: softprops/action-gh-release@v2
46
+ with:
47
+ generate_release_notes: true
48
+ draft: true
49
+ files: dist/*.whl
50
+ publish:
51
+ runs-on: ubuntu-latest
52
+ needs: [gh-release]
53
+ steps:
54
+ - name: Checkout
55
+ uses: actions/checkout@v4
56
+ with:
57
+ fetch-depth: 0
58
+ - name: Set up Python 3.11
59
+ uses: actions/setup-python@v5
60
+ with:
61
+ python-version: "3.11"
62
+ - name: Install dependencies
63
+ run: pip install -r requirements-dev.txt
64
+ - name: Build a binary wheel
65
+ run: python -m build
66
+ - name: Publish distribution 📦 to PyPI on new tags
67
+ if: startsWith(github.ref, 'refs/tags')
68
+ uses: pypa/gh-action-pypi-publish@release/v1
69
+ with:
70
+ verbose: true
71
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,11 @@
1
+ __pycache__
2
+ modules/__pycache__
3
+ dist/
4
+ .venv/
5
+ .vscode/
6
+ .DS_Store
7
+ build/
8
+ .idea
9
+ *.egg-info
10
+ check_weaviate_client_python_version.sh
11
+ .vscode/settings.json
@@ -0,0 +1,14 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.5.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-added-large-files
9
+
10
+ - repo: https://github.com/psf/black
11
+ rev: 24.2.0
12
+ hooks:
13
+ - id: black
14
+ language_version: python3
@@ -0,0 +1,68 @@
1
+ # Contributing to Weaviate CLI
2
+
3
+ Thank you for looking into contributing to Weaviate CLI! We really appreciate that you are willing to spend some time and effort to make Weaviate better for everyone!
4
+
5
+ We have a detailed [contributor guide](https://weaviate.io/developers/contributor-guide/current/) as a part of our documentation. If you are new, we recommend reading through the [getting started guide for contributors](https://weaviate.io/developers/contributor-guide/current/getting-started/index.html) after reading this overview.
6
+
7
+ ## Finding a Good First Issue
8
+ We use the `good-first-issue` labels on issues that we think are great to get started. These issues are typically isolated to a specific area of the CLI.
9
+
10
+ ## Prerequisites
11
+ To contribute to Weaviate CLI you should have:
12
+ - Basic Python skills
13
+ - Experience using Weaviate CLI to understand the effects of changes
14
+ - Knowledge of writing tests (see our test files for examples)
15
+
16
+ ## Development Setup
17
+ *Note: The Weaviate team uses Linux and Mac (darwin/arm64) machines exclusively. Development on Windows may lead to unexpected issues.*
18
+
19
+ 1. Fork the repository
20
+ 2. Clone your fork
21
+ 3. Create a virtual environment:
22
+ ```bash
23
+ python -m venv .venv
24
+ ```
25
+ 4. Install development dependencies using Makefile:
26
+ ```bash
27
+ make install-dev
28
+ ```
29
+
30
+ ### Code Style
31
+ - We use Black for code formatting
32
+ - Install development dependencies and pre-commit hooks (if not already installed):
33
+ ```bash
34
+ make install-dev
35
+ ```
36
+ - Before committing, ensure code is formatted:
37
+ ```bash
38
+ make format
39
+ ```
40
+ - CI will check formatting using:
41
+ ```bash
42
+ make lint
43
+ ```
44
+
45
+ ## Tagging Your Commit
46
+ Please tag your commit(s) with the appropriate GH issue that your change refers to, e.g. `gh-9001 reduce memory allocations of ACME widget`. Please also include something in your PR description to indicate which issue it will close, e.g. `fixes #9001` or `closes #9001`.
47
+
48
+ ## Pull Request
49
+ If you open an external pull request our CI pipeline will get started. This external run will not have access to secrets. This prevents people from submitting a malicious PR to steal secrets. As a result, the CI run will be slightly different from an internal one. For example, it will not automatically push a Docker image. If your PR is merged, a container with your changes will be built from the trunk.
50
+
51
+ ## Agreements
52
+
53
+ ### Code of Conduct
54
+ Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
55
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](CODE_OF_CONDUCT.md)
56
+
57
+ ### Contributor License Agreement
58
+ Contributions to Weaviate must be accompanied by a Contributor License Agreement. You (or your employer) retain the copyright to your contribution; this simply gives us permission to use and redistribute your contributions as part of Weaviate. Go to [this page](https://www.semi.technology/playbooks/misc/contributor-license-agreement.html) to read the current agreement.
59
+
60
+ The process works as follows:
61
+ - You contribute by opening a [pull request](#pull-request).
62
+ - If you have not contributed before, our bot will ask you to agree with the CLA.
63
+
64
+ ## If in Doubt, Ask
65
+ The Weaviate team consists of some of the nicest people on this planet. If something is unclear or you'd like a second opinion, please don't hesitate to ask. We are glad that you want to help us, so naturally, we will also do our best to help you on this journey.
66
+
67
+ ## Thanks for Contributing!
68
+ We really appreciate your effort in making Weaviate better for everyone!
@@ -0,0 +1,10 @@
1
+ FROM python:3.12-slim
2
+
3
+ WORKDIR /app
4
+
5
+ COPY . .
6
+
7
+ RUN apt-get update && apt-get install -y git
8
+ RUN pip install .
9
+
10
+ ENTRYPOINT ["python", "cli.py"]
@@ -0,0 +1,27 @@
1
+ Copyright (c) 2021, SeMI Technologies B.V.
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice, this
8
+ list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ 3. Neither the name of the copyright holder nor the names of its
15
+ contributors may be used to endorse or promote products derived from
16
+ this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1 @@
1
+ include weaviate_cli/datasets/*.json
@@ -0,0 +1,24 @@
1
+ .PHONY: format lint test install-dev
2
+
3
+ build:
4
+ python -m build
5
+
6
+ build-check:
7
+ python -m twine check dist/*
8
+
9
+ install-dev:
10
+ pip install -r requirements-dev.txt
11
+ pre-commit install
12
+
13
+ format:
14
+ black cli.py weaviate_cli test
15
+
16
+ lint:
17
+ black --check cli.py weaviate_cli test
18
+
19
+ test:
20
+ pytest test/unittests
21
+
22
+ build-all: build build-check
23
+
24
+ all: format lint test build-all
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.1
2
+ Name: weaviate-cli
3
+ Version: 3.0.0
4
+ Summary: Command line interface to interact with weaviate
5
+ Home-page: https://github.com/weaviate/weaviate-cli
6
+ Download-URL: https://github.com/weaviate/weaviate-cli
7
+ Author: Weaviate
8
+ Author-email: hello@weaviate.io
9
+ License: BSD 3-clause
10
+ Project-URL: Docs, https://github.com/weaviate/weaviate-cli/blob/main/README.rst
11
+ Project-URL: Bugs, https://github.com/weaviate/weaviate-cli/issues
12
+ Keywords: cli,weaviate
13
+ Platform: Linux
14
+ Classifier: Development Status :: 3 - Alpha
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Natural Language :: English
18
+ Classifier: License :: OSI Approved :: GNU General Public License (GPL)
19
+ Classifier: Operating System :: POSIX :: Linux
20
+ Classifier: Programming Language :: Python
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3 :: Only
23
+ Classifier: Programming Language :: Python :: 3.9
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Programming Language :: Python :: Implementation :: CPython
28
+ Requires-Python: >=3.9
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: weaviate-client>=4.5.0
32
+ Requires-Dist: click==8.1.7
33
+ Requires-Dist: semver>=3.0.2
34
+ Requires-Dist: numpy>=1.24.0
35
+ Requires-Dist: importlib-resources>=5.0.0
36
+
37
+ # Weaviate CLI
38
+
39
+ <img src="https://raw.githubusercontent.com/semi-technologies/weaviate/19de0956c69b66c5552447e84d016f4fe29d12c9/docs/assets/weaviate-logo.png" width="180" align="right" alt="Weaviate logo">
40
+
41
+ [![Build Status](https://github.com/weaviate/weaviate-cli/actions/workflows/main.yaml/badge.svg)](https://github.com/weaviate/weaviate-cli/actions/workflows/main.yaml)
42
+ [![PyPI version](https://badge.fury.io/py/weaviate-cli.svg)](https://badge.fury.io/py/weaviate-cli)
43
+
44
+ A powerful command-line interface for managing and interacting with Weaviate vector databases directly from your terminal.
45
+
46
+ ## Key Features
47
+ - **Collections**: Create, update, delete and get collection configurations
48
+ - **Data Management**: Import, query, update and delete data with various search types (vector, keyword, hybrid)
49
+ - **Multi-tenancy**: Manage tenants and their states across collections
50
+ - **Backup & Restore**: Create and restore backups with support for S3, GCS and filesystem
51
+ - **Sharding**: Monitor and manage collection shards
52
+ - **Flexible Configuration**: Configure vector indexes, replication, consistency levels and more
53
+
54
+ ## Quick Start
55
+ Install using pip:
56
+
57
+ ```bash
58
+ pip install weaviate-cli
59
+ ```
60
+
61
+ ## Basic Usage
62
+
63
+ ```bash
64
+ # Show available commands
65
+ weaviate-cli --help
66
+
67
+ # Create a collection
68
+ weaviate-cli create collection --collection movies --vectorizer transformers
69
+
70
+ # Import test data
71
+ weaviate-cli create data --collection movies --limit 1000
72
+
73
+ # Query data
74
+ weaviate-cli query data --collection movies --search-type hybrid --query "action movies"
75
+ ```
76
+
77
+ ## Core Commands
78
+
79
+ - **create**: Create collections, tenants, backups or import data
80
+ - **delete**: Remove collections, tenants or data
81
+ - **update**: Modify collection settings, tenant states or data
82
+ - **get**: Retrieve collection info, tenant details or shard status
83
+ - **query**: Search data using various methods
84
+ - **restore**: Restore backups from supported backends
85
+
86
+ ## Configuration
87
+
88
+ Weaviate CLI allows you to configure your cluster endpoints and parameters through a configuration file. By default, the CLI looks for a
89
+ configuration file at `~/.config/weaviate/config.json`. If this file does not exist, it will be created with the following default values:
90
+
91
+ ```json
92
+ {
93
+ "host": "localhost",
94
+ "http_port": "8080",
95
+ "grpc_port": "50051"
96
+ }
97
+ ```
98
+
99
+ You can also specify your own configuration file using the `--config-file` option:
100
+
101
+ ```bash
102
+ weaviate-cli --config-file /path/to/your/config.json
103
+ ```
104
+
105
+ The configuration file should be a JSON file with the following structure:
106
+
107
+ ```json
108
+ {
109
+ "host": "your-weaviate-host",
110
+ "http_port": "your-http-port",
111
+ "grpc_port": "your-grpc-port",
112
+ "auth": {
113
+ "type": "api_key",
114
+ "api_key": "your-api-key"
115
+ }
116
+ }
117
+ ```
118
+
119
+ If you are using a remote Weaviate instance, you can use the `weaviate-cli` command to authenticate with your Weaviate instance.
120
+ Here you can see an example on how the configuration file should look like if you are connecting to a WCD cluster:
121
+
122
+ ```json
123
+ {
124
+ "host": "thisisaninventedcluster.url.s3.us-west3.prov.weaviate.cloud",
125
+ "auth": {
126
+ "type": "api_key",
127
+ "api_key": "jfeRFsdfRfSasgsDoNOtTrYToUsErRQwqqdZfghasd"
128
+ }
129
+ }
130
+ ```
131
+
132
+ ## Requirements
133
+
134
+ - Python 3.9+
135
+ - Weaviate instance (local or remote)
136
+
137
+ ## Documentation
138
+
139
+ Detailed documentation will be added soon.
140
+
141
+ ## Community & Support
142
+
143
+ - [Slack Community](https://weaviate.io/slack) - Join our active community
144
+ - [Stack Overflow](https://stackoverflow.com/questions/tagged/weaviate) - Search using the `weaviate` tag
145
+ - [GitHub Issues](https://github.com/weaviate/weaviate-cli/issues) - Report bugs or request features
146
+
147
+ ## Contributing
148
+
149
+ We welcome contributions! Please see our [Contributing Guidelines](https://github.com/weaviate/weaviate-cli/blob/main/CONTRIBUTING.md) for
150
+ details.
151
+
152
+ ## License
153
+
154
+ BSD-3-Clause License
@@ -0,0 +1,118 @@
1
+ # Weaviate CLI
2
+
3
+ <img src="https://raw.githubusercontent.com/semi-technologies/weaviate/19de0956c69b66c5552447e84d016f4fe29d12c9/docs/assets/weaviate-logo.png" width="180" align="right" alt="Weaviate logo">
4
+
5
+ [![Build Status](https://github.com/weaviate/weaviate-cli/actions/workflows/main.yaml/badge.svg)](https://github.com/weaviate/weaviate-cli/actions/workflows/main.yaml)
6
+ [![PyPI version](https://badge.fury.io/py/weaviate-cli.svg)](https://badge.fury.io/py/weaviate-cli)
7
+
8
+ A powerful command-line interface for managing and interacting with Weaviate vector databases directly from your terminal.
9
+
10
+ ## Key Features
11
+ - **Collections**: Create, update, delete and get collection configurations
12
+ - **Data Management**: Import, query, update and delete data with various search types (vector, keyword, hybrid)
13
+ - **Multi-tenancy**: Manage tenants and their states across collections
14
+ - **Backup & Restore**: Create and restore backups with support for S3, GCS and filesystem
15
+ - **Sharding**: Monitor and manage collection shards
16
+ - **Flexible Configuration**: Configure vector indexes, replication, consistency levels and more
17
+
18
+ ## Quick Start
19
+ Install using pip:
20
+
21
+ ```bash
22
+ pip install weaviate-cli
23
+ ```
24
+
25
+ ## Basic Usage
26
+
27
+ ```bash
28
+ # Show available commands
29
+ weaviate-cli --help
30
+
31
+ # Create a collection
32
+ weaviate-cli create collection --collection movies --vectorizer transformers
33
+
34
+ # Import test data
35
+ weaviate-cli create data --collection movies --limit 1000
36
+
37
+ # Query data
38
+ weaviate-cli query data --collection movies --search-type hybrid --query "action movies"
39
+ ```
40
+
41
+ ## Core Commands
42
+
43
+ - **create**: Create collections, tenants, backups or import data
44
+ - **delete**: Remove collections, tenants or data
45
+ - **update**: Modify collection settings, tenant states or data
46
+ - **get**: Retrieve collection info, tenant details or shard status
47
+ - **query**: Search data using various methods
48
+ - **restore**: Restore backups from supported backends
49
+
50
+ ## Configuration
51
+
52
+ Weaviate CLI allows you to configure your cluster endpoints and parameters through a configuration file. By default, the CLI looks for a
53
+ configuration file at `~/.config/weaviate/config.json`. If this file does not exist, it will be created with the following default values:
54
+
55
+ ```json
56
+ {
57
+ "host": "localhost",
58
+ "http_port": "8080",
59
+ "grpc_port": "50051"
60
+ }
61
+ ```
62
+
63
+ You can also specify your own configuration file using the `--config-file` option:
64
+
65
+ ```bash
66
+ weaviate-cli --config-file /path/to/your/config.json
67
+ ```
68
+
69
+ The configuration file should be a JSON file with the following structure:
70
+
71
+ ```json
72
+ {
73
+ "host": "your-weaviate-host",
74
+ "http_port": "your-http-port",
75
+ "grpc_port": "your-grpc-port",
76
+ "auth": {
77
+ "type": "api_key",
78
+ "api_key": "your-api-key"
79
+ }
80
+ }
81
+ ```
82
+
83
+ If you are using a remote Weaviate instance, you can use the `weaviate-cli` command to authenticate with your Weaviate instance.
84
+ Here you can see an example on how the configuration file should look like if you are connecting to a WCD cluster:
85
+
86
+ ```json
87
+ {
88
+ "host": "thisisaninventedcluster.url.s3.us-west3.prov.weaviate.cloud",
89
+ "auth": {
90
+ "type": "api_key",
91
+ "api_key": "jfeRFsdfRfSasgsDoNOtTrYToUsErRQwqqdZfghasd"
92
+ }
93
+ }
94
+ ```
95
+
96
+ ## Requirements
97
+
98
+ - Python 3.9+
99
+ - Weaviate instance (local or remote)
100
+
101
+ ## Documentation
102
+
103
+ Detailed documentation will be added soon.
104
+
105
+ ## Community & Support
106
+
107
+ - [Slack Community](https://weaviate.io/slack) - Join our active community
108
+ - [Stack Overflow](https://stackoverflow.com/questions/tagged/weaviate) - Search using the `weaviate` tag
109
+ - [GitHub Issues](https://github.com/weaviate/weaviate-cli/issues) - Report bugs or request features
110
+
111
+ ## Contributing
112
+
113
+ We welcome contributions! Please see our [Contributing Guidelines](https://github.com/weaviate/weaviate-cli/blob/main/CONTRIBUTING.md) for
114
+ details.
115
+
116
+ ## License
117
+
118
+ BSD-3-Clause License
@@ -0,0 +1,55 @@
1
+ import click
2
+ import sys
3
+ from weaviate_cli.managers.config_manager import ConfigManager
4
+ from weaviate_cli.commands.create import create
5
+ from weaviate_cli.commands.delete import delete
6
+ from weaviate_cli.commands.get import get
7
+ from weaviate_cli.commands.update import update
8
+ from weaviate_cli.commands.query import query
9
+ from weaviate_cli.commands.restore import restore
10
+ from weaviate_cli import __version__
11
+
12
+
13
+ def print_version(ctx, param, value):
14
+ if not value or ctx.resilient_parsing:
15
+ return
16
+ click.echo(f"Weaviate CLI version {__version__}")
17
+ ctx.exit()
18
+
19
+
20
+ @click.group()
21
+ @click.option(
22
+ "--config-file",
23
+ required=False,
24
+ default=None,
25
+ type=str,
26
+ is_flag=False,
27
+ help="If specified cli uses the config specified with this path.",
28
+ )
29
+ @click.option(
30
+ "--version",
31
+ is_flag=True,
32
+ callback=print_version,
33
+ expose_value=False,
34
+ is_eager=True,
35
+ help="Prints the version of the CLI.",
36
+ )
37
+ @click.pass_context
38
+ def main(ctx: click.Context, config_file):
39
+ """Weaviate CLI tool"""
40
+ try:
41
+ ctx.obj = {"config": ConfigManager(config_file)}
42
+ except Exception as e:
43
+ click.echo(f"Fatal Error: {e}")
44
+ sys.exit(1)
45
+
46
+
47
+ main.add_command(create)
48
+ main.add_command(delete)
49
+ main.add_command(get)
50
+ main.add_command(update)
51
+ main.add_command(restore)
52
+ main.add_command(query)
53
+
54
+ if __name__ == "__main__":
55
+ main()
@@ -0,0 +1,8 @@
1
+ 1. Set the new version in the `weaviate/version.py` and `test/test_version.py`.
2
+ 2. Run all tests. (Check `test/README.md`)
3
+ 3. Check if you are on the correct **GitBranch**.
4
+ 4. **Commit** the most current version to GitHub if this has not been done yet.
5
+ 5. Give the commit of the current version a proper tag:\
6
+ `git tag -a '<your tag>' -m '<some message for the tag>' && git push --tags`
7
+ Tags are either in the form of `v0.2.5` or `v0.2.5rc0`.
8
+ 6. The release workflow defined in `.github/workflows/release.yaml` will take care of building, creating the release, and pushing to PyPI.
@@ -0,0 +1,19 @@
1
+ [build-system]
2
+ requires = [
3
+ "setuptools >= 65",
4
+ "setuptools_scm[toml] >6.2",
5
+ "wheel >= 0.38.1",
6
+ ]
7
+ build-backend = 'setuptools.build_meta'
8
+
9
+ [tool.setuptools_scm]
10
+
11
+ [tool.black]
12
+ line-length = 88
13
+ target-version = ['py311']
14
+ include = '\.pyi?$'
15
+ extend-exclude = '''
16
+ # A regex preceded with ^/ will apply only to files and directories
17
+ # in the root of the project.
18
+ ^/docs
19
+ '''
@@ -0,0 +1,13 @@
1
+ weaviate-client>=4.0.0
2
+ click==8.1.7
3
+ twine
4
+ pytest
5
+ semver==3.0.2
6
+ numpy>=1.24.0
7
+ build
8
+ wheel
9
+ importlib_metadata==8.5.0
10
+ importlib-resources>=5.0.0
11
+ setuptools_scm
12
+ black==24.3.0
13
+ pre-commit==3.6.2