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

Porting example for the documentation #246

Merged
merged 46 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a46d4b5
Add porting example from PR #156.
hodgestar Feb 10, 2021
229f010
Add pytests for all porting steps.
hodgestar Feb 11, 2021
d42f73d
Add porting-example-tests target to Makefile.
hodgestar Feb 11, 2021
0b8a140
Add porting example tests to Azure Pipeline.
hodgestar Feb 11, 2021
a1f6891
Move remainings porting example checks into tests.
hodgestar Feb 11, 2021
c65a7b0
Move steps into step folder.
hodgestar Feb 12, 2021
4be4a72
Merge branch 'master' into feature/porting-example
hodgestar Feb 12, 2021
2e8251c
Merge branch 'master' into feature/porting-example
hodgestar Feb 22, 2021
6723ac6
Update path to steps.
hodgestar Feb 22, 2021
0ea2a03
Add docstring to pure HPy point type.
hodgestar Feb 22, 2021
7275b33
Merge branch 'master' into feature/porting-example
hodgestar Feb 23, 2021
b9dcc86
Merge branch 'master' into feature/porting-example
hodgestar Feb 25, 2021
321d2bf
Merge branch 'master' into feature/porting-example
hodgestar Mar 5, 2021
0ff079d
Merge branch 'master' into feature/porting-example
hodgestar Oct 9, 2021
a53e8cf
Update porting example CI to GitHub actions.
hodgestar Oct 9, 2021
f624ef5
Move porting example tests into steps folder.
hodgestar Oct 9, 2021
f58ec8d
Update porting example to current master.
hodgestar Oct 9, 2021
6f4a605
Install HPy and pytest for porting example checks.
hodgestar Oct 10, 2021
e47e8f4
Merge branch 'master' into feature/porting-example
timfel Sep 19, 2022
0bc4096
Run setup.py install in the example directory
ambv Sep 19, 2022
b7d75e4
Upgrade HPyModuleDef to the newest form
ambv Sep 19, 2022
8d93e75
Make setup.py dumber but less magical
ambv Sep 19, 2022
fa903f1
Refer to python3 everywhere to be more robust.
xoraxax Sep 20, 2022
378f337
(timfel, xoraxax) Introduce an object field to the step-wise porting …
xoraxax Sep 20, 2022
91772c6
split setup.py into multiple to show the porting of that, too
timfel Sep 21, 2022
ec8ff3e
Merge branch 'master' into feature/porting-example
hodgestar Sep 22, 2022
d101dca
Bump version of clang used to build docs to 11.0.
hodgestar Sep 22, 2022
098a8fe
Add documentation on the porting example steps.
hodgestar Sep 22, 2022
acf3ccd
Add description of first porting step.
hodgestar Sep 22, 2022
521f72b
Ignore the autogenerated step 03 HPy stub .py file.
hodgestar Sep 22, 2022
98ef923
fix and add test for memory leak
timfel Sep 23, 2022
07f8e05
Merge branch 'feature/porting-example' of github.com:hpyproject/hpy i…
timfel Sep 23, 2022
cb50e8a
Add documentation for the second porting step.
hodgestar Sep 23, 2022
15b33da
Add documentation on the final porting step.
hodgestar Sep 23, 2022
79165ea
Remove .c files from toctree.
hodgestar Sep 23, 2022
d9f425f
Add more checks to the porting example leak detector tests.
hodgestar Sep 23, 2022
c781c48
Fix leaks and other errors reported by debug mode.
hodgestar Sep 23, 2022
dcec7d2
Add test of final porting step in debug mode.
hodgestar Sep 23, 2022
270193e
Add description of when an HPyTracker is needed.
hodgestar Sep 24, 2022
07c323c
Add a local contents to the end of the introduction.
hodgestar Sep 24, 2022
7b1843f
Merge branch 'master' into feature/porting-example
fangerer Oct 19, 2022
d6f8ac6
Update porting example
fangerer Oct 19, 2022
c625872
Remove unnecessary temp variables
fangerer Oct 19, 2022
6b1f865
Remove paragraph about HPyField not used as locals
fangerer Oct 19, 2022
0ef6b76
Add cross ref to HPyField
fangerer Oct 19, 2022
19e547c
convert single back-tick to double to format as code, not italic
mattip Oct 19, 2022
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
42 changes: 41 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,46 @@ jobs:
shell: bash


porting_example_tests:
name: Porting example tests
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.9']

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install/Upgrade Python dependencies
run: python -m pip install --upgrade pip wheel
shell: bash

- name: Install HPy
run: python -m pip install .

- name: Install pytest
run: |
python -m pip install pytest

- name: Run tests
run: make porting-example-tests
shell: bash

- name: Run tests of completed port in debug mode
env:
HPY_DEBUG: "1"
TEST_ARGS: "-s -k hpy_final"
run: make porting-example-tests
shell: bash


valgrind_tests:
name: Valgrind tests
runs-on: 'ubuntu-latest'
Expand Down Expand Up @@ -205,7 +245,7 @@ jobs:
# - template: azure-templates/python.yml

- name: Install / Upgrade system requirements
run: sudo apt update && sudo apt install -y libclang-10-dev
run: sudo apt update && sudo apt install -y libclang-11-dev

- name: Install / Upgrade Python requirements
run: |
Expand Down
17 changes: 12 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,17 @@ infer:
@infer --fail-on-issue --compilation-database compile_commands.json --report-blacklist-path-regex "hpy/debug/src/debug_ctx.c"

valgrind:
PYTHONMALLOC=malloc valgrind --suppressions=hpy/tools/valgrind/python.supp --suppressions=hpy/tools/valgrind/hpy.supp --leak-check=full --show-leak-kinds=definite,indirect --log-file=/tmp/valgrind-output python -m pytest --valgrind --valgrind-log=/tmp/valgrind-output test/
PYTHONMALLOC=malloc valgrind --suppressions=hpy/tools/valgrind/python.supp --suppressions=hpy/tools/valgrind/hpy.supp --leak-check=full --show-leak-kinds=definite,indirect --log-file=/tmp/valgrind-output python3 -m pytest --valgrind --valgrind-log=/tmp/valgrind-output test/

porting-example-tests:
cd docs/porting-example/steps && python3 setup00.py build_ext -i
cd docs/porting-example/steps && python3 setup01.py build_ext -i
cd docs/porting-example/steps && python3 setup02.py build_ext -i
cd docs/porting-example/steps && python3 setup03.py --hpy-abi=universal build_ext -i
python3 -m pytest docs/porting-example/steps/ ${TEST_ARGS}

docs-examples-tests:
cd docs/examples/simple-example && python setup.py --hpy-abi=universal install
cd docs/examples/mixed-example && python setup.py install
cd docs/examples/snippets && python setup.py --hpy-abi=universal install
python -m pytest docs/examples/tests.py
cd docs/examples/simple-example && python3 setup.py --hpy-abi=universal install
cd docs/examples/mixed-example && python3 setup.py install
cd docs/examples/snippets && python3 setup.py --hpy-abi=universal install
python3 -m pytest docs/examples/tests.py ${TEST_ARGS}
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ There are several advantages to write your C extension in HPy:
overview
api
porting-guide
porting-example/index
debug-mode
api-reference/index
misc/index
Expand Down
Loading