forked from openai/tiktoken
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat(rust): Convert project to a multi-crate workspace
This commit restructures the project from a single-crate workspace into a multi-crate workspace, dividing it into 'rs-tiktoken' and 'py-tiktoken'. This is done to improve the clarity of the organization of the codebase and make the Rust and Python modules separate for easier code maintenance. The setup.py is also updated to reflect these changes in the directory structure. Refs: openai#24
- Loading branch information
Showing
14 changed files
with
50,608 additions
and
93 deletions.
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 |
---|---|---|
|
@@ -30,8 +30,8 @@ jobs: | |
name: dist | ||
path: ./wheelhouse/*.whl | ||
|
||
build_wheels_aarch64: | ||
name: py${{ matrix.python-version }} on ${{ matrix.os }} (aarch64) | ||
build_wheels_aarch64_glibc: | ||
name: py${{ matrix.python-version }} on ${{ matrix.os }} (aarch64/glibc) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
|
@@ -52,6 +52,38 @@ jobs: | |
env: | ||
CIBW_BUILD: "cp${{ matrix.python-version}}-*" | ||
CIBW_ARCHS: aarch64 | ||
CIBW_SKIP: "*musllinux*" | ||
CIBW_BUILD_VERBOSITY: 3 | ||
# https://github.com/rust-lang/cargo/issues/10583 | ||
CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI=true | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist | ||
path: ./wheelhouse/*.whl | ||
|
||
build_wheels_aarch64_musl: | ||
name: py${{ matrix.python-version }} on ${{ matrix.os }} (aarch64/musl) | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest] | ||
python-version: [38, 39, 310, 311] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
with: | ||
platforms: arm64 | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
env: | ||
CIBW_BUILD: "cp${{ matrix.python-version}}-*" | ||
CIBW_ARCHS: aarch64 | ||
CIBW_SKIP: "*manylinux*" | ||
CIBW_BUILD_VERBOSITY: 3 | ||
# https://github.com/rust-lang/cargo/issues/10583 | ||
CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin" CARGO_NET_GIT_FETCH_WITH_CLI=true | ||
|
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,21 +1,12 @@ | ||
[package] | ||
name = "tiktoken" | ||
[workspace] | ||
resolver = "2" | ||
members = [ | ||
"rs-tiktoken", | ||
"py-tiktoken", | ||
] | ||
|
||
[workspace.package] | ||
version = "0.4.0" | ||
edition = "2021" | ||
rust-version = "1.57.0" | ||
|
||
[lib] | ||
name = "_tiktoken" | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
pyo3 = { version = "0.19.0", features = ["extension-module"] } | ||
|
||
# tiktoken dependencies | ||
fancy-regex = "0.11.0" | ||
regex = "1.8.3" | ||
rustc-hash = "1.1.0" | ||
bstr = "1.5.0" | ||
|
||
[profile.release] | ||
incremental = true |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[package] | ||
name = "py-tiktoken" | ||
version.workspace = true | ||
edition = "2021" | ||
rust-version = "1.57.0" | ||
|
||
[lib] | ||
name = "_tiktoken" | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
tiktoken = { path = "../rs-tiktoken" } | ||
pyo3 = { version = "0.19.0", features = ["extension-module"] } | ||
once_cell = "1.18.0" | ||
|
||
# tiktoken dependencies | ||
fancy-regex = "0.11.0" | ||
regex = "1.8.3" | ||
rustc-hash = "1.1.0" | ||
bstr = "1.5.0" |
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 @@ | ||
pub mod tiktoken_py; |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "tiktoken" | ||
version.workspace = true | ||
edition = "2021" | ||
rust-version = "1.57.0" | ||
|
||
[dependencies] | ||
fancy-regex = "0.11.0" | ||
regex = "1.8.3" | ||
rustc-hash = "1.1.0" | ||
bstr = "1.5.0" | ||
once_cell = "1.18.0" | ||
parse-display = "0.8.2" |
Oops, something went wrong.