feat(python): add Python 3.12 support #53
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.
engine.connect()instead ofpd.read_sql_query.feat(python): add Python 3.12 support
SUMMARY
This PR adds official support for Python 3.12 to Apache Superset. The changes ensure compatibility with Python 3.12 while maintaining backward compatibility with Python 3.10 and 3.11.
Key changes:
setuptoolsto 68.2.2 andnumpyto >=1.26.0 to ensure Python 3.12 compatibilitypyproject.tomlclassifierssuperset-python-unittest.yml: Added "next" (maps to Python 3.12) to the test matrixpre-commit.yml: Already includes "next" in the matrixsetup-backend/action.yml: Maps "next" to Python 3.12pd.read_sql_query()calls withengine.connect()context manager pattern in:superset/models/helpers.pysuperset/connectors/sqla/models.py.gitignoreto exclude Python 3.12 virtual environment (.venv312) and.cursordirectoryRationale:
read_sql_query()engine.connect()is the recommended SQLAlchemy pattern and provides better resource managementBEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A - This is a backend compatibility change with no UI impact.
TESTING INSTRUCTIONS
Create a Python 3.12 virtual environment:
python3.12 -m venv .venv312 source .venv312/bin/activateInstall Superset:
pip install -r requirements/base.txt pip install -e .Run the comprehensive test script:
Verify all tests pass:
pip checkshould pass)Manual verification:
superset run -p 8088CI/CD verification:
ADDITIONAL INFORMATION