-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
60 changed files
with
1,486 additions
and
1,198 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[project] | ||
name = "nographs" | ||
version = "3.4.0" | ||
version = "3.4.1" | ||
authors = [ | ||
{ name="Dr. Helmut Melcher", email="[email protected]" }, | ||
] | ||
|
@@ -23,6 +23,7 @@ classifiers = [ | |
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
"Programming Language :: Python :: 3.13", | ||
"Programming Language :: Python :: Implementation :: CPython", | ||
"Programming Language :: Python :: Implementation :: PyPy", | ||
"Intended Audience :: Developers", | ||
|
@@ -44,6 +45,24 @@ Changelog = "https://nographs.readthedocs.io/en/latest/changelog.html" | |
[tool.coverage.report] | ||
exclude_lines =["pragma: no cover", "@overload"] | ||
|
||
[tool.mypy] | ||
# Specified the target platform details in config, so the developers are | ||
# free to run mypy on Windows, Linux, or macOS and get consistent | ||
# results. | ||
python_version = "3.9" | ||
mypy_path = "src/nographs tests" | ||
strict = true | ||
disallow_untyped_defs = true | ||
warn_unreachable = true | ||
implicit_reexport = true | ||
show_error_codes = true | ||
show_column_numbers = true | ||
|
||
[build-system] | ||
requires = ["setuptools>=61.0"] | ||
requires = [ | ||
"setuptools>=61.0", | ||
"wheel ~=0.37.1", | ||
# "cython", # Only needed if Cython-compiled binary wheel is demanded | ||
# "mypy[mypyc]", # Only needed if MyPyC-compiled binary wheel is demanded | ||
] | ||
build-backend = "setuptools.build_meta" |
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,80 @@ | ||
# This file controls the compilation of the modules of the package to extension | ||
# modules by using MyPyC or Cython. If this option is not needed, it can be removed. | ||
# | ||
# Usage: If environment variable SETUP_BUILD_EXTENSION is set to MyPyC or Cython, | ||
# extension modules are build. And if it is set to "False", or not set at all, | ||
# the pure Python modules are copied into the wheel. | ||
|
||
import pathlib | ||
import os | ||
from setuptools import setup, find_packages | ||
|
||
|
||
def find_sources(exclude_from_compilation): | ||
compile_this = [] | ||
for file_path in pathlib.Path('.', 'src', 'nographs').glob('**/*.py'): | ||
if file_path.name in exclude_from_compilation: | ||
print('setup.py: We will skip the compilation of file', file_path) | ||
continue | ||
compile_this.append(str(file_path)) | ||
print('setup.py: We will compile these files:\n', compile_this, "\n") | ||
return compile_this | ||
|
||
|
||
compiler = os.environ.get('SETUP_BUILD_EXTENSION', "False").capitalize() | ||
match compiler: | ||
case "False": | ||
print("\nsetup.py: Building sdist (tarball) / and or pure Python wheel.") | ||
print("(Set environment variable SETUP_BUILD_EXTENSION to MyPyC or Cython " | ||
"to compile binaries.)") | ||
ext_modules = [] | ||
|
||
case "Mypyc": | ||
print(f"\nsetup.py: Compiling binaries using MyPyC.") | ||
print("(Set environment variable SETUP_BUILD_EXTENSION to False " | ||
"to build sdist / and or pure Python wheel instead.)") | ||
|
||
from mypyc.build import mypycify | ||
exclude_from_compilation = [ | ||
# The following file contains classes, compilation would be useful, but | ||
# it is intentionally not compiled here due to the following issue of | ||
# MyPyC: | ||
# https://github.com/mypyc/mypyc/issues/1022 | ||
'depth_first_enum_types.py', | ||
# The following file subclasses tuple[int]. MyPyC does not support this. | ||
# But on CPython this us much faster than to store the tuple in an attribute | ||
# Conditional class definition is also not supported. So, we simply exclude | ||
# this file from compilation. | ||
'_extra_matrix_gadgets.py', | ||
] | ||
compile_this = find_sources(exclude_from_compilation) | ||
ext_modules = mypycify(compile_this, strip_asserts=False) | ||
|
||
case "Cython": | ||
print(f"\nsetup.py: Compiling binaries using Cython.") | ||
print("(Set environment variable SETUP_BUILD_EXTENSION to False " | ||
"to build sdist / and or pure Python wheel instead.)") | ||
from Cython.Build import cythonize | ||
exclude_from_compilation = [] | ||
compile_this = find_sources(exclude_from_compilation) | ||
ext_modules = cythonize(compile_this, compiler_directives={'language_level': 3}) | ||
|
||
case _: | ||
raise RuntimeError( | ||
"Valid values or environment variable SETUP_BUILD_EXTENSION are:" | ||
" 'False', 'MyPyC', and 'Cython'" | ||
"If no value is set, this equals to 'False'.") | ||
|
||
if ext_modules: | ||
setup( | ||
name='nographs', | ||
package_dir={'': 'src'}, | ||
packages=find_packages('src'), | ||
ext_modules=ext_modules, | ||
) | ||
else: | ||
setup( | ||
name='nographs', | ||
package_dir={'': 'src'}, | ||
packages=find_packages('src'), | ||
) |
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
Oops, something went wrong.