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

feat: setup cython example #5

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from
Draft

feat: setup cython example #5

wants to merge 18 commits into from

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