Skip to content
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

Python312 class names wat #102

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
e564e7c
Build for python 3.12
dflook Sep 19, 2023
5bf58f8
Add tests for python 3.12 new type parameter syntax
dflook Sep 19, 2023
0920e8f
Implement Python 3.12 type parameters
dflook Sep 19, 2023
008cd55
Fix version sourcing on Python 3.12
dflook Sep 19, 2023
6628f9a
Avoid using setuptools
dflook Sep 19, 2023
29147c2
Add empty manifest for 3.12
dflook Sep 20, 2023
e4a793e
Introduce backward compatible ast module
dflook Sep 23, 2023
e82874f
3.12-rc3
dflook Sep 25, 2023
1329e9d
Set namespace for TypeParam nodes
dflook Sep 26, 2023
4831e3b
Avoid using setuptools in corpus test
dflook Sep 26, 2023
85da9f8
Fix type warnings
dflook Sep 26, 2023
d3428a4
Skip testing incompatible python/ref
dflook Sep 26, 2023
2b85ff1
Fix stubtest
dflook Sep 27, 2023
b9a961d
Fix report generation with missing results
dflook Sep 27, 2023
ef4cf30
Fix corpus test
dflook Sep 27, 2023
420f84c
Update report for 3.12
dflook Sep 28, 2023
8800954
Fix report generation for empty result sets
dflook Sep 28, 2023
6731de2
Create wheel
dflook Sep 29, 2023
bd002c7
Retest with test-set-1
dflook Sep 30, 2023
c168261
Fix python2 package
dflook Sep 30, 2023
981e99e
Fix python2 wheel build
dflook Sep 30, 2023
f34ebbd
Add hypothesis tests for type parameters
dflook Sep 30, 2023
654a3e1
Rollback to actions/checkout@v3
dflook Jan 8, 2024
0a7cd60
Allow reusing quotes in f-strings
dflook Jan 9, 2024
710f128
Relax restrictions about backslashes in pep701 f-strings
dflook Jan 11, 2024
baee4a8
Wrap lambda expressions in parentheses
dflook Jan 11, 2024
0da44dc
Update python 12 build container to use Python 3.12.1
dflook Jan 12, 2024
34e4ede
Initial python 3.12 test manifest
dflook Jan 12, 2024
8492be8
Allow backslashes in pep701 f-strings
dflook Jan 13, 2024
6e00ae0
Don't hoist literals in __slots__
dflook Aug 6, 2024
3ed7c91
Add python3.12 xtest manifest
dflook Aug 6, 2024
a765c26
Fix test_no_hoist_slots
dflook Aug 6, 2024
326b0f3
f
dflook Aug 6, 2024
3343406
Fix no hoist __slots__ test on Python 2
dflook Aug 6, 2024
0552d38
Remove tests that don't work on actions runners
dflook Aug 6, 2024
4174192
Update to checkout v4
dflook Aug 6, 2024
3a008a0
Try and stop github from breaking my jobs
dflook Aug 6, 2024
9c2a03e
Remove test that can't pass in CI
dflook Aug 7, 2024
c2496f1
Fix test_no_hoist_slots
dflook Aug 7, 2024
bb9255e
Remove another test that doesn't work in CI
dflook Aug 7, 2024
8af0d1f
knock out another one that doesn't work in CI
dflook Aug 7, 2024
f236db3
Remove tests that rely on the behaviour of external systems
dflook Aug 8, 2024
194b5fc
Place Names bindings in load context within a ClassDef in non-local n…
dflook Aug 9, 2024
1bec27f
Disallow renaming for non-local names used in class scope in store co…
dflook Aug 9, 2024
0e961df
Add namespace tests
dflook Aug 17, 2024
705829d
Module level pytest skip is not available in pytest for 3.3
dflook Aug 18, 2024
c471c9e
Name constant binding is different in python3.3
dflook Aug 18, 2024
aac14c2
Split namespace tests out for python3.3
dflook Aug 20, 2024
ff618da
Skip async function test on python3.4
dflook Aug 20, 2024
7aa8df6
Try again
dflook Aug 20, 2024
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
1 change: 1 addition & 0 deletions .github/github_sucks
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

