Skip to content

Commit

Permalink
Merge pull request #44 from adrianeboyd/chore/update-setup
Browse files Browse the repository at this point in the history
Update setup
  • Loading branch information
adrianeboyd authored Dec 4, 2020
2 parents 42606ee + 176be61 commit abcbdef
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 197 deletions.
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
recursive-include srsly *.h *.cc *.c *.cpp *.pyx *.pxd
recursive-include srsly *.h *.cc *.c *.pyx *.pxd
include LICENSE
include README.md
recursive-exclude srsly *.cpp
11 changes: 9 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
architecture: 'x64'

- script: |
python -m pip install --upgrade pip wheel
python -m pip install --upgrade pip setuptools
pip install -r requirements.txt
displayName: 'Install dependencies'
Expand All @@ -85,10 +85,17 @@ jobs:
contents: 'srsly'
displayName: 'Delete source directory'

- script: |
pip freeze > installed.txt
pip uninstall -y -r installed.txt
displayName: 'Uninstall all packages'
- bash: |
SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1)
pip install dist/$SDIST
displayName: 'Install from sdist'
- script: python -m pytest --pyargs srsly
- script: |
pip install -r requirements.txt
python -m pytest --pyargs srsly
displayName: 'Run tests'
169 changes: 0 additions & 169 deletions bin/cythonize.py

This file was deleted.

6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[build-system]
requires = [
"setuptools",
"cython>=0.29.1,<0.30.0",
]
build-backend = "setuptools.build_meta"
29 changes: 5 additions & 24 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@

import io
import os
import subprocess
import sys
import contextlib
from glob import glob
from setuptools import Extension, setup, find_packages
from distutils.command.build_ext import build_ext
from distutils.sysconfig import get_python_inc
from distutils import ccompiler, msvccompiler
from setuptools import Extension, setup, find_packages
from Cython.Build import cythonize


PACKAGE_DATA = {"": ["*.pyx", "*.pxd", "*.c", "*.h", "*.cpp"]}
PACKAGE_DATA = {"": ["*.pyx", "*.pxd", "*.c", "*.h"]}


PACKAGES = find_packages()
Expand Down Expand Up @@ -57,20 +55,6 @@ def build_extensions(self):
build_ext.build_extensions(self)


def generate_cython(root, source):
print("Cythonizing sources")
p = subprocess.call(
[sys.executable, os.path.join(root, "bin", "cythonize.py"), source],
env=os.environ,
)
if p != 0:
raise RuntimeError("Running cythonize failed")


def is_source_release(path):
return os.path.exists(os.path.join(path, "PKG-INFO"))


def clean(path):
for name in MOD_NAMES:
name = name.replace(".", "/")
Expand Down Expand Up @@ -114,7 +98,7 @@ def setup_package():

ext_modules = []
for mod_name in MOD_NAMES:
mod_path = mod_name.replace(".", "/") + ".cpp"
mod_path = mod_name.replace(".", "/") + ".pyx"
extra_link_args = []
extra_compile_args = []
# ???
Expand Down Expand Up @@ -152,9 +136,6 @@ def setup_package():
)
)

if not is_source_release(root):
generate_cython(root, "srsly")

setup(
name="srsly",
zip_safe=True,
Expand All @@ -168,7 +149,7 @@ def setup_package():
version=about["__version__"],
url=about["__uri__"],
license=about["__license__"],
ext_modules=ext_modules,
ext_modules=cythonize(ext_modules, language_level=2),
setup_requires=["cython>=0.29.1,<0.30.0"],
install_requires=['pathlib==1.0.1; python_version < "3.4"'],
classifiers=[
Expand Down
2 changes: 1 addition & 1 deletion srsly/about.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = "srsly"
__version__ = "1.0.4"
__version__ = "1.0.5"
__summary__ = "Modern high-performance serialization utilities for Python"
__uri__ = "https://explosion.ai"
__author__ = "Explosion AI"
Expand Down

0 comments on commit abcbdef

Please sign in to comment.