diff --git a/MANIFEST.in b/MANIFEST.in index 924c8c7d..5ea1c372 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,2 @@ include LICENSE -include VERSION.txt +include geomdl/VERSION.txt diff --git a/README.rst b/README.rst index 04b9c472..c9bd8b00 100644 --- a/README.rst +++ b/README.rst @@ -1,7 +1,7 @@ NURBS-Python (geomdl) ^^^^^^^^^^^^^^^^^^^^^ -|RTD|_ |PYPI|_ |PYPIDL|_ +|GHACTIONS|_ |RTD|_ |PYPI|_ |PYPIDL|_ Introduction ============ @@ -72,3 +72,6 @@ NURBS-Python (geomdl) is licensed under the terms of `MIT License `_ an .. |PYPIDL| image:: https://img.shields.io/pypi/dm/geomdl.svg .. _PYPIDL: https://pypi.org/project/geomdl/ + +.. |GHACTIONS| image:: https://img.shields.io/github/actions/workflow/status/orbingol/NURBS-Python/build.yml +.. _GHACTIONS: https://github.com/orbingol/NURBS-Python/actions/workflows/build.yml diff --git a/docs/_requirements.txt b/docs/_requirements.txt index d516141d..6ca06ed5 100644 --- a/docs/_requirements.txt +++ b/docs/_requirements.txt @@ -2,3 +2,4 @@ numpy>=2.0, <3.0 matplotlib>=3.9.0 plotly>=6.0.0 +sphinx-rtd-theme>=3.0.0 diff --git a/docs/conf.py b/docs/conf.py index bb021ba7..4255e12f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -92,7 +92,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -111,7 +111,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = "default" +html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/docs/index.rst b/docs/index.rst index 331adb1f..830dc2d4 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,9 +1,7 @@ NURBS-Python v5.x Documentation ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -|DOI|_ |PYPI|_ |ANACONDA|_ - -|TRAVISCI|_ |APPVEYOR|_ |CIRCLECI|_ +|PYPI|_ |PYPIDL|_ Welcome to the **NURBS-Python (geomdl) v5.x** documentation! @@ -58,26 +56,11 @@ This documentation is organized into a couple sections: modules modules_visualization - modules_cli - modules_shapes modules_rhino modules_acis - -.. |DOI| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.815010.svg -.. _DOI: https://doi.org/10.5281/zenodo.815010 - .. |PYPI| image:: https://img.shields.io/pypi/v/geomdl.svg .. _PYPI: https://pypi.org/project/geomdl/ -.. |ANACONDA| image:: https://anaconda.org/orbingol/geomdl/badges/version.svg -.. _ANACONDA: https://anaconda.org/orbingol/geomdl - -.. |TRAVISCI| image:: https://travis-ci.org/orbingol/NURBS-Python.svg?branch=5.x -.. _TRAVISCI: https://travis-ci.org/orbingol/NURBS-Python - -.. |APPVEYOR| image:: https://ci.appveyor.com/api/projects/status/github/orbingol/nurbs-python?branch=5.x&svg=true -.. _APPVEYOR: https://ci.appveyor.com/project/orbingol/nurbs-python - -.. |CIRCLECI| image:: https://circleci.com/gh/orbingol/NURBS-Python/tree/5.x.svg?style=shield -.. _CIRCLECI: https://circleci.com/gh/orbingol/NURBS-Python/tree/5.x +.. |PYPIDL| image:: https://img.shields.io/pypi/dm/geomdl.svg +.. _PYPIDL: https://pypi.org/project/geomdl/ diff --git a/docs/install.rst b/docs/install.rst index b5b1a4a2..af9a8d5c 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -1,7 +1,7 @@ Installation and Testing ^^^^^^^^^^^^^^^^^^^^^^^^ -**Installation via pip or conda is the recommended method for all users.** +**Installation via pip is the recommended method for all users.** Manual method is only recommended for advanced users. Please note that if you have used any of these methods to install NURBS-Python, please use the same method to upgrade to the latest version. @@ -34,27 +34,6 @@ Installing a specific version: $ pip install --user geomdl==5.0.0 -Install via Conda -================= - -NURBS-Python can also be installed/upgraded via `conda `_ package manager from the -`Anaconda Cloud `_ repository. - -Installing: - -.. code-block:: console - - $ conda install -c orbingol geomdl - -Upgrading to the latest version: - -.. code-block:: console - - $ conda upgrade -c orbingol geomdl - -If you are experiencing problems with this method, you can try to upgrade ``conda`` package itself before -installing the NURBS-Python library. - Manual Install ============== @@ -123,24 +102,7 @@ following command along with the pure Python version. .. code-block:: console - $ pip install --user . --install-option="--use-cython" - -This command will generate .c files (i.e. cythonization) and compile the .c files into binary Python modules. - -The following command can be used to directly compile and install from the existing .c files, skipping the cythonization -step: - -.. code-block:: console - - $ pip install --user . --install-option="--use-source" - -To update the compiled module with the latest changes, you need to re-cythonize the code. - -To enable Cython-compiled module in development mode; - -.. code-block:: console - - $ python setup.py build_ext --use-cython --inplace + $ SETUPTOOLS_USE_CYTHON=1 pip install --user . After the successful execution of the command, the you can import and use the compiled library as follows: @@ -166,33 +128,4 @@ After the successful execution of the command, the you can import and use the co crv.vis = vis.VisCurve3D() crv.render() -Before Cython compilation, please make sure that you have `Cython `_ module and a valid compiler -installed for your operating system. - -Docker Containers -================= - -A collection of Docker containers is provided on `Docker Hub `_ -containing NURBS-Python, Cython-compiled core and the `command-line application `_. -To get started, first install `Docker `_ and then run the following on the Docker command -prompt to pull the image prepared with Python v3.5: - -.. code-block:: console - - $ docker pull idealabisu/nurbs-python:py35 - -On the `Docker Repository `_ page, you can find containers tagged for -Python versions and `Debian `_ (no suffix) and `Alpine Linux `_ -(``-alpine`` suffix) operating systems. Please change the tag of the pull command above for downloading your preferred -image. - -After pulling your preferred image, run the following command: - -.. code-block:: console - - $ docker run --rm -it --name geomdl -p 8000:8000 idealabisu/nurbs-python:py35 - -In all images, Matplotlib is set to use ``webagg`` backend by default. Please follow the instructions on the command -line to view your figures. - -Please refer to the `Docker documentation `_ for details on using Docker. +Before the Cython compilation, please make sure that you have a valid compiler installed for your operating system. diff --git a/docs/introduction.rst b/docs/introduction.rst index 058c8ae9..a37d4ab3 100644 --- a/docs/introduction.rst +++ b/docs/introduction.rst @@ -21,10 +21,7 @@ Some significant features of NURBS-Python (geomdl): * Pure Python, no external C/C++ or FORTRAN library dependencies * Python compatibility: 2.7.x, 3.4.x and later * For higher performance, optional *Compile with Cython* options are also available -* Easy to install via `pip `_ or `conda `_ -* `Docker images `_ are available -* ``geomdl-shapes`` module for generating common spline and analytic geometries -* ``geomdl-cli`` module for using the library from the command line +* Easy to install via `pip `_ NURBS-Python (geomdl) contains the following fundamental geometric algorithms: diff --git a/docs/modules_cli.rst b/docs/modules_cli.rst deleted file mode 100644 index 3d2c5d28..00000000 --- a/docs/modules_cli.rst +++ /dev/null @@ -1,35 +0,0 @@ -Command-line Application -^^^^^^^^^^^^^^^^^^^^^^^^ - -You can use NURBS-Python (geomdl) with the command-line application `geomdl-cli `_. -The command-line application is designed for automation and input files are highly customizable using -`Jinja2 `_ templates. - -``geomdl-cli`` is highly extensible via via the configuration file. It is very easy to generate custom commands as well as -variables to change behavior of the existing commands or independently use for the custom commands. Since it runs inside -the user's Python environment, it is possible to create commands that use the existing Python libraries and even integrate -NURBS-Python (geomdl) with these libraries. - -Installation -============ - -The easiest method to install is via ``pip``. It will install all the required modules. - -.. code-block:: console - - $ pip install --user geomdl.cli - -Please refer to `geomdl-cli documentation `_ for more installation options. - -Documentation -============= - -``geomdl-cli`` has a very detailed `online documentation `_ which describes the usage and customization -options of the command-line application. - -References -========== - -* **PyPI**: https://pypi.org/project/geomdl.cli -* **Documentation**: https://geomdl-cli.readthedocs.io -* **Development**: https://github.com/orbingol/geomdl-cli diff --git a/docs/modules_shapes.rst b/docs/modules_shapes.rst deleted file mode 100644 index 7e835412..00000000 --- a/docs/modules_shapes.rst +++ /dev/null @@ -1,31 +0,0 @@ -Shapes Module -^^^^^^^^^^^^^ - -The ``shapes`` module provides simple functions to generate commonly used analytic and spline geometries using -NURBS-Python (geomdl). - -Prior to NURBS-Python (geomdl) v5.0.0, the ``shapes`` module was automatically installed with the main package. -Currently, it is maintained as a separate package. - -Installation -============ - -The easiest method to install is via ``pip``. - -.. code-block:: console - - $ pip install --user geomdl.shapes - -Please refer to `geomdl-shapes documentation `_ for more installation options. - -Documentation -============= - -You can find the class and function references in the `geomdl-shapes documentation `_. - -References -========== - -* **PyPI**: https://pypi.org/project/geomdl.shapes -* **Documentation**: https://geomdl-shapes.readthedocs.io -* **Development**: https://github.com/orbingol/geomdl-shapes diff --git a/geomdl/__init__.py b/geomdl/__init__.py index 3368a8a5..1da9df06 100644 --- a/geomdl/__init__.py +++ b/geomdl/__init__.py @@ -4,8 +4,18 @@ """ +import pathlib + + +def geomdl_version(): + version_file = pathlib.Path(__file__).parent / "VERSION.txt" + if version_file.exists(): + return version_file.read_text() + return "0.0.0-dev" + + # Library version -__version__ = "5.3.1" +__version__ = geomdl_version() # Support for "from geomdl import *" # @see: https://stackoverflow.com/a/41895257 @@ -31,8 +41,3 @@ "utilities", "voxelize", ] - - -def geomdl_version(): - """Returns geomdl full version as a tuple""" - return tuple(__version__.split(".")) diff --git a/geomdl/exchange.py b/geomdl/exchange.py index 3e604e5c..8f8941cb 100644 --- a/geomdl/exchange.py +++ b/geomdl/exchange.py @@ -238,9 +238,6 @@ def export_cfg(obj, file_name): Requires `libconf `_ package. - Libconfig format is also used by the `geomdl command-line application `_ - as a way to input shape data from the command line. - :param obj: input geometry :type obj: abstract.SplineGeometry, multi.AbstractContainer :param file_name: name of the output file @@ -310,9 +307,6 @@ def export_yaml(obj, file_name): Requires `ruamel.yaml `_ package. - YAML format is also used by the `geomdl command-line application `_ - as a way to input shape data from the command line. - :param obj: input geometry :type obj: abstract.SplineGeometry, multi.AbstractContainer :param file_name: name of the output file @@ -371,9 +365,6 @@ def callback(data): def export_json(obj, file_name): """Exports curves and surfaces in JSON format. - JSON format is also used by the `geomdl command-line application `_ - as a way to input shape data from the command line. - :param obj: input geometry :type obj: abstract.SplineGeometry, multi.AbstractContainer :param file_name: name of the output file diff --git a/pyproject.toml b/pyproject.toml index 48faad57..3daecddd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=64", "setuptools-scm>8"] +requires = ["setuptools>=64", "setuptools-scm>8", "cython>=3.1.0"] build-backend = "setuptools.build_meta" [project] @@ -36,14 +36,14 @@ Issues = "https://github.com/orbingol/NURBS-Python/issues" [project.optional-dependencies] vis = ["numpy>=2.0, <3.0", "matplotlib>=3.9.0", "plotly>=6.0.0"] test = ["pytest>=8.0.0"] -docs = ["sphinx>=8.3.0"] +docs = ["sphinx>=8.3.0", "sphinx-rtd-theme>=3.0.0"] [tool.setuptools] # package-dir = {"" = "src"} packages = ["geomdl", "geomdl.visualization"] [tool.setuptools_scm] -version_file = "VERSION.txt" +version_file = "geomdl/VERSION.txt" [tool.cibuildwheel] archs = ["auto"] diff --git a/setup-old.py b/setup-old.py deleted file mode 100644 index 98c7749f..00000000 --- a/setup-old.py +++ /dev/null @@ -1,283 +0,0 @@ -#!/usr/bin/env python - -# NURBS-Python - Copyright (c) 2016-2018 Onur Rauf Bingol -# geomdl - Copyright (c) 2018-2019 Onur Rauf Bingol -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. - -from setuptools import setup -from setuptools import Extension -from setuptools.command.install import install as install_command -from setuptools.command.test import test as test_command -from distutils.command.clean import clean as clean_command -import sys -import os -import re -import shutil - -# Global variables to control generation of optional Cython-compiled library core module -BUILD_FROM_CYTHON = False -BUILD_FROM_SOURCE = False - - -def read(file_name): - return open(os.path.join(os.path.dirname(__file__), file_name)).read() - - -# Implemented from http://stackoverflow.com/a/41110107 -def get_property(prop, project): - result = re.search(r'{}\s*=\s*[\'"]([^\'"]*)[\'"]'.format(prop), open(project + "/__init__.py").read()) - return result.group(1) - - -class InstallCommand(install_command): - """Overrides pip install command to control generation of optional Cython-compiled library core module""" - - user_options = install_command.user_options + [ - ("use-cython", None, "Cythonize and compile geomdl.core"), - ("use-source", None, "Compile geomdl.core from the source files"), - ("core-only", None, "Compile and install geomdl.core only"), - ] - - def initialize_options(self): - install_command.initialize_options(self) - self.use_cython = 0 - self.use_source = 0 - - def finalize_options(self): - install_command.finalize_options(self) - - def run(self): - global BUILD_FROM_CYTHON, BUILD_FROM_SOURCE - BUILD_FROM_CYTHON = True if self.use_cython > 0 else False - BUILD_FROM_SOURCE = True if self.use_source > 0 else False - install_command.run(self) - - -# Reference: https://docs.pytest.org/en/latest/goodpractices.html -class PyTest(test_command): - """Allows test command to call py.test""" - - user_options = [("pytest-args=", "a", "Arguments to pass to pytest")] - - def initialize_options(self): - test_command.initialize_options(self) - self.pytest_args = "" - - def run_tests(self): - import shlex - - # import here, cause outside the eggs aren't loaded - import pytest - - errno = pytest.main(shlex.split(self.pytest_args)) - sys.exit(errno) - - -class SetuptoolsClean(clean_command): - """Cleans Cython-generated source files and setuptools-generated directories""" - - def run(self): - # Call parent method - clean_command.run(self) - - # Clean setuptools-generated directories - st_dirs = ["dist", "build", "geomdl.egg-info", "geomdl.core.egg-info"] - - print("Removing setuptools-generated directories") - for d in st_dirs: - d_path = os.path.join(os.path.dirname(__file__), d) - shutil.rmtree(d_path, ignore_errors=True) - - # Find list of files with .c extension - flist_c, flist_c_path = read_files("geomdl", ".c") - - # Clean files with .c extensions - if flist_c_path: - print("Removing Cython-generated source files with .c extension") - for f in flist_c_path: - f_path = os.path.join(os.path.dirname(__file__), f) - os.unlink(f_path) - - # Find list of files with .cpp extension - flist_cpp, flist_cpp_path = read_files("geomdl", ".cpp") - - # Clean files with .cpp extensions - if flist_cpp_path: - print("Removing Cython-generated source files with .cpp extension") - for f in flist_cpp_path: - f_path = os.path.join(os.path.dirname(__file__), f) - os.unlink(f_path) - - -def read_files(project, ext): - """Reads files inside the input project directory.""" - project_path = os.path.join(os.path.dirname(__file__), project) - file_list = os.listdir(project_path) - flist = [] - flist_path = [] - for f in file_list: - f_path = os.path.join(project_path, f) - if os.path.isfile(f_path) and f.endswith(ext) and f != "__init__.py": - flist.append(f.split(".")[0]) - flist_path.append(f_path) - return flist, flist_path - - -def copy_files(src, ext, dst): - """Copies files with extensions "ext" from "src" to "dst" directory.""" - src_path = os.path.join(os.path.dirname(__file__), src) - dst_path = os.path.join(os.path.dirname(__file__), dst) - file_list = os.listdir(src_path) - for f in file_list: - if f == "__init__.py": - continue - f_path = os.path.join(src_path, f) - if os.path.isfile(f_path) and f.endswith(ext): - shutil.copy(f_path, dst_path) - - -def make_dir(project): - """Creates the project directory for compiled modules.""" - project_path = os.path.join(os.path.dirname(__file__), project) - # Delete the directory and the files inside it - if os.path.exists(project_path): - shutil.rmtree(project_path) - # Create the directory - os.mkdir(project_path) - # We need a __init__.py file inside the directory - with open(os.path.join(project_path, "__init__.py"), "w") as fp: - fp.write('__version__ = "' + str(get_property("__version__", "geomdl")) + '"\n') - fp.write('__author__ = "' + str(get_property("__author__", "geomdl")) + '"\n') - fp.write('__license__ = "' + str(get_property("__license__", "geomdl")) + '"\n') - - -def in_argv(arg_list): - """Checks if any of the elements of the input list is in sys.argv array.""" - for arg in sys.argv: - for parg in arg_list: - if parg == arg or arg.startswith(parg): - return True - return False - - -# Define setup.py commands to activate Cython compilation -possible_cmds = ["install", "build", "bdist"] - -# Use geomdl.core package only -if "--core-only" in sys.argv: - package_name = "geomdl.core" - package_dir = "geomdl/core" - packages = [] - sys.argv.remove("--core-only") - sys.argv.append("--use-cython") -else: - package_name = package_dir = "geomdl" - packages = ["geomdl", "geomdl.visualization"] - -# geomdl.core compilation -# Ref: https://gist.github.com/ctokheim/6c34dc1d672afca0676a - -# Use already Cythonized C code -if in_argv(possible_cmds) and "--use-source" in sys.argv: - BUILD_FROM_SOURCE = True - sys.argv.remove("--use-source") - -# Use Cython to (re)generate C code (overrides "--use-source") -if in_argv(possible_cmds) and "--use-cython" in sys.argv: - # Try to import Cython - try: - from Cython.Build import cythonize - except ImportError: - raise ImportError("Cython is required for this step. Please install it via 'pip install cython'") - - BUILD_FROM_CYTHON = True - BUILD_FROM_SOURCE = False - sys.argv.remove("--use-cython") - -# We don't want to include any compiled files with the distribution -ext_modules = [] - -if BUILD_FROM_CYTHON or BUILD_FROM_SOURCE: - # Choose the file extension - file_ext = ".py" if BUILD_FROM_CYTHON else ".c" - - # Create Cython-compiled module directory - make_dir("geomdl/core") - - # Create extensions - optional_extensions = [] - fnames, fnames_path = read_files("geomdl", file_ext) - for fname, fpath in zip(fnames, fnames_path): - temp = Extension("geomdl.core." + str(fname), sources=[fpath]) - optional_extensions.append(temp) - - # Call Cython when "python setup.py build_ext --use-cython" is executed - if BUILD_FROM_CYTHON: - ext_modules = cythonize(optional_extensions, compiler_directives={"language_level": sys.version_info[0]}) - - # Compile from C source when "python setup.py build_ext --use-source" is executed - if BUILD_FROM_SOURCE: - ext_modules = optional_extensions - - # Add Cython-compiled module to the packages list - packages.append("geomdl.core") - -# Input for setuptools.setup -data = dict( - name=package_name, - version=get_property("__version__", package_dir), - description=get_property("__description__", package_dir), - long_description=read("DESCRIPTION.rst"), - license=get_property("__license__", package_dir), - author=get_property("__author__", package_dir), - author_email="nurbs-python@googlegroups.com", - url="https://github.com/orbingol/NURBS-Python", - keywords=get_property("__keywords__", package_dir), - packages=packages, - install_requires=[], - tests_require=["pytest>=3.6.0"], - cmdclass={"install": InstallCommand, "test": PyTest, "clean": SetuptoolsClean}, - ext_modules=ext_modules, - zip_safe=False, - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Topic :: Scientific/Engineering :: Mathematics", - "Topic :: Scientific/Engineering :: Visualization", - "Operating System :: OS Independent", - "Programming Language :: Python :: 2", - "Programming Language :: Python :: 2.7", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.4", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - ], - project_urls={ - "Documentation": "http://nurbs-python.readthedocs.io/", - "Source": "https://github.com/orbingol/NURBS-Python", - "Tracker": "https://github.com/orbingol/NURBS-Python/issues", - }, -) - - -# if __name__ == "__main__": -# setup(**data) diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 2a9acf13..00000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[bdist_wheel] -universal = 1 diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..3188fc36 --- /dev/null +++ b/setup.py @@ -0,0 +1,51 @@ +# This file is necessary only for cython builds + +from setuptools import setup +from setuptools import Extension +import os +import sys +import pathlib + +# Allows command: SETUPTOOLS_USE_CYTHON=1 pip install -e . +USE_CYTHON = os.getenv("SETUPTOOLS_USE_CYTHON", "0") == "1" + + +def read_files(project: str, ext: str): + project_path = pathlib.Path(__file__).resolve().parent / project + relative_path = pathlib.Path(project) + flist = [] + flist_path = [] + for file in project_path.iterdir(): + if file.is_file() and file.suffix == ext and file.name != "__init__.py": + flist.append(file.stem) + flist_path.append(str(relative_path / file.name)) + return flist, flist_path + + +# We don't want to include any compiled files with the distribution +ext_modules = [] + +if USE_CYTHON: + # Set file extension + file_ext = ".py" + + # Create module directory + pathlib.Path("geomdl/core").mkdir(exist_ok=True) + pathlib.Path("geomdl/core/__init__.py").touch(exist_ok=True) + + # Create extensions + optional_extensions = [] + fnames, fnames_path = read_files("geomdl", file_ext) + for fname, fpath in zip(fnames, fnames_path): + temp = Extension("geomdl.core." + str(fname), sources=[fpath]) + optional_extensions.append(temp) + + # Run cython + from Cython.Build import cythonize + + ext_modules = cythonize( + optional_extensions, compiler_directives={"language_level": sys.version_info[0]}, build_dir="build" + ) + +# Run setuptools +setup(ext_modules=ext_modules)