Repository navigation
add build script for tiktoken 0.13.0 #8332
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 hidden or 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,19 +1,22 @@ | ||
| { | ||
| "maintainer": "aastha-sharma2", | ||
| "maintainer": "varsha.kumar@ibm.com", | ||
| "package_name": "tiktoken", | ||
| "github_url": "https://github.com/openai/tiktoken", | ||
| "version": "0.7.0", | ||
| "version": "0.13.0", | ||
| "default_branch": "main", | ||
| "build_script": "tiktoken_ubi_9.3.sh", | ||
| "wheel_build" : true, | ||
| "package_dir": "t/tiktoken", | ||
| "docker_build": false, | ||
| "validate_build_script": true, | ||
| "use_non_root_user": false, | ||
| "v0.13.0":{ | ||
| "build_script": "tiktoken_v0.13.0_ubi_9.6.sh" | ||
| }, | ||
| "v0.9.0" :{ | ||
| "build_script": "tiktoken_v0.9.0_ubi_9.6.sh" | ||
| }, | ||
| "*": { | ||
| "build_script": "tiktoken_ubi_9.3.sh" | ||
| "build_script": "tiktoken_ubi_9.6.sh" | ||
| } | ||
| } | ||
This file contains hidden or 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,124 @@ | ||
| #!/bin/bash -e | ||
| # ----------------------------------------------------------------------------- | ||
| # | ||
| # Package : tiktoken | ||
| # Version : v0.13.0 | ||
| # Source repo : https://github.com/openai/tiktoken | ||
| # Tested on : UBI:9.6 | ||
| # Language : Python | ||
| # Ci-Check : True | ||
| # Script License: Apache License, Version 2 or later | ||
| # Maintainer : Varsha Kumar <varsha.kumar@ibm.com> | ||
| # | ||
| # Disclaimer: This script has been tested in root mode on given | ||
| # ========== platform using the mentioned version of the package. | ||
| # It may not work as expected with newer versions of the | ||
| # package and/or distribution. In such case, please | ||
| # contact "Maintainer" of this script. | ||
| # | ||
| # ---------------------------------------------------------------------------- | ||
|
|
||
| # Variables | ||
| PACKAGE_NAME=tiktoken | ||
| PACKAGE_VERSION=${1:-0.13.0} | ||
| PACKAGE_URL=https://github.com/openai/tiktoken.git | ||
| PACKAGE_DIR=tiktoken | ||
|
|
||
| # Install dependencies | ||
| yum install -y git python3.12 python3.12-devel python3.12-pip gcc-toolset-13 make wget sudo cmake | ||
| python3.12 -m pip install --upgrade pip | ||
| python3.12 -m pip install pytest tox nox hypothesis | ||
|
|
||
| # Install Rust | ||
| echo "Installing Rust" | ||
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
| source "$HOME/.cargo/env" | ||
| rustup update | ||
| echo "Installed Rust" | ||
|
|
||
|
|
||
| export PATH=$PATH:/usr/local/bin/ | ||
| export PATH=/opt/rh/gcc-toolset-13/root/usr/bin:$PATH | ||
| export LD_LIBRARY_PATH=/opt/rh/gcc-toolset-13/root/usr/lib64:$LD_LIBRARY_PATH | ||
|
|
||
| OS_NAME=$(grep ^PRETTY_NAME /etc/os-release | cut -d= -f2) | ||
| SOURCE=Github | ||
|
|
||
| # Clone or extract the package | ||
| if [[ "$PACKAGE_URL" == *github.com* ]]; then | ||
| if [ -d "$PACKAGE_DIR" ]; then | ||
| cd "$PACKAGE_DIR" || exit | ||
| else | ||
| if ! git clone "$PACKAGE_URL" "$PACKAGE_DIR"; then | ||
| echo "------------------$PACKAGE_NAME:clone_fails---------------------------------------" | ||
| echo "$PACKAGE_URL $PACKAGE_NAME" | ||
| echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Clone_Fails" | ||
| exit 1 | ||
| fi | ||
| cd "$PACKAGE_DIR" || exit | ||
| git checkout "$PACKAGE_VERSION" || exit | ||
| fi | ||
| else | ||
| if [ -d "$PACKAGE_DIR" ]; then | ||
| cd "$PACKAGE_DIR" || exit | ||
| else | ||
| if ! curl -L "$PACKAGE_URL" -o "$PACKAGE_DIR.tar.gz"; then | ||
| echo "------------------$PACKAGE_NAME:download_fails---------------------------------------" | ||
| echo "$PACKAGE_URL $PACKAGE_NAME" | ||
| echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Download_Fails" | ||
| exit 1 | ||
| fi | ||
| mkdir "$PACKAGE_DIR" | ||
| if ! tar -xzf "$PACKAGE_DIR.tar.gz" -C "$PACKAGE_DIR" --strip-components=1; then | ||
| echo "------------------$PACKAGE_NAME:untar_fails---------------------------------------" | ||
| echo "$PACKAGE_URL $PACKAGE_NAME" | ||
| echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Untar_Fails" | ||
| exit 1 | ||
| fi | ||
| cd "$PACKAGE_DIR" || exit | ||
| fi | ||
| fi | ||
|
|
||
| # Install the package | ||
| if ! python3.12 -m pip install ./; then | ||
| echo "------------------$PACKAGE_NAME:install_fails------------------------" | ||
| echo "$PACKAGE_URL $PACKAGE_NAME" | ||
| echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Install_Failed" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # ------------------ Unified Test Execution Block ------------------ | ||
|
|
||
| test_status=1 # 0 = success, non-zero = failure | ||
|
|
||
| # Run pytest if any matching test files found | ||
| if ls */test_*.py > /dev/null 2>&1 && [ $test_status -ne 0 ]; then | ||
| echo "Running pytest..." | ||
| # Creating temporary directory because of circular import error | ||
| (cp -r tests /tmp/tiktoken_tests && cd /tmp && python3.12 -m pytest tiktoken_tests/) && test_status=0 || test_status=$? | ||
| fi | ||
|
|
||
| # Run tox if tox.ini is present and previous tests failed | ||
| if [ -f "tox.ini" ] && [ $test_status -ne 0 ]; then | ||
| echo "Running tox..." | ||
| (python3.12 -m tox -e py39) && test_status=0 || test_status=$? | ||
| fi | ||
|
|
||
| # Run nox if noxfile.py is present and previous tests failed | ||
| if [ -f "noxfile.py" ] && [ $test_status -ne 0 ]; then | ||
| echo "Running nox..." | ||
| (python3.12 -m nox) && test_status=0 || test_status=$? | ||
| fi | ||
|
|
||
| # Final test result output | ||
| if [ $test_status -eq 0 ]; then | ||
| echo "------------------$PACKAGE_NAME:install_and_test_both_success-------------------------" | ||
| echo "$PACKAGE_URL $PACKAGE_NAME" | ||
| echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Pass | Both_Install_and_Test_Success" | ||
| exit 0 | ||
| else | ||
| echo "------------------$PACKAGE_NAME:install_success_but_test_fails---------------------" | ||
| echo "$PACKAGE_URL $PACKAGE_NAME" | ||
| echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | $SOURCE | Fail | Install_success_but_test_Fails" | ||
| exit 2 | ||
| fi |
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.