-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
incomplete proof of concept for NixOS/nixpkgs#255262
Signed-off-by: lucasew <[email protected]>
- Loading branch information
Showing
9 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__pycache__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
{ pkgs ? import <nixpkgs> {} }: | ||
pkgs.python3Packages.callPackage ./package.nix { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .module import native_sum |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#cython: language_level=3 | ||
|
||
cimport cython | ||
|
||
def native_sum(x, y): | ||
return cy_sum(x, y) | ||
|
||
cdef int cy_sum(int x, int y): | ||
return x + y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from demo_cython_pytest import native_sum | ||
|
||
def test_module(): | ||
assert native_sum(2, 2) == 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ buildPythonPackage | ||
, pytestCheckHook | ||
, cython | ||
, python | ||
}: | ||
|
||
buildPythonPackage { | ||
pname = "demo_cython_pytest"; | ||
version = "0.0.1"; | ||
|
||
src = ./.; | ||
|
||
pythonImportsCheck = [ "demo_cython_pytest.module.native_sum" ]; | ||
|
||
nativeBuildInputs = [ | ||
# pytestCheckHook | ||
cython | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from distutils.core import Extension | ||
from setuptools import setup, find_packages | ||
from Cython.Build import cythonize | ||
from Cython.Distutils import build_ext | ||
# from distutils.command.build_ext import build_ext | ||
|
||
|
||
def ext_modules(): | ||
modules = [] | ||
includes = [] | ||
libraries = [] | ||
modules += cythonize(Extension( | ||
"*", | ||
["demo_cython_pytest/module.pyx"], | ||
include_dirs=includes, | ||
libraries=libraries | ||
)) | ||
return modules | ||
|
||
setup( | ||
name="demo_cython_pytest", | ||
version="0.0.1", | ||
description="Circular imports?", | ||
author="lucasew", | ||
packages=["demo_cython_pytest"], | ||
ext_modules=ext_modules(), | ||
include_package_data=True, | ||
cmdclass=dict( | ||
build_ext=build_ext | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ pkgs ? import <nixpkgs> {} }: | ||
pkgs.mkShell { | ||
buildInputs = [ | ||
(pkgs.python3Packages.callPackage ./package.nix { }) | ||
]; | ||
} |