• Kirill Smelkov's avatar
    Start using Cython and providing Cython/nogil API · 8fa3c15b
    Kirill Smelkov authored
    Start transforming Pygolang from being pure Python project into project
    that uses both Python and Cython and provides both Python and Cython API
    to its users.
    
    For Cython API there is a goal for it to be usable independently of
    Python GIL - i.e. independently of Python runtime and limitations
    imposed by Python's global interpreter lock. The motivation for this
    work is wendelin.core v2, which, due to its design, would deadlock if it
    tries to take the GIL in its pinner thread.
    
    This commit brings bare minimum establishing libraries and build system.
    It:
    
    - Introduces C/C++ library libgolang. Libgolang will be serving most of
      nogil functionality and Pyx API will be a small wrapper over it. At
      this step Libgolang comes only with C-level panic;
    
    - Introduces Pyx package golang that is aliased to Pyx package
      golang._golang . Users can do `from golang cimport ...` similarly to how
      they do py-level `from golang import ...`. At this step golang.pyx
      only wraps panic and provides way to transform C-level panic into Python
      exception;
    
    - Introduces Py package golang.pyx.build . This package, similarly to
      golang.org/pkg/go/build, serves as the system to build Pyx packages -
      both external packages that use Pygolang in pyx mode, and to build
      Pygolang itself. The build, internally, is served by setuptools_dso
      and cython. An example how to use golang.pyx.build from external
      project comes in golang/pyx/testprog/golang_pyx_user/ and is used by
      tests to verify golang.pyx.build functionality;
    
    - Introduces Pygolang build dependency to cython and setuptools_dso.
    8fa3c15b
__init__.py 20.6 KB