Skip to content

Commit

Permalink
Release v3.0.4 (#806)
Browse files Browse the repository at this point in the history
  • Loading branch information
evhub authored Nov 28, 2023
2 parents dbec988 + d2191ee commit e8dd479
Show file tree
Hide file tree
Showing 45 changed files with 6,116 additions and 3,612 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,26 @@ jobs:
matrix:
python-version:
- '2.7'
- '3.4'
- '3.5'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- 'pypy-2.7'
- 'pypy-3.6'
- 'pypy-3.7'
- 'pypy-3.8'
- 'pypy-3.9'
- 'pypy-3.10'
fail-fast: false
name: Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- name: Setup python
uses: MatteoH2O1999/setup-python@v1.3.1
uses: MatteoH2O1999/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
cache: pip
Expand Down
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ pyprover/
bbopt/
coconut-prelude/
index.rst
vprof.json
/coconut/icoconut/coconut/
__coconut_cache__/

# Profiling
vprof.json
profile.svg
profile.speedscope
runtime_profile.svg
runtime_profile.speedscope
24 changes: 12 additions & 12 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
repos:
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.4
hooks:
- id: autopep8
args:
- --in-place
- --aggressive
- --aggressive
- --experimental
- --ignore=W503,E501,E722,E402,E721
- repo: https://github.com/pre-commit/pre-commit-hooks.git
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: fix-byte-order-marker
Expand All @@ -24,18 +34,8 @@ repos:
args:
- --autofix
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
args:
- --ignore=W503,E501,E265,E402,F405,E305,E126
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.2
hooks:
- id: autopep8
args:
- --in-place
- --aggressive
- --aggressive
- --experimental
- --ignore=W503,E501,E722,E402
1 change: 0 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ python:
path: .
extra_requirements:
- docs
system_packages: true
623 changes: 419 additions & 204 deletions DOCS.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ Information on every Coconut release is chronicled on the [GitHub releases page]

Yes! Coconut compiles the [newest](https://www.python.org/dev/peps/pep-0526/), [fanciest](https://www.python.org/dev/peps/pep-0484/) type annotation syntax into version-independent type comments which can then by checked using Coconut's built-in [MyPy Integration](./DOCS.md#mypy-integration).

### Help! I tried to write a recursive iterator and my Python segfaulted!
### Help! I tried to write a recursive generator and my Python segfaulted!

No problem—just use Coconut's [`recursive_iterator`](./DOCS.md#recursive-iterator) decorator and you should be fine. This is a [known Python issue](http://bugs.python.org/issue14010) but `recursive_iterator` will fix it for you.
No problem—just use Coconut's [`recursive_generator`](./DOCS.md#recursive_generator) decorator and you should be fine. This is a [known Python issue](http://bugs.python.org/issue14010) but `recursive_generator` will fix it for you.

### How do I split an expression across multiple lines in Coconut?

Expand Down
163 changes: 121 additions & 42 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,37 @@ dev-py3: clean setup-py3

.PHONY: setup
setup:
python -m ensurepip
-python -m ensurepip
python -m pip install --upgrade setuptools wheel pip pytest_remotedata cython

.PHONY: setup-py2
setup-py2:
python2 -m ensurepip
-python2 -m ensurepip
python2 -m pip install --upgrade "setuptools<58" wheel pip pytest_remotedata cython

.PHONY: setup-py3
setup-py3:
python3 -m ensurepip
-python3 -m ensurepip
python3 -m pip install --upgrade setuptools wheel pip pytest_remotedata cython

.PHONY: setup-pypy
setup-pypy:
pypy -m ensurepip
-pypy -m ensurepip
pypy -m pip install --upgrade "setuptools<58" wheel pip pytest_remotedata

.PHONY: setup-pypy3
setup-pypy3:
pypy3 -m ensurepip
-pypy3 -m ensurepip
pypy3 -m pip install --upgrade setuptools wheel pip pytest_remotedata

.PHONY: install
install: setup
python -m pip install -e .[tests]

.PHONY: install-purepy
install-purepy: setup
python -m pip install --no-deps --upgrade -e . "pyparsing<3"

.PHONY: install-py2
install-py2: setup-py2
python2 -m pip install -e .[tests]
Expand Down Expand Up @@ -127,39 +131,54 @@ test-pypy3: clean
pypy3 ./coconut/tests/dest/runner.py
pypy3 ./coconut/tests/dest/extras.py

# same as test-univ but reverses any ofs
.PHONY: test-any-of
test-any-of: export COCONUT_ADAPTIVE_ANY_OF=TRUE
test-any-of: export COCONUT_REVERSE_ANY_OF=TRUE
test-any-of: test-univ

# same as test-univ but also runs mypy
.PHONY: test-mypy-univ
test-mypy-univ: export COCONUT_USE_COLOR=TRUE
test-mypy-univ: clean
python ./coconut/tests --strict --force --keep-lines --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
python ./coconut/tests --strict --keep-lines --force --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py

# same as test-mypy-univ but uses --target sys
.PHONY: test-mypy
test-mypy: export COCONUT_USE_COLOR=TRUE
test-mypy: clean
python ./coconut/tests --strict --force --target sys --keep-lines --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
python ./coconut/tests --strict --keep-lines --force --target sys --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py

# same as test-mypy but doesn't use --force
.PHONY: test-mypy-tests
test-mypy-tests: export COCONUT_USE_COLOR=TRUE
test-mypy-tests: clean-no-tests
python ./coconut/tests --strict --target sys --keep-lines --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
python ./coconut/tests --strict --keep-lines --target sys --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py

# same as test-univ but includes verbose output for better debugging
# regex for getting non-timing lines: ^(?!\s*(Time|Packrat|Loaded|Saving|Adaptive|Errorless|Grammar|Failed|Incremental|Pruned)\s)[^\n]*\n*
.PHONY: test-verbose
test-verbose: export COCONUT_USE_COLOR=TRUE
test-verbose: clean
python ./coconut/tests --strict --keep-lines --force --verbose
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py

# same as test-univ but includes verbose output for better debugging and is fully synchronous
# same as test-verbose but doesn't use the incremental cache
.PHONY: test-verbose-no-cache
test-verbose-no-cache: export COCONUT_USE_COLOR=TRUE
test-verbose-no-cache: clean
python ./coconut/tests --strict --keep-lines --force --verbose --no-cache
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py

# same as test-verbose but is fully synchronous
.PHONY: test-verbose-sync
test-verbose-sync: export COCONUT_USE_COLOR=TRUE
test-verbose-sync: clean
Expand All @@ -171,15 +190,15 @@ test-verbose-sync: clean
.PHONY: test-mypy-verbose
test-mypy-verbose: export COCONUT_USE_COLOR=TRUE
test-mypy-verbose: clean
python ./coconut/tests --strict --force --target sys --verbose --keep-lines --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
python ./coconut/tests --strict --keep-lines --force --target sys --verbose --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py

# same as test-mypy but uses --check-untyped-defs
.PHONY: test-mypy-all
test-mypy-all: export COCONUT_USE_COLOR=TRUE
test-mypy-all: clean
python ./coconut/tests --strict --force --target sys --keep-lines --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition --check-untyped-defs
python ./coconut/tests --strict --keep-lines --force --target sys --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition --check-untyped-defs
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py

Expand All @@ -192,9 +211,14 @@ test-easter-eggs: clean
python ./coconut/tests/dest/extras.py

# same as test-univ but uses python pyparsing
.PHONY: test-pyparsing
test-pyparsing: export COCONUT_PURE_PYTHON=TRUE
test-pyparsing: test-univ
.PHONY: test-purepy
test-purepy: export COCONUT_PURE_PYTHON=TRUE
test-purepy: test-univ

# same as test-univ but disables the computation graph
.PHONY: test-no-computation-graph
test-no-computation-graph: export COCONUT_USE_COMPUTATION_GRAPH=FALSE
test-no-computation-graph: test-univ

# same as test-univ but uses --minify
.PHONY: test-minify
Expand All @@ -217,30 +241,60 @@ test-no-wrap: clean
test-watch: export COCONUT_USE_COLOR=TRUE
test-watch: clean
python ./coconut/tests --strict --keep-lines --force
coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --watch --strict --keep-lines --stack-size 4096 --recursion-limit 4096
make just-watch
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py

# mini test that just compiles agnostic tests with fully synchronous output
# just watches tests
.PHONY: just-watch
just-watch: export COCONUT_USE_COLOR=TRUE
just-watch:
coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --watch --strict --keep-lines --stack-size 4096 --recursion-limit 4096

# same as just-watch but uses verbose output and is fully sychronous and doesn't use the cache
.PHONY: just-watch-verbose
just-watch-verbose: export COCONUT_USE_COLOR=TRUE
just-watch-verbose:
coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --watch --strict --keep-lines --stack-size 4096 --recursion-limit 4096 --verbose --jobs 0 --no-cache

# mini test that just compiles agnostic tests
.PHONY: test-mini
test-mini: export COCONUT_USE_COLOR=TRUE
test-mini:
coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --jobs 0 --stack-size 4096 --recursion-limit 4096
coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --stack-size 4096 --recursion-limit 4096

# same as test-mini but with verbose output
.PHONY: test-mini-verbose
test-mini-verbose: export COCONUT_USE_COLOR=TRUE
test-mini-verbose:
coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --verbose --stack-size 4096 --recursion-limit 4096

# same as test-mini-verbose but doesn't overwrite the cache
.PHONY: test-mini-cache
test-mini-cache: export COCONUT_ALLOW_SAVE_TO_CACHE=FALSE
test-mini-cache: test-mini-verbose

# same as test-mini-verbose but with fully synchronous output and fast failing
.PHONY: test-mini-sync
test-mini-sync: export COCONUT_USE_COLOR=TRUE
test-mini-sync:
coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --verbose --jobs 0 --fail-fast --stack-size 4096 --recursion-limit 4096

# same as test-univ but debugs crashes
.PHONY: test-univ-debug
test-univ-debug: export COCONUT_TEST_DEBUG_PYTHON=TRUE
test-univ-debug: test-univ

# same as test-mini but debugs crashes
# same as test-mini but debugs crashes, is fully synchronous, and doesn't use verbose output
.PHONY: test-mini-debug
test-mini-debug: export COCONUT_USE_COLOR=TRUE
test-mini-debug:
python -X dev -m coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --strict --keep-lines --force --jobs 0 --stack-size 4096 --recursion-limit 4096

# same as test-mini-debug but uses vanilla pyparsing
.PHONY: test-mini-debug-pyparsing
test-mini-debug-pyparsing: export COCONUT_PURE_PYTHON=TRUE
test-mini-debug-pyparsing: test-mini-debug
.PHONY: test-mini-debug-purepy
test-mini-debug-purepy: export COCONUT_PURE_PYTHON=TRUE
test-mini-debug-purepy: test-mini-debug

.PHONY: debug-test-crash
debug-test-crash:
Expand All @@ -266,16 +320,16 @@ clean-no-tests:
.PHONY: clean
clean: clean-no-tests
rm -rf ./coconut/tests/dest
-find . -name "__coconut_cache__" -type d -prune -exec rm -rf '{}' +
-powershell -Command "get-childitem -Include __coconut_cache__ -Recurse -force | Remove-Item -Force -Recurse"

.PHONY: wipe
wipe: clean
rm -rf ./coconut/tests/dest vprof.json profile.log *.egg-info
-find . -name "__pycache__" -delete
-C:/GnuWin32/bin/find.exe . -name "__pycache__" -delete
-find . -name "__coconut_cache__" -delete
-C:/GnuWin32/bin/find.exe . -name "__coconut_cache__" -delete
-find . -name "__pycache__" -type d -prune -exec rm -rf '{}' +
-powershell -Command "get-childitem -Include __pycache__ -Recurse -force | Remove-Item -Force -Recurse"
-find . -name "*.pyc" -delete
-C:/GnuWin32/bin/find.exe . -name "*.pyc" -delete
-powershell -Command "get-childitem -Include *.pyc -Recurse -force | Remove-Item -Force -Recurse"
-python -m coconut --site-uninstall
-python3 -m coconut --site-uninstall
-python2 -m coconut --site-uninstall
Expand All @@ -302,20 +356,45 @@ upload: wipe dev just-upload
check-reqs:
python ./coconut/requirements.py

.PHONY: profile-parser
profile-parser: export COCONUT_USE_COLOR=TRUE
profile-parser: export COCONUT_PURE_PYTHON=TRUE
profile-parser:
coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --profile --verbose --stack-size 4096 --recursion-limit 4096 2>&1 | tee ./profile.log

.PHONY: profile-time
profile-time:
vprof -c h "./coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --stack-size 4096 --recursion-limit 4096" --output-file ./vprof.json

.PHONY: profile-memory
profile-memory:
vprof -c m "./coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --stack-size 4096 --recursion-limit 4096" --output-file ./vprof.json

.PHONY: view-profile
view-profile:
.PHONY: profile
profile: export COCONUT_USE_COLOR=TRUE
profile:
coconut ./coconut/tests/src/cocotest/agnostic/util.coco ./coconut/tests/dest/cocotest --force --jobs 0 --profile --verbose --stack-size 4096 --recursion-limit 4096 2>&1 | tee ./profile.log

.PHONY: open-speedscope
open-speedscope:
npm install -g speedscope
speedscope ./profile.speedscope

.PHONY: pyspy
pyspy:
py-spy record -o profile.speedscope --format speedscope --subprocesses --rate 75 -- python -m coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force
make open-speedscope

.PHONY: pyspy-purepy
pyspy-purepy: export COCONUT_PURE_PYTHON=TRUE
pyspy-purepy: pyspy

.PHONY: pyspy-native
pyspy-native:
py-spy record -o profile.speedscope --format speedscope --native --rate 75 -- python -m coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --jobs 0
make open-speedscope

.PHONY: pyspy-runtime
pyspy-runtime:
py-spy record -o runtime_profile.speedscope --format speedscope -- python ./coconut/tests/dest/runner.py
speedscope ./runtime_profile.speedscope

.PHONY: vprof-time
vprof-time:
vprof -c h "./coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --jobs 0 --stack-size 4096 --recursion-limit 4096" --output-file ./vprof.json
make view-vprof

.PHONY: vprof-memory
vprof-memory:
vprof -c m "./coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --jobs 0 --stack-size 4096 --recursion-limit 4096" --output-file ./vprof.json
make view-vprof

.PHONY: view-vprof
view-vprof:
vprof --input-file ./vprof.json
Loading

0 comments on commit e8dd479

Please sign in to comment.