11 changes: 7 additions & 4 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ concurrency:
group: release
cancel-in-progress: false

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:

release:
runs-on: ubuntu-latest
container:
image: danielflook/python-minifier-build:python3.11-2022-10-25
image: danielflook/python-minifier-build:python3.12-2024-01-12
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -25,8 +28,8 @@ jobs:

- name: Build package
run: |
pip3 install --upgrade setuptools wheel
python3 setup.py sdist bdist_wheel --universal
pip3 install --upgrade build
python3 -m build

- uses: actions/upload-artifact@v3
with:
Expand All @@ -51,7 +54,7 @@ jobs:
id-token: write
environment:
name: pypi
url: https://pypi.org/project/python-minifier/
url: https://pypi.org/project/python-minifier/${{ github.event.release.tag_name }}
steps:
- uses: actions/download-artifact@v3
with:
Expand Down
103 changes: 82 additions & 21 deletions .github/workflows/release_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,81 @@ name: Release Test

on: [push]

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:

package:
name: Create Package
package_python3:
name: Create sdist and Python 3 Wheel
runs-on: ubuntu-latest
outputs:
sdist: ${{ steps.package.outputs.sdist }}
wheel: ${{ steps.package.outputs.wheel }}
container:
image: danielflook/python-minifier-build:python3.11-2022-10-25
image: danielflook/python-minifier-build:python3.12-2024-01-12
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
show-progress: false

- name: Set version statically
run: |
VERSION="$(python3 setup.py --version)"
pip3 install setuptools_scm
VERSION="$(python3 -m setuptools_scm)"
sed -i "s/setup_requires=.*/version='$VERSION',/; s/use_scm_version=.*//" setup.py

- name: Create Packages
id: package
run: |
pip3 install --upgrade setuptools wheel twine
python3 setup.py sdist bdist_wheel --universal
pip3 install --upgrade build
python3 -m build

echo "sdist=$(find dist -name '*.tar.gz' -printf "%f\n")" >> "$GITHUB_OUTPUT"
echo "wheel=$(find dist -name '*-py3-*.whl' -printf "%f\n")" >> "$GITHUB_OUTPUT"

- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
if-no-files-found: error

test_docs:
package_python2:
name: Create Python 2 Wheel
runs-on: ubuntu-latest
needs: [package_python3]
outputs:
wheel: ${{ steps.package.outputs.wheel }}
container:
image: danielflook/python-minifier-build:python2.7-2024-01-12
steps:
- uses: actions/download-artifact@v3
with:
name: dist
path: dist/

- name: Build wheel
id: package
run: |
dnf install -y findutils
pip install --upgrade wheel
pip wheel dist/${{ needs.package_python3.outputs.sdist }} -w dist
echo "wheel=$(find dist -name '*-py2-*.whl' -printf "%f\n")" >> "$GITHUB_OUTPUT"

- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
if-no-files-found: error

documentation:
name: Test Documentation
runs-on: ubuntu-latest
needs: [package]
needs: [package_python3]
container:
image: danielflook/python-minifier-build:python3.11-2022-10-25
image: danielflook/python-minifier-build:python3.12-2024-01-12
steps:
- uses: actions/download-artifact@v3
with:
Expand All @@ -45,11 +85,14 @@ jobs:

