-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* build: use pyproject.toml * fix: fix build * chore: pin build dependencies version and update dependabot * ci: do not use coverage for compiled test * ci: drop python 3.7 * fix: fix `apischema.typing.get_args` * fix: make flake8 happy with setup.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix: fix scripts/generate_readme.py version retrieving * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
8a4da30
commit c58e402
Showing
10 changed files
with
85 additions
and
151 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
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
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
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
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
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,45 @@ | ||
[build-system] | ||
requires = ["setuptools==68.2.2", "wheel==0.41.2", "Cython==3.0.3"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "apischema" | ||
version = "0.18.1" | ||
authors = [{ name = "Joseph Perez", email = "joperez@hotmail.fr" }] | ||
license = { text = "MIT" } | ||
description = "JSON (de)serialization, GraphQL and JSON schema generation using Python typing." | ||
readme = "README.md" | ||
requires-python = ">=3.7" | ||
classifiers = [ | ||
"Development Status == 4 - Beta", | ||
"Intended Audience == Developers", | ||
"License == OSI Approved == MIT License", | ||
"Programming Language == Python == 3.7", | ||
"Programming Language == Python == 3.8", | ||
"Programming Language == Python == 3.9", | ||
"Programming Language == Python == 3.10", | ||
"Programming Language == Python == 3.11", | ||
"Programming Language == Python == 3.12", | ||
"Topic == Software Development == Libraries == Python Modules", | ||
] | ||
|
||
[project.urls] | ||
Repository = "https://github.com/wyfo/apischema" | ||
Documentation = "https://wyfo.github.io/apischema" | ||
|
||
[project.optional-dependencies] | ||
graphql = ["graphql-core>=3.0.0"] | ||
examples = [ | ||
"graphql-core>=3.0.0", | ||
"attrs", | ||
"docstring_parser", | ||
"bson", | ||
"orjson", | ||
"pydantic", | ||
"pytest", | ||
"sqlalchemy", | ||
] | ||
|
||
[tool.setuptools.package-data] | ||
apischema = ["py.typed"] | ||
scripts = ["cythonize.py"] |
This file was deleted.
Oops, something went wrong.
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,131 +1,21 @@ | ||
import pathlib | ||
import importlib | ||
import os | ||
import platform | ||
import sys | ||
import warnings | ||
|
||
# The following code is copied from | ||
# https://github.com/tornadoweb/tornado/blob/master/setup.py | ||
# to support installing without the extension on platforms where | ||
# no compiler is available. | ||
from distutils.command.build_ext import build_ext | ||
|
||
from setuptools import Extension, find_packages, setup | ||
|
||
|
||
class custom_build_ext(build_ext): | ||
"""Allow C extension building to fail. | ||
The C extension speeds up (de)serialization, but is not essential. | ||
""" | ||
|
||
warning_message = """ | ||
******************************************************************** | ||
WARNING: %s could not | ||
be compiled. No C extensions are essential for apischema to run, | ||
although they do result in significant speed improvements for | ||
(de)serialization. | ||
%s | ||
Here are some hints for popular operating systems: | ||
If you are seeing this message on Linux you probably need to | ||
install GCC and/or the Python development package for your | ||
version of Python. | ||
Debian and Ubuntu users should issue the following command: | ||
$ sudo apt-get install build-essential python-dev | ||
RedHat and CentOS users should issue the following command: | ||
$ sudo yum install gcc python-devel | ||
Fedora users should issue the following command: | ||
$ sudo dnf install gcc python-devel | ||
MacOS users should run: | ||
$ xcode-select --install | ||
******************************************************************** | ||
""" | ||
|
||
def run(self): | ||
try: | ||
build_ext.run(self) | ||
except Exception: | ||
e = sys.exc_info()[1] | ||
sys.stdout.write("%s\n" % str(e)) | ||
warnings.warn( | ||
self.warning_message | ||
% ( | ||
"Extension modules", | ||
"There was an issue with " | ||
"your platform configuration" | ||
" - see above.", | ||
) | ||
) | ||
|
||
def build_extension(self, ext): | ||
name = ext.name | ||
try: | ||
build_ext.build_extension(self, ext) | ||
except Exception: | ||
e = sys.exc_info()[1] | ||
sys.stdout.write("%s\n" % str(e)) | ||
warnings.warn( | ||
self.warning_message | ||
% ( | ||
"The %s extension " "module" % (name,), | ||
"The output above " | ||
"this warning shows how " | ||
"the compilation " | ||
"failed.", | ||
) | ||
) | ||
|
||
|
||
ext_modules = None | ||
# Cythonization makes apischema a lot slower using PyPy | ||
if platform.python_implementation() != "PyPy": | ||
ext_modules = [ | ||
Extension( | ||
f"apischema.{package}.methods", sources=[f"apischema/{package}/methods.c"] | ||
) | ||
for package in ("deserialization", "serialization") | ||
] | ||
|
||
setup( | ||
name="apischema", | ||
version="0.18.1", | ||
url="https://github.com/wyfo/apischema", | ||
author="Joseph Perez", | ||
author_email="joperez@hotmail.fr", | ||
license="MIT", | ||
packages=find_packages(include=["apischema*"]), | ||
package_data={ | ||
"apischema": ["py.typed"], | ||
"apischema.deserialization": ["methods.pyx"], | ||
"apischema.serialization": ["methods.pyx"], | ||
}, | ||
description="JSON (de)serialization, GraphQL and JSON schema generation using Python typing.", | ||
long_description=pathlib.Path("README.md").read_text(), | ||
long_description_content_type="text/markdown", | ||
python_requires=">=3.7", | ||
extras_require={ | ||
"graphql": ["graphql-core>=3.0.0"], | ||
"examples": [ | ||
"graphql-core>=3.0.0", | ||
"attrs", | ||
"docstring_parser", | ||
"bson", | ||
"orjson", | ||
"pydantic", | ||
"pytest", | ||
"sqlalchemy", | ||
], | ||
}, | ||
classifiers=[ | ||
"Development Status :: 4 - Beta", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
], | ||
cmdclass={"build_ext": custom_build_ext}, | ||
ext_modules=ext_modules, | ||
) | ||
from setuptools import Extension, setup | ||
|
||
sys.path.append(os.path.dirname(__file__)) | ||
importlib.import_module("scripts.cythonize").main() | ||
|
||
ext_modules = [ | ||
Extension( | ||
f"apischema.{package}.methods", | ||
sources=[f"apischema/{package}/methods.c"], | ||
optional=True, | ||
) | ||
for package in ("deserialization", "serialization") | ||
# Cythonization makes apischema slower using PyPy | ||
if platform.python_implementation() != "PyPy" | ||
] | ||
setup(ext_modules=ext_modules) |