Skip to content

Commit abcbdef

Browse files
authored
Merge pull request #44 from adrianeboyd/chore/update-setup
Update setup
2 parents 42606ee + 176be61 commit abcbdef

File tree

6 files changed

+23
-197
lines changed

6 files changed

+23
-197
lines changed

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
recursive-include srsly *.h *.cc *.c *.cpp *.pyx *.pxd
1+
recursive-include srsly *.h *.cc *.c *.pyx *.pxd
22
include LICENSE
33
include README.md
4+
recursive-exclude srsly *.cpp

azure-pipelines.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
architecture: 'x64'
7272

7373
- script: |
74-
python -m pip install --upgrade pip wheel
74+
python -m pip install --upgrade pip setuptools
7575
pip install -r requirements.txt
7676
displayName: 'Install dependencies'
7777
@@ -85,10 +85,17 @@ jobs:
8585
contents: 'srsly'
8686
displayName: 'Delete source directory'
8787

88+
- script: |
89+
pip freeze > installed.txt
90+
pip uninstall -y -r installed.txt
91+
displayName: 'Uninstall all packages'
92+
8893
- bash: |
8994
SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1)
9095
pip install dist/$SDIST
9196
displayName: 'Install from sdist'
9297
93-
- script: python -m pytest --pyargs srsly
98+
- script: |
99+
pip install -r requirements.txt
100+
python -m pytest --pyargs srsly
94101
displayName: 'Run tests'

bin/cythonize.py

Lines changed: 0 additions & 169 deletions
This file was deleted.

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[build-system]
2+
requires = [
3+
"setuptools",
4+
"cython>=0.29.1,<0.30.0",
5+
]
6+
build-backend = "setuptools.build_meta"

setup.py

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33

44
import io
55
import os
6-
import subprocess
76
import sys
87
import contextlib
9-
from glob import glob
8+
from setuptools import Extension, setup, find_packages
109
from distutils.command.build_ext import build_ext
1110
from distutils.sysconfig import get_python_inc
12-
from distutils import ccompiler, msvccompiler
13-
from setuptools import Extension, setup, find_packages
11+
from Cython.Build import cythonize
1412

1513

16-
PACKAGE_DATA = {"": ["*.pyx", "*.pxd", "*.c", "*.h", "*.cpp"]}
14+
PACKAGE_DATA = {"": ["*.pyx", "*.pxd", "*.c", "*.h"]}
1715

1816

1917
PACKAGES = find_packages()
@@ -57,20 +55,6 @@ def build_extensions(self):
5755
build_ext.build_extensions(self)
5856

5957

60-
def generate_cython(root, source):
61-
print("Cythonizing sources")
62-
p = subprocess.call(
63-
[sys.executable, os.path.join(root, "bin", "cythonize.py"), source],
64-
env=os.environ,
65-
)
66-
if p != 0:
67-
raise RuntimeError("Running cythonize failed")
68-
69-
70-
def is_source_release(path):
71-
return os.path.exists(os.path.join(path, "PKG-INFO"))
72-
73-
7458
def clean(path):
7559
for name in MOD_NAMES:
7660
name = name.replace(".", "/")
@@ -114,7 +98,7 @@ def setup_package():
11498

11599
ext_modules = []
116100
for mod_name in MOD_NAMES:
117-
mod_path = mod_name.replace(".", "/") + ".cpp"
101+
mod_path = mod_name.replace(".", "/") + ".pyx"
118102
extra_link_args = []
119103
extra_compile_args = []
120104
# ???
@@ -152,9 +136,6 @@ def setup_package():
152136
)
153137
)
154138

155-
if not is_source_release(root):
156-
generate_cython(root, "srsly")
157-
158139
setup(
159140
name="srsly",
160141
zip_safe=True,
@@ -168,7 +149,7 @@ def setup_package():
168149
version=about["__version__"],
169150
url=about["__uri__"],
170151
license=about["__license__"],
171-
ext_modules=ext_modules,
152+
ext_modules=cythonize(ext_modules, language_level=2),
172153
setup_requires=["cython>=0.29.1,<0.30.0"],
173154
install_requires=['pathlib==1.0.1; python_version < "3.4"'],
174155
classifiers=[

srsly/about.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__title__ = "srsly"
2-
__version__ = "1.0.4"
2+
__version__ = "1.0.5"
33
__summary__ = "Modern high-performance serialization utilities for Python"
44
__uri__ = "https://explosion.ai"
55
__author__ = "Explosion AI"

0 commit comments

Comments
 (0)