- name: Install package
run: |
pip3 install dist/*.tar.gz
pip3 install dist/${{needs.package_python3.outputs.sdist}}
pyminify --version

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
show-progress: false

- name: Build documentation
run: |
Expand All @@ -59,13 +102,14 @@ jobs:
test_package:
name: Test Package
runs-on: ubuntu-latest
needs: [package]
needs: [package_python3, package_python2]
strategy:
fail-fast: false
matrix:
python: ["2.7", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
package_type: [.tar.gz, .whl]
python: ["2.7", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
package_type: [sdist, wheel]
container:
image: danielflook/python-minifier-build:python${{ matrix.python }}-2022-10-25
image: danielflook/python-minifier-build:python${{ matrix.python }}-2024-01-12
steps:
- uses: actions/download-artifact@v3
with:
Expand All @@ -74,11 +118,21 @@ jobs:

- name: Install package
run: |
pip${{ matrix.python }} install dist/*${{ matrix.package_type }}
if [[ "${{ matrix.package_type }}" == "sdist" ]]; then
pip${{ matrix.python }} install dist/${{needs.package_python3.outputs.sdist}}
elif [[ "${{ matrix.python }}" == "2.7" ]]; then
pip${{ matrix.python }} install dist/${{needs.package_python2.outputs.wheel}}
else
pip${{ matrix.python }} install dist/${{needs.package_python3.outputs.wheel}}
fi

pyminify --version

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
show-progress: false

- name: Test pyminify
run: |
Expand All @@ -90,12 +144,12 @@ jobs:

test_typing:
runs-on: ubuntu-latest
needs: [package]
needs: [package_python3]
strategy:
matrix:
package_type: [.tar.gz, .whl]
package_type: [sdist, wheel]
container:
image: danielflook/python-minifier-build:python3.11-2022-10-25
image: danielflook/python-minifier-build:python3.12-2024-01-12
steps:
- uses: actions/download-artifact@v3
with:
Expand All @@ -104,19 +158,26 @@ jobs:

- name: Install package
run: |
pip3.11 install dist/*${{ matrix.package_type }}
if [[ "${{ matrix.package_type }}" == "sdist" ]]; then
pip3.12 install dist/${{needs.package_python3.outputs.sdist}}
else
pip3.12 install dist/${{needs.package_python3.outputs.wheel}}
fi

- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
show-progress: false

- name: Test typing
run: |
pip3.11 install mypy types-setuptools
pip3.12 install mypy types-setuptools
mypy --strict typing_test/test_typing.py

if mypy --strict typing_test/test_badtyping.py; then
echo "Bad types weren't detected"
exit 1
fi

stubtest python_minifier
stubtest python_minifier --allowlist typing_test/stubtest-allowlist.txt
7 changes: 5 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Unit Test

on: [push]

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:

test:
Expand All @@ -10,9 +13,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ["python2.7", "python3.3", "python3.4", "python3.5", "python3.6", "python3.7", "python3.8", "python3.9", "python3.10", "python3.11", "pypy", "pypy3"]
python: ["python2.7", "python3.3", "python3.4", "python3.5", "python3.6", "python3.7", "python3.8", "python3.9", "python3.10", "python3.11", "python3.12", "pypy", "pypy3"]
container:
image: danielflook/python-minifier-build:${{ matrix.python }}-2022-10-25
image: danielflook/python-minifier-build:${{ matrix.python }}-2024-01-12
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
29 changes: 22 additions & 7 deletions .github/workflows/test_corpus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ on:
required: false
default: false

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
generate_results:
name: Minify Corpus
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
python: ["python2.7", "python3.3", "python3.4", "python3.5", "python3.6", "python3.7", "python3.8", "python3.9", "python3.10", "python3.11"]
python: ["2.7", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
ref: ["${{ inputs.ref }}", "${{ inputs.base-ref }}"]
container:
image: danielflook/python-minifier-build:${{ matrix.python }}-2022-10-25
image: danielflook/python-minifier-build:python${{ matrix.python }}-2024-01-12
volumes:
- /corpus:/corpus
- /corpus-results:/corpus-results
Expand All @@ -64,31 +67,43 @@ jobs:
path: python-minifier

- name: Install ref
id: install
run: |
set -ex
(cd python-minifier && git log --pretty=format:'%H' -n 1) > sha.txt
cat sha.txt
VERSION=0.0.0
sed -i "s/setup_requires=.*/version='$VERSION',/; s/use_scm_version=.*//" python-minifier/setup.py
(cd python-minifier && ${{matrix.python}} setup.py install)

