From ba186299e16d8db5f1511b6d3a528925b4c02157 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Mon, 30 Sep 2019 20:10:55 +0200 Subject: [PATCH] Tidy up and modernize setup and config (#4344) * Tidy up and modernize setup and config * Update setup.cfg * Re-add pyproject.toml * Delete .flake8 * Move static meta from about to setup.cfg * Update setup.cfg Co-Authored-By: Matthew Honnibal --- .flake8 | 10 ------ MANIFEST.in | 2 +- pyproject.toml | 17 +++++----- setup.cfg | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 75 ----------------------------------------- spacy/about.py | 6 ---- 6 files changed, 100 insertions(+), 100 deletions(-) delete mode 100644 .flake8 create mode 100644 setup.cfg diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 8f3d81cac..000000000 --- a/.flake8 +++ /dev/null @@ -1,10 +0,0 @@ -[flake8] -ignore = E203, E266, E501, E731, W503 -max-line-length = 80 -select = B,C,E,F,W,T4,B9 -exclude = - .env, - .git, - __pycache__, - _tokenizer_exceptions_list.py, - spacy/__init__.py diff --git a/MANIFEST.in b/MANIFEST.in index 9ce7cb050..78655a5f4 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,7 +2,7 @@ recursive-include include *.h recursive-include spacy *.txt include LICENSE include README.md -include pyproject.toml include bin/spacy +include pyproject.toml recursive-exclude spacy/lang *.json recursive-include spacy/lang *.json.gz diff --git a/pyproject.toml b/pyproject.toml index 200a07a6f..0b01c715f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,11 @@ [build-system] -requires = ["setuptools", - "wheel>0.32.0,<0.33.0", - "Cython", - "cymem>=2.0.2,<2.1.0", - "preshed>=2.0.1,<2.1.0", - "murmurhash>=0.28.0,<1.1.0", - "thinc>=7.0.8,<7.1.0", - ] +requires = [ + "setuptools", + "wheel", + "cython>=0.25", + "cymem>=2.0.2,<2.1.0", + "preshed>=3.0.2,<3.1.0", + "murmurhash>=0.28.0,<1.1.0", + "thinc>=7.1.1,<7.2.0", +] build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..d5de94e5e --- /dev/null +++ b/setup.cfg @@ -0,0 +1,90 @@ +[metadata] +description = Industrial-strength Natural Language Processing (NLP) in Python +url = https://spacy.io +author = Explosion +author_email = contact@explosion.ai +license = MIT +long_description = file: README.md +long_description_content_type = text/markdown +classifiers = + Development Status :: 5 - Production/Stable + Environment :: Console + Intended Audience :: Developers + Intended Audience :: Science/Research + License :: OSI Approved :: MIT License + Operating System :: POSIX :: Linux + Operating System :: MacOS :: MacOS X + Operating System :: Microsoft :: Windows + Programming Language :: Cython + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Topic :: Scientific/Engineering + +[options] +zip_safe = false +include_package_data = true +scripts = + bin/spacy +python_requires = >=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.* +setup_requires = + wheel +install_requires = + numpy>=1.15.0 + murmurhash>=0.28.0,<1.1.0 + cymem>=2.0.2,<2.1.0 + preshed>=3.0.2,<3.1.0 + thinc>=7.1.1,<7.2.0 + blis>=0.4.0,<0.5.0 + plac<1.0.0,>=0.9.6 + requests>=2.13.0,<3.0.0 + wasabi>=0.2.0,<1.1.0 + srsly>=0.1.0,<1.1.0 + pathlib==1.0.1; python_version < "3.4" + +[options.extras_require] +cuda = + thinc_gpu_ops>=0.0.1,<0.1.0 + cupy>=5.0.0b4 +cuda80 = + thinc_gpu_ops>=0.0.1,<0.1.0 + cupy-cuda80>=5.0.0b4 +cuda90 = + thinc_gpu_ops>=0.0.1,<0.1.0 + cupy-cuda90>=5.0.0b4 +cuda91 = + thinc_gpu_ops>=0.0.1,<0.1.0 + cupy-cuda91>=5.0.0b4 +cuda92 = + thinc_gpu_ops>=0.0.1,<0.1.0 + cupy-cuda92>=5.0.0b4 +cuda100 = + thinc_gpu_ops>=0.0.1,<0.1.0 + cupy-cuda100>=5.0.0b4 +# Language tokenizers with external dependencies +ja = + mecab-python3==0.7 +ko = + natto-py==0.9.0 +th = + pythainlp>=2.0 + +[bdist_wheel] +universal = false + +[sdist] +formats = gztar + +[flake8] +ignore = E203, E266, E501, E731, W503 +max-line-length = 80 +select = B,C,E,F,W,T4,B9 +exclude = + .env, + .git, + __pycache__, + _tokenizer_exceptions_list.py, + spacy/__init__.py diff --git a/setup.py b/setup.py index c5ce79c93..faf8642d9 100755 --- a/setup.py +++ b/setup.py @@ -85,22 +85,6 @@ if is_new_osx(): LINK_OPTIONS["other"].append("-nodefaultlibs") -USE_OPENMP_DEFAULT = "0" if sys.platform != "darwin" else None -if os.environ.get("USE_OPENMP", USE_OPENMP_DEFAULT) == "1": - if sys.platform == "darwin": - COMPILE_OPTIONS["other"].append("-fopenmp") - LINK_OPTIONS["other"].append("-fopenmp") - PACKAGE_DATA["spacy.platform.darwin.lib"] = ["*.dylib"] - PACKAGES.append("spacy.platform.darwin.lib") - - elif sys.platform == "win32": - COMPILE_OPTIONS["msvc"].append("/openmp") - - else: - COMPILE_OPTIONS["other"].append("-fopenmp") - LINK_OPTIONS["other"].append("-fopenmp") - - # By subclassing build_extensions we have the actual compiler that will be used which is really known only after finalize_options # http://stackoverflow.com/questions/724664/python-distutils-how-to-get-a-compiler-that-is-going-to-be-used class build_ext_options: @@ -184,9 +168,6 @@ def setup_package(): about = {} exec(f.read(), about) - with io.open(os.path.join(root, "README.md"), encoding="utf8") as f: - readme = f.read() - include_dirs = [ get_python_inc(plat_specific=True), os.path.join(root, "include"), @@ -202,7 +183,6 @@ def setup_package(): for mod_name in MOD_NAMES: mod_path = mod_name.replace(".", "/") + ".cpp" extra_link_args = [] - extra_compile_args = [] # ??? # Imported from patch from @mikepb # See Issue #267. Running blind here... @@ -227,64 +207,9 @@ def setup_package(): setup( name="spacy", - zip_safe=False, packages=PACKAGES, - include_package_data=True, - description=about["__summary__"], - long_description=readme, - long_description_content_type="text/markdown", - author=about["__author__"], - author_email=about["__email__"], version=about["__version__"], - url=about["__uri__"], - license=about["__license__"], ext_modules=ext_modules, - scripts=["bin/spacy"], - install_requires=[ - "numpy>=1.15.0", - "murmurhash>=0.28.0,<1.1.0", - "cymem>=2.0.2,<2.1.0", - "preshed>=3.0.2,<3.1.0", - "thinc>=7.1.1,<7.2.0", - "blis>=0.4.0,<0.5.0", - "plac<1.0.0,>=0.9.6", - "requests>=2.13.0,<3.0.0", - "wasabi>=0.2.0,<1.1.0", - "srsly>=0.1.0,<1.1.0", - 'pathlib==1.0.1; python_version < "3.4"', - ], - setup_requires=["wheel"], - extras_require={ - "cuda": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy>=5.0.0b4"], - "cuda80": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda80>=5.0.0b4"], - "cuda90": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda90>=5.0.0b4"], - "cuda91": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda91>=5.0.0b4"], - "cuda92": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda92>=5.0.0b4"], - "cuda100": ["thinc_gpu_ops>=0.0.1,<0.1.0", "cupy-cuda100>=5.0.0b4"], - # Language tokenizers with external dependencies - "ja": ["mecab-python3==0.7"], - "ko": ["natto-py==0.9.0"], - "th": ["pythainlp>=2.0"], - }, - python_requires=">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Environment :: Console", - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Operating System :: POSIX :: Linux", - "Operating System :: MacOS :: MacOS X", - "Operating System :: Microsoft :: Windows", - "Programming Language :: Cython", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - "Topic :: Scientific/Engineering", - ], cmdclass={"build_ext": build_ext_subclass}, ) diff --git a/spacy/about.py b/spacy/about.py index 0d8023429..f4ef9665a 100644 --- a/spacy/about.py +++ b/spacy/about.py @@ -1,13 +1,7 @@ # fmt: off __title__ = "spacy" __version__ = "2.2.0" -__summary__ = "Industrial-strength Natural Language Processing (NLP) in Python" -__uri__ = "https://spacy.io" -__author__ = "Explosion" -__email__ = "contact@explosion.ai" -__license__ = "MIT" __release__ = True - __download_url__ = "https://github.com/explosion/spacy-models/releases/download" __compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json" __shortcuts__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/shortcuts-v2.json"