Skip to content

feat: setup cython example#5

Draft
aryarm wants to merge 18 commits intomainfrom
cython
Draft

feat: setup cython example#5
aryarm wants to merge 18 commits intomainfrom
cython

Conversation

@aryarm
Copy link
Member

@aryarm aryarm commented Sep 26, 2024

Description

This PR adds an example of some C code to our python package. It follows the template in https://github.com/BrianPugh/python-template?tab=readme-ov-file#cython

The C code defines a really simple divide() function which can be used to divide two numbers. You can test it out like this:

conda run -n panct poetry run python -c 'from panct._c_extension import divide; print(divide(6,3))'

or

conda activate panct
poetry shell
python
from panct._c_extension import divide
divide(6,3)

Note: every time a change is made to our C code, we will need to rerun poetry install to recompile

Still to do

  • How do we want to include the gbz-base source code in the repo? Options: git submodule or install as setup step
  • Do we want to automatically skip compilation of the cython module if it doesn't work? Or should we just fail/error explicitly? The former could be helpful if we want to implement some kind of slower alternative
  • fix nox and GitHub actions for testing to allow them to compile wheels
  • add CIBUILDWHEEL to GitHub actions build wheels on lots of platforms
  • add gbz-base to _c_src? for rust: we need indexing and subsetting

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: delete this file before merging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant