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

support for non-python extensions #1351

Closed
2 tasks done
etijskens opened this issue Sep 4, 2019 · 5 comments
Closed
2 tasks done

support for non-python extensions #1351

etijskens opened this issue Sep 4, 2019 · 5 comments
Labels
kind/feature Feature requests/implementations

Comments

@etijskens
Copy link

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Question

Hi, thanks for poetry!
My Python projects for HPC/scientific computing rely heavily on extension modules, written in C++ using pybind11, or Fortran using f2py. The building process is currently organised with CMake (to great satisfaction). Could anyone give me some information about how I can make use of Poetry to package such projects and deploy them to PyPI?
if possible I'd appreciated being pointed to the relevant poetry files to try and understand how the machinery works :)
many thanks in advance.

@dmontagu
Copy link

dmontagu commented Sep 4, 2019

I am currently using poetry to build multiple projects using cython and pybind11 extensions.

  • As described in Add support for non pure python projects #11 you'll need to add

    [tool.poetry]
    build = "build.py"

    to the pyproject.toml, and create an appropriate build.py file alongside pyproject.toml.

  • This gist includes the contents of the build.py file (referenced in the previous bullet) that I use with one of my projects containing both cython and pybind11 extensions (the extension names/paths have been changed).

    Depending on your use of CMake, it may require some changes, but it should be simple enough to just read through what it does and make any necessary modifications.

I haven't deployed any packages to PyPI, but I do use poetry build to generate a platform-specific wheel and source distribution; presumably this is ready for publishing.

You may want/need to fiddle with the packages and/or exclude keys in the [tool.poetry] section of the pyproject.toml to build a source distribution / wheel with the right contents. (E.g., if using pybind11 as a git submodule, you'd probably want to exclude its .git folder.)

@stale
Copy link

stale bot commented Nov 13, 2019

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix label Nov 13, 2019
@sdispater sdispater added stale and removed wontfix labels Nov 14, 2019
@stale stale bot removed the stale label Nov 14, 2019
@bruxisma
Copy link

bruxisma commented Dec 8, 2019

It would be nice if something akin to setup.cfg/setup.py's approach for console_scripts could be specified under the [tool.poetry] table. Right now I just write a script that just imports a module with a function from a dev dependency named build and nothing else (i.e., from developement_dependency.module import build). It'd be neat if I could just do development_dependency.module_name:function or something to that effect. Then full packages could be used instead of per-project files.

@dimbleby
Copy link
Contributor

later duplicated by #2740 but that one has more useful discussion in it so suggest closing this one out

@finswimmer
Copy link
Member

Duplicate of #2740

@finswimmer finswimmer marked this as a duplicate of #2740 Oct 30, 2024
@finswimmer finswimmer closed this as not planned Won't fix, can't repro, duplicate, stale Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Feature requests/implementations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants