From cf04492ef3724474fdc04758d847d73643b7729b Mon Sep 17 00:00:00 2001 From: David Onuh Date: Sat, 9 Nov 2024 20:15:53 +0100 Subject: [PATCH 1/4] preparing version files for ahnlich launch --- README.md | 53 +++++++++++++++++++++++++++++++++-- ahnlich/Cargo.lock | 10 +++---- ahnlich/Makefile | 4 +++ ahnlich/ai/Cargo.toml | 2 +- ahnlich/cli/Cargo.toml | 2 +- ahnlich/client/Cargo.toml | 2 +- ahnlich/db/Cargo.toml | 2 +- ahnlich/types/Cargo.toml | 2 +- sdk/ahnlich-client-py/MSG_TAG | 1 - sdk/ahnlich-client-py/VERSION | 4 +-- 10 files changed, 66 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index cbd04a2b..a03a254e 100644 --- a/README.md +++ b/README.md @@ -82,11 +82,58 @@ In order to communicate effectively with the ahnlich db, you would have to exten Your message(in bytes) should be serialized and deserialized in the following format => `AHNLICH_HEADERS` + `VERSION` + `QUERY/SERVER_RESPONSE`. Bytes are `Little Endian`. -### How Client Releases Work +### Version Format -The clients follow a similar process when deploying new releases. -[Example with python client](https://github.com/deven96/ahnlich/blob/main/sdk/ahnlich-client-py/README.md#deploy-to-artifactory). +`//` +Where: +- TYPE: Bin, Client, +- NAME: AI, DB, PY, RS +- VERSION_NUMBER: Semver + + +### How Deployments and Releases Work + +Ahnlich maintains two separate versioning systems: **Protocol Versions** and **Client Versions**. Understanding how these interact is key to managing releases across binaries, libraries, and Docker images. + +#### Protocol and Client Versioning +- The **Protocol Version** represents changes to the underlying communication standard between different Ahnlich components. Major bump to this version can introduce breaking changes, meaning requests made by outdated clients will be rejected. +- The **Client Version** tracks updates to the client libraries. These are versioned separately but are often synchronized with protocol updates to ensure compatibility. + +##### Bumping Protocol Versions +- To bump both the Protocol and Client versions simultaneously, use the following command: + ```bash + make bump-protocol-version BUMP_RULE=[major, minor, patch] + ``` + This will trigger deployments for all relevant binaries (like AI, CLI, and DB) as well as client libraries. +- Major changes to the Protocol Version may involve breaking changes, so ahnlich AI or DB rejects a connection when the major version don't match. + +##### Bumping Individual Package/Crate Versions +- The Makefile contains additional commands for selectively bumping versions of crate or lib within the workspace. + +#### Releasing New Binaries (AI, CLI, DB), Images and Client Libs +When deploying new binaries, the updated versions are pushed to their respective Artifactory repositories. The workflow is as follows: + +##### Binaries and Docker Images +1. **Bump the Protocol Version**: Use the appropriate Makefile commands to bump versions for AI, CLI, or DB binaries or client Libs. + +2. Submit a PR to main +3. Once merged, Create a tag using the the ahnlich tag format +4. Create a Release from tag which triggers building of binaries and docker images + +##### Client Libraries (Example Python) + +- Update the `MSG_TAG` file with a new tag message. +- From a feature branch, bump the version using: + ```bash + make bump-py-client BUMP_RULE=[major, minor, patch] + ``` + or + ```bash + poetry run bumpversion [major, minor, patch] + ``` +- Open a PR to Main +- Once merged, this automatically creates a tags if a change to the version file is detected and deploys the lib to it's artifactory. diff --git a/ahnlich/Cargo.lock b/ahnlich/Cargo.lock index 79ec5947..db10b26a 100644 --- a/ahnlich/Cargo.lock +++ b/ahnlich/Cargo.lock @@ -38,7 +38,7 @@ dependencies = [ [[package]] name = "ahnlich_client_rs" -version = "0.1.0" +version = "0.0.0" dependencies = [ "ahnlich_types", "ai", @@ -70,7 +70,7 @@ dependencies = [ [[package]] name = "ahnlich_types" -version = "0.1.0" +version = "0.0.0" dependencies = [ "bincode", "fallible_collections", @@ -92,7 +92,7 @@ dependencies = [ [[package]] name = "ai" -version = "0.1.0" +version = "0.0.0" dependencies = [ "ahnlich_client_rs", "ahnlich_types", @@ -635,7 +635,7 @@ checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "cli" -version = "0.1.0" +version = "0.0.0" dependencies = [ "ahnlich_client_rs", "ahnlich_types", @@ -914,7 +914,7 @@ dependencies = [ [[package]] name = "db" -version = "0.1.0" +version = "0.0.0" dependencies = [ "ahnlich_similarity", "ahnlich_types", diff --git a/ahnlich/Makefile b/ahnlich/Makefile index 835dac44..82986df1 100644 --- a/ahnlich/Makefile +++ b/ahnlich/Makefile @@ -67,6 +67,10 @@ bump-protocol-version: ## Bump project versions. Rules for bumpversion: patch, m @cd $(RUST_PROJECT_DIR) && cargo set-version --bump $(BUMP_RULE) --package $(AHNLICH_AI_NAME) @echo "Ahnlich AI version bumped to $(BUMP_RULE)" + @echo "Bumping Rust client version with rule $(BUMP_RULE)" + @cd $(RUST_PROJECT_DIR) && cargo set-version --bump $(BUMP_RULE) --package $(RUST_CLIENT_NAME) + @echo "Rust client version bumped to $(BUMP_RULE)" + @echo "Bumping Python project version with rule $(BUMP_RULE)" @cd $(PYTHON_PROJECT_DIR) && poetry run bumpversion --component Protocol --bump-type $(BUMP_RULE) @echo "Python project version bumped using rule $(BUMP_RULE)" diff --git a/ahnlich/ai/Cargo.toml b/ahnlich/ai/Cargo.toml index e07b09d9..cb5e8c10 100644 --- a/ahnlich/ai/Cargo.toml +++ b/ahnlich/ai/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ai" -version = "0.1.0" +version = "0.0.0" edition = "2021" # only used for rust client test and not to be released diff --git a/ahnlich/cli/Cargo.toml b/ahnlich/cli/Cargo.toml index 2c5c1e38..b3897e1a 100644 --- a/ahnlich/cli/Cargo.toml +++ b/ahnlich/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cli" -version = "0.1.0" +version = "0.0.0" edition = "2021" [[bin]] diff --git a/ahnlich/client/Cargo.toml b/ahnlich/client/Cargo.toml index c2ea27a6..cad94597 100644 --- a/ahnlich/client/Cargo.toml +++ b/ahnlich/client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ahnlich_client_rs" -version = "0.1.0" +version = "0.0.0" authors = ["Diretnan Domnan "] categories = ["database-implementations", "database", "web-programming"] keywords = ["ahnlich", "in-memory", "artificial-intelligence", "ai"] diff --git a/ahnlich/db/Cargo.toml b/ahnlich/db/Cargo.toml index 4a82b6d1..6f518e92 100644 --- a/ahnlich/db/Cargo.toml +++ b/ahnlich/db/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "db" -version = "0.1.0" +version = "0.0.0" edition = "2021" [[bin]] diff --git a/ahnlich/types/Cargo.toml b/ahnlich/types/Cargo.toml index 441ce285..f774a73a 100644 --- a/ahnlich/types/Cargo.toml +++ b/ahnlich/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ahnlich_types" -version = "0.1.0" +version = "0.0.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/sdk/ahnlich-client-py/MSG_TAG b/sdk/ahnlich-client-py/MSG_TAG index b7c68c5f..e69de29b 100644 --- a/sdk/ahnlich-client-py/MSG_TAG +++ b/sdk/ahnlich-client-py/MSG_TAG @@ -1 +0,0 @@ -Add AI Client for AI Proxy \ No newline at end of file diff --git a/sdk/ahnlich-client-py/VERSION b/sdk/ahnlich-client-py/VERSION index d0ba9345..60341a67 100644 --- a/sdk/ahnlich-client-py/VERSION +++ b/sdk/ahnlich-client-py/VERSION @@ -1,2 +1,2 @@ -CLIENT="0.3.0" -PROTOCOL="0.1.0" +CLIENT="0.0.0" +PROTOCOL="0.0.0" From 2060b96c9c0f064076ad4d510ca99ab074de2915 Mon Sep 17 00:00:00 2001 From: David Onuh Date: Sat, 9 Nov 2024 20:29:44 +0100 Subject: [PATCH 2/4] rust and python clients now deploy to crates.io and pypi --- .github/workflows/python_tag_and_deploy.yml | 6 ++---- .github/workflows/rust_tag_and_deploy.yml | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/python_tag_and_deploy.yml b/.github/workflows/python_tag_and_deploy.yml index b4fa4ec4..103c0939 100644 --- a/.github/workflows/python_tag_and_deploy.yml +++ b/.github/workflows/python_tag_and_deploy.yml @@ -81,9 +81,7 @@ jobs: working-directory: ./sdk/ahnlich-client-py run: | echo "Deploying tag ${{needs.check_version_changes_and_tag.outputs.client_version}}" - poetry config repositories.test-pypi https://test.pypi.org/legacy/ - poetry run change_poetry_version - poetry config pypi-token.test-pypi ${{ secrets.TEST_PYPI_TOKEN }} - poetry build && poetry publish -r test-pypi + poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} + poetry publish --build diff --git a/.github/workflows/rust_tag_and_deploy.yml b/.github/workflows/rust_tag_and_deploy.yml index a97d7109..168485a6 100644 --- a/.github/workflows/rust_tag_and_deploy.yml +++ b/.github/workflows/rust_tag_and_deploy.yml @@ -71,5 +71,5 @@ jobs: - name: Deploy using tag working-directory: ./ahnlich run: | - cargo publish -p ahnlich_types --dry-run --token '${{secrets.CARGO_TOKEN}}' - cargo publish -p ahnlich_client_rs --dry-run --token '${{secrets.CARGO_TOKEN}}' + cargo publish -p ahnlich_types --token '${{secrets.CARGO_TOKEN}}' + cargo publish -p ahnlich_client_rs --token '${{secrets.CARGO_TOKEN}}' From dca24b3d8bdd16510bbbb011be0003ae8ceaa319 Mon Sep 17 00:00:00 2001 From: David Onuh Date: Sat, 9 Nov 2024 20:36:12 +0100 Subject: [PATCH 3/4] change rust toolchain in workflow --- .github/workflows/release.yml | 2 +- .github/workflows/rust_tag_and_deploy.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 29ae23f0..257648fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ jobs: - name: Get Cargo toolchain uses: actions-rs/toolchain@v1 with: - toolchain: 1.78.0 + toolchain: 1.81.0 - name: Setup Zig uses: mlugg/setup-zig@v1 diff --git a/.github/workflows/rust_tag_and_deploy.yml b/.github/workflows/rust_tag_and_deploy.yml index 168485a6..b35f4dd0 100644 --- a/.github/workflows/rust_tag_and_deploy.yml +++ b/.github/workflows/rust_tag_and_deploy.yml @@ -66,7 +66,7 @@ jobs: - name: Get Cargo toolchain uses: actions-rs/toolchain@v1 with: - toolchain: 1.78.0 + toolchain: 1.81.0 - name: Deploy using tag working-directory: ./ahnlich From eaa1164899052af2d7487c0b97ca59be5ea4b7e4 Mon Sep 17 00:00:00 2001 From: David Onuh Date: Mon, 2 Dec 2024 11:11:02 +0100 Subject: [PATCH 4/4] final preparations for launch --- .github/workflows/python_tag_and_deploy.yml | 1 + ahnlich/client/README.md | 2 +- sdk/ahnlich-client-py/MSG_TAG | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/python_tag_and_deploy.yml b/.github/workflows/python_tag_and_deploy.yml index 103c0939..2176a378 100644 --- a/.github/workflows/python_tag_and_deploy.yml +++ b/.github/workflows/python_tag_and_deploy.yml @@ -81,6 +81,7 @@ jobs: working-directory: ./sdk/ahnlich-client-py run: | echo "Deploying tag ${{needs.check_version_changes_and_tag.outputs.client_version}}" + poetry run change_poetry_version poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} poetry publish --build diff --git a/ahnlich/client/README.md b/ahnlich/client/README.md index 214c7b86..3601ac3c 100644 --- a/ahnlich/client/README.md +++ b/ahnlich/client/README.md @@ -24,6 +24,6 @@ cargo add ahnlich_client_rs | Version| Description | | -------|:-------------:| -| 0.1.0 | Base Rust client to connect to ahnlich db. Bincode serialization and deserialization implemented | +| 0.0.0 | Base Rust client to connect to ahnlich db. Bincode serialization and deserialization implemented | diff --git a/sdk/ahnlich-client-py/MSG_TAG b/sdk/ahnlich-client-py/MSG_TAG index e69de29b..7197e6e4 100644 --- a/sdk/ahnlich-client-py/MSG_TAG +++ b/sdk/ahnlich-client-py/MSG_TAG @@ -0,0 +1,3 @@ +Heimdall, open the bifrost. +A Python client that interacts with both ahnlich DB and AI. Bincode serialization and deserialization implemented +