Skip to content

Commit

Permalink
Make cython package
Browse files Browse the repository at this point in the history
  • Loading branch information
AWehrhahn committed Jun 8, 2021
1 parent e89819a commit f94654e
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ jobs:
- run: zip -r ${{ matrix.container }}-${{ matrix.compiler}} lib share

- run: pip3 install -r test/requirements.txt
- run: pip3 install -r cython/requirements.txt
- run: |
cd cython/
python setup.py build_ext --inplace
pip3 install .
cd ..
- run: python3 -m pytest

- name: Upload Debug Spectrum
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,5 @@ src/sme/hlinprof.c
debug_radiative_transfer.npz
origin/
**/.deps/
test/cywrapper.cpp
cython/smelib.egg-info/
cython/smelib.cpp
4 changes: 4 additions & 0 deletions cython/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Installing Cython
=================

Run python setup.py build_ext --inplace
2 changes: 2 additions & 0 deletions cython/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
numpy
cython
19 changes: 19 additions & 0 deletions cython/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from os.path import join, realpath, dirname
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize

lib_path = realpath(join(dirname(__file__), "../lib"))
file_path = realpath(join(dirname(__file__), "smelib.pyx"))

examples_extension = Extension(
name="smelib",
sources=[file_path],
libraries=["gfortran", "sme"],
library_dirs=[lib_path],
runtime_library_dirs=[lib_path],
)
setup(
name="smelib",
ext_modules=cythonize([examples_extension], language_level=3)
)
File renamed without changes.
3 changes: 1 addition & 2 deletions test/cython_call.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from os.path import dirname, join, realpath, exists
import numpy as np
import logging
import cywrapper
import cywrapper as dll
import smelib as dll
logger = logging.getLogger(__name__)

def check_data_files_exist():
Expand Down
5 changes: 2 additions & 3 deletions test/test_cython.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import numpy as np
import logging

# from sme_synth import SME_DLL
# from cwrapper import get_lib_name
import cywrapper as dll
# Run python setup.py build_ext --inplace
import smelib as dll


logger = logging.getLogger(__name__)
Expand Down

0 comments on commit f94654e

Please sign in to comment.