Skip to content

Commit

Permalink
prepare for 5.0.0 release (#155)
Browse files Browse the repository at this point in the history
* [changelog] format
* [ci] pre-install docutils
* [ci] pre-install sphinx
* [ci] provide for Linxu compatibility
* [ci] update docker image
* [ci] update requirements
* [ci] use python3.8 for venv
* [dist] get ready for release
* [dist] update release date
* [make] refactor dependencies
* [readme] fix pandoc options for Markdown
* [readme] go back to RST as main format
  • Loading branch information
apalala authored Jan 26, 2020
1 parent d514e83 commit 76600b4
Show file tree
Hide file tree
Showing 9 changed files with 361 additions and 84 deletions.
61 changes: 15 additions & 46 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ workflows:
jobs:
test-3.8: &test-template
docker:
- image: circleci/python:3.8

- image: circleci/python:latest

working_directory: ~/repo

Expand All @@ -34,8 +33,10 @@ jobs:
sudo apt install -y python-pip
sudo apt install -y virtualenv
sudo apt install -y pandoc
sudo apt install -y graphviz
python -m venv venv || virtualenv venv
sudo apt install -y python-sphinx
sudo apt install -y python-docutils
sudo apt install -y tox
python3.8 -m venv venv || python3.8 -m virtualenv venv
. venv/bin/activate
pip install -U pip
pip install -Ur requirements-test.txt
Expand All @@ -46,63 +47,31 @@ jobs:
key: v1-dependencies-{{ checksum "requirements-test.txt" }}

- run:
name: run tests
name: test
command: |
. venv/bin/activate
make clean
flake8
pylint --ignore=bootstrap.py,model.py tatsu test examples
mypy --ignore-missing-imports .
pytest -v
py.test
- run:
name: package
name: examples
command: |
python setup.py sdist --formats=zip
python setup.py bdist_wheel --universal
- store_artifacts:
path: test-reports
destination: test-reports

test-pypy3 :
docker:
- image: circleci/python:3.8

working_directory: ~/repo-pypy3

steps:
- checkout

- restore_cache:
keys:
- v1-dependencies-{{ checksum "requirements-test.txt" }}
- v1-dependencies-
. venv/bin/activate
make examples
- run:
name: install dependencies
name: documentation
command: |
sudo apt update
sudo apt install -y python3-pip
sudo apt install -y python3-dev
sudo apt install -y virtualenv
sudo apt install -y pypy3
sudo apt install -y pandoc
sudo apt install -y graphviz
virtualenv venv -p pypy3
. venv/bin/activate
pip install -U pip
pip install -Ur requirements-test.txt
- save_cache:
paths:
- ./venv
key: v1-dependencies-{{ checksum "requirements-test.txt" }}
make documentation
- run:
name: run tests
name: package
command: |
. venv/bin/activate
pytest -v
make distributions
- store_artifacts:
path: test-reports
Expand Down
5 changes: 2 additions & 3 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The format of this *Change Log* is inspired by `keeapachangelog.org`_.
.. _`X.Y.Z`: https://github.com/apalala/tatsu/compare/v5.0.0...master


`5.0.0`_ @ 2020-01-25
`5.0.0`_ @ 2020-01-26
-----------------------
.. _5.0.0: https://github.com/apalala/tatsu/compare/v4.4.0...v5.0.0

Expand Down Expand Up @@ -133,8 +133,7 @@ Fixed
Fixed
~~~~~

* `#27`_ Undo the fixes to dropped input on left recursion because they broke previous
expected behavior.
* `#27`_ Undo the fixes to dropped input on left recursion because they broke previous expected behavior.

* `#33`_ Fixes to the calc example and mini tutorial (`@heronils`_)

Expand Down
29 changes: 11 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
test: static_test tatsu_test documentation examples


tatsu_test:
tatsu_test: clean
pytest


documentation:
documentation: clean
rst2html5 CHANGELOG.rst > /dev/null
pandoc README.rst -t gfm --wrap=none > README.md
cd docs; make -s html > /dev/null


examples: g2e_test calc_test
examples: clean g2e_test calc_test


g2e_test:
Expand All @@ -25,12 +27,7 @@ static_test:
mypy --ignore-missing-imports .


cython:
python setup.py build_ext --inplace
python3 setup.py build_ext --inplace


clean: clean_cython
clean:
find . -name "__pycache__" | xargs rm -rf
find . -name "*.pyc" | xargs rm -f
find . -name "*.pyd" | xargs rm -f
Expand All @@ -42,29 +39,25 @@ clean: clean_cython
rm -rf .tox


clean_cython:
find tatsu -name "*.so" | xargs rm -f
find tatsu -name "*.c" | xargs rm -f


release_check: clean documentation
rst2html.py CHANGELOG.rst > /dev/null
python setup.py sdist --formats=zip
tox
@echo version `python -m tatsu --version`


distributions: clean release_check
distributions: clean
python setup.py sdist --formats=zip
python setup.py bdist_wheel --universal


test_distributions:
test_distributions: clean
python setup.py sdist --formats=zip
python setup.py bdist_wheel --universal


test_upload: test_distributions
twine upload --repository test dist/*

upload: distributions

upload: release_check distributions
twine upload dist/*
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![license](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/neogeny/tatsu/master/LICENSE.txt) [![pyversions](https://img.shields.io/pypi/pyversions/tatsu.svg)](https://pypi.python.org/pypi/tatsu) [![fury](https://badge.fury.io/py/TatSu.svg)](https://badge.fury.io/py/tatsu) [![circleci](https://circleci.com/gh/neogeny/TatSu.svg?style=shield)](https://circleci.com/gh/neogeny/TatSu) [![docs](https://readthedocs.org/projects/tatsu/badge/?version=stable)](http://tatsu.readthedocs.io/en/stable/)
[![license](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/neogeny/tatsu/master/LICENSE.txt) [![pyversions](https://img.shields.io/pypi/pyversions/tatsu.svg)](https://pypi.python.org/pypi/tatsu) [![fury](https://badge.fury.io/py/tatsu.svg)](https://badge.fury.io/py/tatsu) [![circleci](https://circleci.com/gh/neogeny/TatSu.svg?style=shield)](https://circleci.com/gh/neogeny/TatSu) [![docs](https://readthedocs.org/projects/tatsu/badge/?version=stable)](http://tatsu.readthedocs.io/en/stable/)

> *At least for the people who send me mail about a new language that they're designing, the general advice is: do it to learn about how to write a compiler. Don't have any expectations that anyone will use it, unless you hook up with some sort of organization in a position to push it hard. It's a lottery, and some can buy a lot of the tickets. There are plenty of beautiful languages (more beautiful than C) that didn't catch on. But someone does win the lottery, and doing a language at least teaches you something.*
>
>
> [Dennis Ritchie](http://en.wikipedia.org/wiki/Dennis_Ritchie) (1941-2011) Creator of the [C](http://en.wikipedia.org/wiki/C_language) programming language and of [Unix](http://en.wikipedia.org/wiki/Unix)
# **TatSu**
Expand Down Expand Up @@ -45,20 +45,20 @@ $ pip install TatSu
**TatSu** can be used as a library, much like [Python](http://python.org)'s `re`, by embedding grammars as strings and generating grammar models instead of generating [Python](http://python.org) code.

- `tatsu.compile(grammar, name=None, **kwargs)`

Compiles the grammar and generates a *model* that can subsequently be used for parsing input with.

- `tatsu.parse(grammar, input, **kwargs)`

Compiles the grammar and parses the given input producing an [AST](http://en.wikipedia.org/wiki/Abstract_syntax_tree) as result. The result is equivalent to calling:

model = compile(grammar)
ast = model.parse(input)

Compiled grammars are cached for efficiency.

- `tatsu.to_python_sourcecode(grammar, name=None, filename=None, **kwargs)`

Compiles the grammar to the [Python](http://python.org) sourcecode that implements the parser.

This is an example of how to use 竜 **TatSu** as a library:
Expand Down
Loading

0 comments on commit 76600b4

Please sign in to comment.