Skip to content

Commit

Permalink
Merge branch 'polymorphism' into polytypes
Browse files Browse the repository at this point in the history
  • Loading branch information
alcides committed Dec 1, 2024
2 parents 8d34ac5 + af5af3f commit ef89fe2
Show file tree
Hide file tree
Showing 191 changed files with 7,153 additions and 1,087 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3afc4a6373239c357df30b3b91c23bf0c8362107
70 changes: 32 additions & 38 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,37 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
python-version: [ "3.10", "3.11", "3.12" ]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest mypy
if [ -f requirements.pip ]; then pip install -r requirements.pip; fi
- name: Lint with mypy
run: |
mypy aeon
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Check install
run: |
pip install -e .
- name: Test with pytest
run: |
pytest
- name: Run Aeon Core Files
run: |
files=$(find examples/core -type f -name '*_main.ae')
for file in $files; do
python aeon $file --core --log INFO ERROR TYPECHECKER CONSTRAINT
done
- name: Run Aeon Sugar Files
run: |
files=$(find examples/sugar -type f -name '*_main.ae')
for file in $files; do
python aeon $file --log INFO ERROR TYPECHECKER CONSTRAINT
done
- uses: actions/[email protected]
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade uv
uv pip install --system flake8 pytest mypy pre-commit-uv
if [ -f requirements.pip ]; then uv pip install --system -r requirements.pip; fi
- name: Lint with pre-commit
run: |
pre-commit run --all-files
- name: Lint with mypy
run: |
mypy aeon --no-strict-optional --ignore-missing-imports
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 --extend-exclude .venv . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 --extend-exclude .venv . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Check install
run: |
uv pip install --system -e .
- name: Test with pytest
run: |
pytest
- name: Run Benchmarks
run: |
bash run_examples.sh
36 changes: 19 additions & 17 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,29 @@ name: Upload Python Package

on:
release:
types: [published]
types: [ published ]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Set env
run: echo "VIRTUAL_ENV=$(python -c 'import sys; print(sys.prefix)')">> $GITHUB_ENV
- name: Install dependencies
run: |
python -m pip install --upgrade uv
uv pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
8 changes: 8 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Ruff
on: [push, pull_request]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: chartboost/ruff-action@v1
65 changes: 35 additions & 30 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,41 +1,46 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-yaml
- id: check-toml
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-docstring-first
- id: name-tests-test
- id: requirements-txt-fixer
- id: mixed-line-ending
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.4.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/asottile/pyupgrade
rev: v3.13.0
- id: check-yaml
- id: check-toml
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-docstring-first
- id: name-tests-test
- id: requirements-txt-fixer
- id: mixed-line-ending
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v2.7.0
hooks:
- id: pyupgrade
args: [--py310-plus]
- repo: https://github.com/hadialqattan/pycln
rev: v2.2.2
- id: setup-cfg-fmt
# Disabled because of pre-commit 4 incompatibility
# - repo: https://github.com/PyCQA/docformatter
# rev: 06907d0267368b49b9180eed423fae5697c1e909
# hooks:
# - id: docformatter
- repo: https://github.com/hadialqattan/pycln
rev: v2.4.0
hooks:
- id: pycln
- id: pycln
args: [--config=pyproject.toml]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.0
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
hooks:
- id: mypy
args: [--no-strict-optional, --ignore-missing-imports]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.1.0
- id: mypy
args:
[
--no-strict-optional,
--ignore-missing-imports,
--explicit-package-bases,
]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.8.1
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/regebro/pyroma
- repo: https://github.com/regebro/pyroma
rev: "4.2"
hooks:
- id: pyroma
- id: pyroma
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
"python.testing.unittestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.pytestEnabled": true,
"python.formatting.provider": "black",
"python.formatting.provider": "none",
"python.linting.mypyEnabled": true,
"python.linting.enabled": true,
"files.watcherExclude": {
"**/target": true
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter"
}
}
59 changes: 45 additions & 14 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Aeon is a programming languages that features Liquid Types, developed at the Uni

Aeon is in development, so assume all your programs to break. This 4th version is implemented as a Python interpreter, giving you access to any code written in Python.


## Examples


Expand All @@ -16,9 +15,7 @@ def main (args:Int) : Unit {
}
```

To execute this program, you can run:

`python -m aeon examples/hello_world.ae`
The documentation is available at [https://alcides.github.io/aeon](https://alcides.github.io/aeon).


### Liquid Types
Expand All @@ -29,23 +26,57 @@ In this example, you can see the refined type `{x:Int | x > 0}` that represents
def sqrt : (i: {x:Int | x > 0} ) -> Float = native "__import__('math').sqrt";
def main (i:Int) : Unit {
print (sqrt 25)
print (sqrt (-25)) # This is a type-checking error!
}
```


### Math

Authors
----------
Aeon has been developed at [LASIGE](https://www.lasige.pt), [University of Lisbon](https://ciencias.ulisboa.pt) by:

* [Alcides Fonseca](http://alcidesfonseca.com)
* [Paulo Santos](https://pcanelas.com/)
* [Eduardo Madeira](https://www.lasige.pt/member/jose-eduardo-madeira)

Acknowledgements
----------------

This work was supported by Fundação para a Ciência e Tecnologia (FCT) through:

* [the LASIGE Research Unit](https://www.lasige.pt) (ref. UIDB/00408/2020 and UIDP/00408/2020)
* [the FCT Exploratory project RAP](http://wiki.alcidesfonseca.com/research/projects/rap/) (EXPL/CCI-COM/1306/2021)
* the FCT Advanced Computing projects (CPCA/A1/395424/2021, CPCA/A1/5613/2020, CPCA/A2/6009/2020)

And by Lisboa2020, Compete2020 and FEDER through:

* [the CMU|Portugal CAMELOT project](http://wiki.alcidesfonseca.com/research/projects/camelot/) (LISBOA-01-0247-FEDER-045915)


Publications
-----------------

* [Comparing the expressive power of Strongly-Typed and Grammar-Guided Genetic Programming](https://www.researchgate.net/publication/370277603_Comparing_the_expressive_power_of_Strongly-Typed_and_Grammar-Guided_Genetic_Programming) at GECCO'23
* [The Usability Argument for Refinement Typed Genetic Programming](https://link.springer.com/chapter/10.1007/978-3-030-58115-2_2) at PPSN'20

Let us know if your paper uses Aeon, to list it here.

Please cite as:

```
def abs (i:Int) : Int {
if i > 0 then i else -i
}
Fonseca, Alcides, Paulo Santos, and Sara Silva. "The usability argument for refinement typed genetic programming." International Conference on Parallel Problem Solving from Nature. Cham: Springer International Publishing, 2020.
```

def midpoint(a:Int, b:Int) : Int {
(a + b) / 2
}
Bibtex:

def main (i:Int) : Unit {
print (abs (-3) + midpoint 1 5)
```
@inproceedings{fonseca2020usability,
title={The usability argument for refinement typed genetic programming},
author={Fonseca, Alcides and Santos, Paulo and Silva, Sara},
booktitle={International Conference on Parallel Problem Solving from Nature},
pages={18--32},
year={2020},
organization={Springer}
}
```
Loading

0 comments on commit ef89fe2

Please sign in to comment.