[Proposal] Requiring cython for the pymoab interface

Issue #94 closed
Patrick Shriwise created an issue

After gaining some more experience with the distribution of Python packages, I don't think that using pre-generated .cpp files is the best way to provide the PyMOAB interface. To properly support different versions of Python and different development environments, users will need to have their own version of cython installed.

Managing the Cython dependency

If they are intending to use PyMOAB with other Python tools, it is likely that they will meet this dependency already due to the growing use of C++ code behind modern Python interfaces.

If not, PEP 518 provides a way of providing python dependencies before the execution of the setup.py file. I'm not sure if this will apply to previous versions

##Required Work

This is somewhat minimal. Thanks to @vijaysm's addition of the developer mode, configuration code already exists for ensuring that Cython is available on the user's machine. This can be incoroporated in to the `--enable-pymoab/ -DENABLE_PYMOAB=ON options by default.

For newer versions of Python, we can rely on the addition of a pyproject.toml file from PEP 518 to supply the dependencies of PyMOAB (namely numpy and cython) during testing and installation.

Comments (8)

  1. Vijay M

    I like this move but I think we should still distribute the .cpp files in the release tarballs. So as long as generation of the cpp files can be accomplished and added to tarball, I am fine with implementing this change where users will invoke Cython explicitly to make sure there aren't any versioning or performance issues. That is the only concern I have at the moment.

  2. Patrick Shriwise reporter

    I think that is probably ok as long as the python version is indicated in the tarball name, which means supporting some addition distributions for download. Would that be ok?

  3. Vijay M

    We can include the Python/Cython version in the distribution to tag it for provenance. What do you mean by supporting additional distributions for download ? @pshriwise

  4. Patrick Shriwise reporter

    Just that different python versions will multiply the number of links needed on the webpage, nothing more than that.

  5. Vijay M

    Understood. But does Cython generate different cpp files based on whether the runtime is 2.x or 3.x ? I'm still unclear on the details here. Since the underlying MOAB implementation is no different, we should be able to distribute two sets of directories for Cythonized cpp files depending on python version for the release tarballs. I don't want to provide two separate tarballs where all the MOAB code is the same and the only difference is PyMOAB/Cython glue code.

  6. Vijay M

    Please go ahead with the required changes. I'll keep an eye on your branch and we can continue to discuss and will contribute the configuration changes.

  7. Vijay M

    As of MOAB 5.1.0, PyMOAB requires Cython as a dependency. This requirement simplifies the workflow and we do not need to distribute the Cythonized cpp files anymore. This also allows for Python 2/3 compatibility and for architecture-specific optimizations to be executed by Cython as needed.

  8. Log in to comment