Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'

- name: Install Python dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gguf-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9.x'
python-version: '3.12'
- name: Install dependencies
run: |
cd gguf-py
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-check-requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.12"
- name: Run check-requirements.sh script
run: bash scripts/check-requirements.sh
6 changes: 3 additions & 3 deletions .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
id: setup_python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'

- name: Tests dependencies
id: test_dependencies
Expand Down Expand Up @@ -255,7 +255,7 @@ jobs:
id: setup_python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'

- name: Tests dependencies
id: test_dependencies
Expand Down Expand Up @@ -361,7 +361,7 @@ jobs:
id: setup_python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'

- name: Tests dependencies
id: test_dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snyk-security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
python-version: '3.12'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete Python Version Updates Across Workflows

This PR updates Python to 3.12 in several workflows, but there are additional workflow files that still reference older Python versions:

  1. .github/workflows/pre-tokenizer-hashes.yml - still at 3.11
  2. .github/workflows/python-type-check.yml - still at 3.11
  3. .github/workflows/python-lint.yml - still at 3.11

For consistency with this upgrade, these workflows should also be updated to Python 3.12.

Additionally, this workflow uses actions/setup-python@v4 while all other updated workflows use @v5. For consistency and to pick up latest fixes, please upgrade:

# Before
- name: Setup Python
  uses: actions/setup-python@v4
  with:
    python-version: '3.9'

# After
- name: Setup Python
  uses: actions/setup-python@v5
  with:
    python-version: '3.12'


- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-ops-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: '3.12'

- name: Generate operations documentation to temporary file
run: |
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ classifiers = [
]

[tool.poetry.dependencies]
python = ">=3.9"
python = ">=3.12"
numpy = "^1.25.0"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NumPy Compatibility Issue with Python 3.12

NumPy 1.25.0 does not have pre-built wheels for Python 3.12. I verified this by checking PyPI metadata - there are 0 wheels available for cp312. This will cause installation failures when users try to install dependencies with Python 3.12.

Recommendation: Bump numpy to a version that supports Python 3.12:

# Before
numpy = "^1.25.0"

# After (NumPy 1.26.0+ has Python 3.12 support)
numpy = "^1.26.0"

Additionally, please verify that other dependencies (transformers, sentencepiece, torch) have compatible versions available for Python 3.12. You can test this with:

python3.12 -m venv .venv && source .venv/bin/activate
pip install -e gguf-py

sentencepiece = ">=0.1.98,<=0.2.0"
transformers = ">=4.35.2,<5.0.0"
Expand Down
4 changes: 2 additions & 2 deletions tests/test-json-schema-to-grammar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1320,15 +1320,15 @@ int main() {
if (getenv("LLAMA_SKIP_TESTS_SLOW_ON_EMULATOR")) {
fprintf(stderr, "\033[33mWARNING: Skipping slow tests on emulator.\n\033[0m");
} else {
if (getenv("LLAMA_PYTHON_AVAILABLE") || (std::system("python -c \"import sys; exit(1) if sys.version_info < (3, 8) else print('Python version is sufficient')\"") == 0)) {
if (getenv("LLAMA_PYTHON_AVAILABLE") || (std::system("python -c \"import sys; exit(1) if sys.version_info < (3, 12) else print('Python version is sufficient')\"") == 0)) {
test_all("Python", [](const TestCase & tc) {
write("test-json-schema-input.tmp", tc.schema);
tc.verify_status(std::system(
"python ./examples/json_schema_to_grammar.py test-json-schema-input.tmp > test-grammar-output.tmp") == 0 ? SUCCESS : FAILURE);
tc.verify(read("test-grammar-output.tmp"));
});
} else {
fprintf(stderr, "\033[33mWARNING: Python not found (min version required is 3.8), skipping Python JSON schema -> grammar tests.\n\033[0m");
fprintf(stderr, "\033[33mWARNING: Python not found (min version required is 3.12), skipping Python JSON schema -> grammar tests.\n\033[0m");
Comment on lines +1323 to +1331

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python Executable Resolution Issue

The test checks for Python >=3.12 using the python command, but on many systems (especially Linux), python may not exist or may point to Python 2.x. The more reliable approach is to try python3 first, then fall back to python.

Recommendation:

// More robust version check that tries python3 first
const char *py3_check = "python3 -c \"import sys; exit(1) if sys.version_info < (3, 12) else print('Python version is sufficient')\"";
const char *py_check = "python -c \"import sys; exit(1) if sys.version_info < (3, 12) else print('Python version is sufficient')\"";

if (getenv("LLAMA_PYTHON_AVAILABLE") || 
    std::system(py3_check) == 0 || 
    std::system(py_check) == 0) {
    // run tests
} else {
    fprintf(stderr, "\033[33mWARNING: Python not found (min version required is 3.12), skipping Python JSON schema -> grammar tests.\n\033[0m");
}

This ensures the test works across different environments while maintaining the new 3.12 requirement.

}

if (getenv("LLAMA_NODE_AVAILABLE") || (std::system("node --version") == 0)) {
Expand Down
Loading