diff --git a/.github/workflows/python-compatibility.yml b/.github/workflows/python-compatibility.yml new file mode 100644 index 00000000..a60f8f46 --- /dev/null +++ b/.github/workflows/python-compatibility.yml @@ -0,0 +1,171 @@ +# Python Compatibility Testing Workflow +# +# Tests Python package build compatibility across: +# - Operating Systems: Ubuntu, macOS, Windows +# - Python Versions: 3.9, 3.10, 3.11, 3.12, 3.13 +# +# Validates that the package can be built and installed correctly +# on all supported platforms and Python versions. + +name: Python Compatibility Check + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + workflow_dispatch: + push: + pull_request: + +env: + # Change this to invalidate existing cache. + CACHE_PREFIX: v0 + PYTHON_PATH: ./ + +permissions: + contents: read + +jobs: + checks: + name: Python ${{ matrix.python }} - ${{ matrix.os }} - ${{ matrix.task.name }} + runs-on: ${{ matrix.os }} + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python: ['3.9', '3.10', '3.11', '3.12', '3.13'] + task: + - name: Build + run: | + pip list + pip install twine + pip install --upgrade setuptools wheel + pip list + python setup.py check + python setup.py bdist_wheel sdist + twine check ./dist/* + + steps: + - uses: actions/checkout@v3 + + - name: Setup Python + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python }} + + - name: Install prerequisites + run: | + python -m pip install --upgrade pip setuptools wheel + + - name: Set build variables + shell: bash + run: | + echo "PYTHON_VERSION=$(python --version)" >> $GITHUB_ENV + + - name: Test dependency wheels availability - Unix/Linux/macOS + if: runner.os != 'Windows' + run: | + python -m venv .venv-deps-test + . .venv-deps-test/bin/activate + # Try installing with wheel-only first to catch dependency conflicts early + pip install --only-binary=:all: -r requirements.txt || { + echo "Warning: Some dependencies may not have wheels available" + echo "Attempting installation with source packages allowed..." + pip install -r requirements.txt + } + deactivate + rm -rf .venv-deps-test + shell: bash + + - name: Test dependency wheels availability - Windows + if: runner.os == 'Windows' + run: | + python -m venv .venv-deps-test + .venv-deps-test\Scripts\Activate.ps1 + # Try installing with wheel-only first to catch dependency conflicts early + pip install --only-binary=:all: -r requirements.txt + if ($LASTEXITCODE -ne 0) { + Write-Host "Warning: Some dependencies may not have wheels available" + Write-Host "Attempting installation with source packages allowed..." + pip install -r requirements.txt + } + deactivate + Remove-Item -Recurse -Force .venv-deps-test + shell: pwsh + + - name: Setup virtual environment - Unix/Linux/macOS + if: runner.os != 'Windows' + run: | + python -m venv .venv + . .venv/bin/activate + pip install -e .[dev] + shell: bash + + - name: Setup virtual environment - Windows + if: runner.os == 'Windows' + run: | + python -m venv .venv + .venv\Scripts\Activate.ps1 + pip install -e .[dev] + shell: pwsh + + - name: Show environment info - Unix/Linux/macOS + if: runner.os != 'Windows' + run: | + . .venv/bin/activate + which python + python --version + pip freeze + # Node.js version info - uncomment if you need to verify Node.js/npm/pnpm versions + # which node + # node --version + # npm --version + # pnpm --version + shell: bash + + - name: Show environment info - Windows + if: runner.os == 'Windows' + run: | + .venv\Scripts\Activate.ps1 + Get-Command python + python --version + pip freeze + # Node.js version info - uncomment if you need to verify Node.js/npm/pnpm versions + # Get-Command node + # node --version + # npm --version + # pnpm --version + shell: pwsh + + # Web build steps - tests TypeScript/web components compilation and bundling + # Uncomment if you need to verify that web components work with your Python package changes + # - name: Build Web + # run: | + # pnpm build:typespec + # pnpm build:web + # pnpm bundle + # env: + # CI: false + + # TypeSpec emitter testing - tests the TypeSpec-to-code generation functionality + # Uncomment if you need to verify TypeSpec emitter compatibility with your Python changes + # - name: Test Typespec-aaz Emitter + # run: | + # pnpm test-aaz-emitter + + - name: ${{ matrix.task.name }} - Unix/Linux/macOS + if: runner.os != 'Windows' + run: | + . .venv/bin/activate + ${{ matrix.task.run }} + shell: bash + + - name: ${{ matrix.task.name }} - Windows + if: runner.os == 'Windows' + run: | + .venv\Scripts\Activate.ps1 + ${{ matrix.task.run }} + shell: pwsh + diff --git a/README.md b/README.md index 31c83def..4fafdc60 100644 --- a/README.md +++ b/README.md @@ -21,12 +21,12 @@ After clone you can add `upstream` for every repos in your local clone by using ### 2 Setup python #### 2.1 Install python -Please install python with version >= 3.8 and <= 3.12 in your local machine. +Please install python with version >= 3.9 and <= 3.13 in your local machine. - For windows: You can download and run full installer from [Python Download](https://www.python.org/downloads/). - For linux: You can install python from Package Manager or build a stable relase from source code -Check the version of python, make use it's not less than 3.8. +Check the version of python, make use it's not less than 3.9. - For windows: You can run: ```PowerShell diff --git a/docs/pages/usage/setup_and_run.md b/docs/pages/usage/setup_and_run.md index 457dc365..183f9e4b 100644 --- a/docs/pages/usage/setup_and_run.md +++ b/docs/pages/usage/setup_and_run.md @@ -17,7 +17,7 @@ weight: 100 ### Install python -This tool is compatible with python versions >=3.8 and <=3.12. You can use an existing python or install a new one by the following ways: +This tool is compatible with python versions >=3.9 and <=3.13. You can use an existing python or install a new one by the following ways: - For Windows users: You can download and run full installer from [Python Download](https://www.python.org/downloads/). - For Linux users: You can install python from Package Manager or build a stable release from source code diff --git a/requirements.txt b/requirements.txt index 96333700..42054e8f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,13 +2,13 @@ schematics~=2.1.1 pyyaml~=6.0.2 fuzzywuzzy~=0.18.0 pluralizer~=1.2.0 -lxml~=4.9.4 +lxml>=5.0.0 flask~=3.0.3 cachelib~=0.13.0 xmltodict~=0.13.0 packaging>=21.3 Jinja2~=3.1.4 -MarkupSafe~=2.1.5 +MarkupSafe>=2.1.5 jsonschema~=4.23.0 click~=8.1.2 setuptools==70.0.0 diff --git a/setup.py b/setup.py index 8a0135e5..71adc6ca 100644 --- a/setup.py +++ b/setup.py @@ -50,9 +50,11 @@ def fix_url_dependencies(req: str) -> str: "Environment :: Console", "License :: OSI Approved :: MIT License", "Natural Language :: English", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10" + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13" ], keywords="azure", url="https://github.com/Azure/aaz-dev-tools", @@ -68,7 +70,7 @@ def fix_url_dependencies(req: str) -> str: ), include_package_data=True, install_requires=read_requirements("requirements.txt"), - python_requires=">=3.8", + python_requires=">=3.9", entry_points={ "console_scripts": ["aaz-dev=aaz_dev.app.main:main"] }, diff --git a/src/aaz_dev/cli/templates/extension/setup.py.j2 b/src/aaz_dev/cli/templates/extension/setup.py.j2 index edd4dfe1..4354216c 100644 --- a/src/aaz_dev/cli/templates/extension/setup.py.j2 +++ b/src/aaz_dev/cli/templates/extension/setup.py.j2 @@ -17,9 +17,11 @@ CLASSIFIERS = [ 'Intended Audience :: System Administrators', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', 'License :: OSI Approved :: MIT License', ] diff --git a/src/aaz_dev/cli/tests/extension_tests/output/az-firewall/setup.py b/src/aaz_dev/cli/tests/extension_tests/output/az-firewall/setup.py index cefbda4e..b8765f82 100644 --- a/src/aaz_dev/cli/tests/extension_tests/output/az-firewall/setup.py +++ b/src/aaz_dev/cli/tests/extension_tests/output/az-firewall/setup.py @@ -20,9 +20,11 @@ 'Intended Audience :: System Administrators', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', 'License :: OSI Approved :: MIT License', ] diff --git a/src/aaz_dev/cli/tests/extension_tests/output/new-extension/setup.py b/src/aaz_dev/cli/tests/extension_tests/output/new-extension/setup.py index 7962c972..2b3ba11a 100644 --- a/src/aaz_dev/cli/tests/extension_tests/output/new-extension/setup.py +++ b/src/aaz_dev/cli/tests/extension_tests/output/new-extension/setup.py @@ -20,9 +20,11 @@ 'Intended Audience :: System Administrators', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13', 'License :: OSI Approved :: MIT License', ]