if ! pip${{ matrix.python }} install python-minifier/ 2>stderr.log; then
echo stderr.log

if grep -q -E 'require a different python version|requires a different Python' stderr.log; then
echo "${{ matrix.ref }} doesn't support Python ${{ matrix.python }}. Skipping."
echo "skip=true" >> "$GITHUB_OUTPUT"
else
exit 1
fi
fi

- name: Run tests
if: steps.install.outputs.skip != 'true'
run: |
if [[ "${{ matrix.python }}" == "python3.3" || "${{ matrix.python }}" == "python3.4" || "${{ matrix.python }}" == "python3.5" ]]; then
if [[ "${{ matrix.python }}" == "3.3" || "${{ matrix.python }}" == "3.4" || "${{ matrix.python }}" == "3.5" ]]; then
# These versions randomise the hash seed, but don't preserve dict order
# This affects how names are assigned. Disable the hash randomisation for
# deterministic results.
export PYTHONHASHSEED=0
fi

${{matrix.python}} workflow/corpus_test/generate_results.py /corpus /corpus-results $(<sha.txt) ${{ inputs.regenerate-results }}
python${{matrix.python}} workflow/corpus_test/generate_results.py /corpus /corpus-results $(<sha.txt) ${{ inputs.regenerate-results }}

generate_report:
name: Generate Report
needs: generate_results
runs-on: self-hosted
container:
image: danielflook/python-minifier-build:python3.11-2022-10-25
image: danielflook/python-minifier-build:python3.12-2024-01-12
volumes:
- /corpus-results:/corpus-results
if: ${{ always() }}
Expand Down Expand Up @@ -125,4 +140,4 @@ jobs:

- name: Generate Report
run: |
python3.11 workflow/corpus_test/generate_report.py /corpus-results ${{ inputs.ref }} $(<sha.txt) ${{ inputs.base-ref }} $(<base-sha.txt) >> $GITHUB_STEP_SUMMARY
python3.12 workflow/corpus_test/generate_report.py /corpus-results ${{ inputs.ref }} $(<sha.txt) ${{ inputs.base-ref }} $(<base-sha.txt) >> $GITHUB_STEP_SUMMARY
7 changes: 5 additions & 2 deletions .github/workflows/verify_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ on:
required: true
type: string

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:
test_package:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["2.7", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
python: ["2.7", "3.3", "3.4", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
container:
image: danielflook/python-minifier-build:python${{ matrix.python }}-2022-10-25
image: danielflook/python-minifier-build:python${{ matrix.python }}-2024-01-12
steps:
- name: Test
run: |
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/xtest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: Regression Test

on: [pull_request]

env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true

jobs:

test:
Expand All @@ -10,9 +13,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ["python2.7", "python3.3", "python3.4", "python3.5", "python3.6", "python3.7", "python3.8", "python3.9", "python3.10", "python3.11", "pypy3"]
python: ["python2.7", "python3.3", "python3.4", "python3.5", "python3.6", "python3.7", "python3.8", "python3.9", "python3.10", "python3.11", "python3.12", "pypy3"]
container:
image: danielflook/python-minifier-build:${{ matrix.python }}-2022-10-25
image: danielflook/python-minifier-build:${{ matrix.python }}-2024-01-12
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -35,7 +38,7 @@ jobs:
(cd /usr/lib64/pypy3-7.0/lib-python/3/test && pypy3 make_ssl_certs.py)
fi

tox -r -e $(echo "${{ matrix.python }}" | tr -d .) xtest
tox -r -e $(echo "${{ matrix.python }}" | tr -d .) -- xtest

test-corpus:
needs: test
Expand Down
Loading
Loading