fdce
Advanced tools
| name: Build and upload to PyPI | ||
| on: | ||
| push: | ||
| tags: | ||
| - v* | ||
| workflow_dispatch: | ||
| jobs: | ||
| build_wheels: | ||
| name: Build wheels on ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| matrix: | ||
| os: [ubuntu-20.04, windows-2019, macos-10.15] | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Build wheels | ||
| uses: pypa/cibuildwheel@v2.6.0 | ||
| - uses: actions/upload-artifact@v2 | ||
| with: | ||
| path: ./wheelhouse/*.whl | ||
| build_sdist: | ||
| name: Build source distribution | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Build sdist | ||
| run: pipx run build --sdist | ||
| - uses: actions/upload-artifact@v2 | ||
| with: | ||
| path: dist/*.tar.gz | ||
| upload_pypi: | ||
| needs: [build_wheels, build_sdist] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/download-artifact@v2 | ||
| with: | ||
| name: artifact | ||
| path: dist | ||
| - uses: pypa/gh-action-pypi-publish@v1.4.2 | ||
| with: | ||
| user: __token__ | ||
| password: ${{ secrets.PYPI_RELEASE_TOKEN }} |
+132
| # Byte-compiled / optimized / DLL files | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *$py.class | ||
| # C extensions | ||
| *.so | ||
| # Distribution / packaging | ||
| .Python | ||
| build/ | ||
| develop-eggs/ | ||
| dist/ | ||
| downloads/ | ||
| eggs/ | ||
| .eggs/ | ||
| lib/ | ||
| lib64/ | ||
| parts/ | ||
| sdist/ | ||
| var/ | ||
| wheels/ | ||
| pip-wheel-metadata/ | ||
| share/python-wheels/ | ||
| *.egg-info/ | ||
| .installed.cfg | ||
| *.egg | ||
| MANIFEST | ||
| # PyInstaller | ||
| # Usually these files are written by a python script from a template | ||
| # before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
| *.manifest | ||
| *.spec | ||
| # Installer logs | ||
| pip-log.txt | ||
| pip-delete-this-directory.txt | ||
| # Unit test / coverage reports | ||
| htmlcov/ | ||
| .tox/ | ||
| .nox/ | ||
| .coverage | ||
| .coverage.* | ||
| .cache | ||
| nosetests.xml | ||
| coverage.xml | ||
| *.cover | ||
| *.py,cover | ||
| .hypothesis/ | ||
| .pytest_cache/ | ||
| # Translations | ||
| *.mo | ||
| *.pot | ||
| # Django stuff: | ||
| *.log | ||
| local_settings.py | ||
| db.sqlite3 | ||
| db.sqlite3-journal | ||
| # Flask stuff: | ||
| instance/ | ||
| .webassets-cache | ||
| # Scrapy stuff: | ||
| .scrapy | ||
| # Sphinx documentation | ||
| docs/_build/ | ||
| # PyBuilder | ||
| target/ | ||
| # Jupyter Notebook | ||
| .ipynb_checkpoints | ||
| # IPython | ||
| profile_default/ | ||
| ipython_config.py | ||
| # pyenv | ||
| .python-version | ||
| # pipenv | ||
| # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
| # However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
| # having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
| # install all needed dependencies. | ||
| #Pipfile.lock | ||
| # PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
| __pypackages__/ | ||
| # Celery stuff | ||
| celerybeat-schedule | ||
| celerybeat.pid | ||
| # SageMath parsed files | ||
| *.sage.py | ||
| # Environments | ||
| .env | ||
| .venv | ||
| env/ | ||
| venv/ | ||
| ENV/ | ||
| env.bak/ | ||
| venv.bak/ | ||
| # Spyder project settings | ||
| .spyderproject | ||
| .spyproject | ||
| # Rope project settings | ||
| .ropeproject | ||
| # mkdocs documentation | ||
| /site | ||
| # mypy | ||
| .mypy_cache/ | ||
| .dmypy.json | ||
| dmypy.json | ||
| # Pyre type checker | ||
| .pyre/ | ||
| # Poetry | ||
| poetry.lock |
| Metadata-Version: 2.1 | ||
| Name: fdce | ||
| Version: 0.1.1a4 | ||
| Summary: Finite difference coefficient estimator | ||
| Author: Jorge Morgado Vega | ||
| Author-email: jorge.morgadov@gmail.com | ||
| Requires: numpy | ||
| Requires-Python: >=3.8 | ||
| License-File: LICENSE | ||
| Finite difference coefficients estimator | ||
| ======================================== | ||
| Python implementation of the algorithm presented in: | ||
| Fornberg, B. (1988). Generation of finite difference formulas on arbitrarily | ||
| spaced grids. Mathematics of computation, 51(184), 699-706. | ||
| This algorithm can estimate the coefficients of the finite difference formula | ||
| used to estimate any derivative of an unidimensional function at a point `x_0` | ||
| given a grid of points (mostly neighbors of `x_0`). The accuracy level is | ||
| determined by the number of grid points used in each estimation. | ||
| Highlights | ||
| ---------- | ||
| 1. Grid points do not have to be equally spaced. | ||
| 2. `x_0` does not have to be one of the grid points. | ||
| 3. As a result of 2., the algorithm can also be used to interpolate a function | ||
| at a point `x_0`, by using the coefficients of the derivative of order zero. | ||
| 4. In a single `M` order derivative approximation the coefficients needed to | ||
| estimate the derivative at any order from zero to `M` are calculated. |
| .gitignore | ||
| LICENSE | ||
| README.md | ||
| pyproject.toml | ||
| setup.py | ||
| .github/workflows/build_wheels.yml | ||
| fdce/__init__.py | ||
| fdce/__version__.py | ||
| fdce/get_coeff.py | ||
| fdce.egg-info/PKG-INFO | ||
| fdce.egg-info/SOURCES.txt | ||
| fdce.egg-info/dependency_links.txt | ||
| fdce.egg-info/top_level.txt | ||
| fdce/_extension/__init__.py | ||
| fdce/_extension/_fdce.c |
+21
| # Finite difference coefficients estimator | ||
| Python implementation of the algorithm presented in: | ||
| > [Fornberg, B. (1988). Generation of finite difference formulas on arbitrarily | ||
| spaced grids. Mathematics of computation, 51(184), 699-706.](https://www.ams.org/journals/mcom/1988-51-184/S0025-5718-1988-0935077-0/) | ||
| This algorithm can estimate the coefficients of the finite difference formula | ||
| used to estimate any derivative of an unidimensional function at a point `x_0` | ||
| given a grid of points (mostly neighbors of `x_0`). The accuracy level is | ||
| determined by the number of grid points used in each estimation. | ||
| ### Highlights: | ||
| 1. Grid points do not have to be equally spaced. | ||
| 2. `x_0` does not have to be one of the grid points. | ||
| 3. As a result of 2., the algorithm can also be used to interpolate a function | ||
| at a point `x_0`, by using the coefficients of the derivative of order zero. | ||
| 4. In a single `M` order derivative approximation the coefficients needed to | ||
| estimate the derivative at any order from zero to `M` are calculated. | ||
| [egg_info] | ||
| tag_build = | ||
| tag_date = 0 | ||
+46
| import numpy as np | ||
| from setuptools import Extension, find_packages, setup | ||
| long_description = """ | ||
| Finite difference coefficients estimator | ||
| ======================================== | ||
| Python implementation of the algorithm presented in: | ||
| Fornberg, B. (1988). Generation of finite difference formulas on arbitrarily | ||
| spaced grids. Mathematics of computation, 51(184), 699-706. | ||
| This algorithm can estimate the coefficients of the finite difference formula | ||
| used to estimate any derivative of an unidimensional function at a point `x_0` | ||
| given a grid of points (mostly neighbors of `x_0`). The accuracy level is | ||
| determined by the number of grid points used in each estimation. | ||
| Highlights | ||
| ---------- | ||
| 1. Grid points do not have to be equally spaced. | ||
| 2. `x_0` does not have to be one of the grid points. | ||
| 3. As a result of 2., the algorithm can also be used to interpolate a function | ||
| at a point `x_0`, by using the coefficients of the derivative of order zero. | ||
| 4. In a single `M` order derivative approximation the coefficients needed to | ||
| estimate the derivative at any order from zero to `M` are calculated. | ||
| """ | ||
| setup( | ||
| name="fdce", | ||
| version="0.1.1a4", | ||
| description="Finite difference coefficient estimator", | ||
| long_description=long_description, | ||
| author="Jorge Morgado Vega", | ||
| author_email="jorge.morgadov@gmail.com", | ||
| requires=["numpy"], | ||
| packages=find_packages(), | ||
| python_requires=">=3.8", | ||
| ext_modules=[ | ||
| Extension( | ||
| "fdce._extension._fdce", | ||
| ["fdce/_extension/_fdce.c"], | ||
| include_dirs=[np.get_include()], | ||
| ) | ||
| ] | ||
| ) |
@@ -1,1 +0,1 @@ | ||
| __version__ = "0.1.1a2" | ||
| __version__ = "0.1.1a4" |
| #define PY_SSIZE_T_CLEAN | ||
| #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION | ||
| #include <Python.h> | ||
| #include <arrayobject.h> | ||
| #include <numpy/arrayobject.h> | ||
@@ -6,0 +6,0 @@ double d_1, d_2, c1, c2, c3; |
+29
-10
| Metadata-Version: 2.1 | ||
| Name: fdce | ||
| Version: 0.1.1a2 | ||
| Summary: Finite difference coefficients estimator | ||
| License: MIT | ||
| Version: 0.1.1a4 | ||
| Summary: Finite difference coefficient estimator | ||
| Author: Jorge Morgado Vega | ||
| Author-email: jorge.morgadov@gmail.com | ||
| Requires-Python: >=3.8,<4.0 | ||
| Classifier: License :: OSI Approved :: MIT License | ||
| Classifier: Programming Language :: Python :: 3 | ||
| Classifier: Programming Language :: Python :: 3.10 | ||
| Classifier: Programming Language :: Python :: 3.8 | ||
| Classifier: Programming Language :: Python :: 3.9 | ||
| Requires-Dist: numpy (>=1.16.5) | ||
| Requires: numpy | ||
| Requires-Python: >=3.8 | ||
| License-File: LICENSE | ||
| Finite difference coefficients estimator | ||
| ======================================== | ||
| Python implementation of the algorithm presented in: | ||
| Fornberg, B. (1988). Generation of finite difference formulas on arbitrarily | ||
| spaced grids. Mathematics of computation, 51(184), 699-706. | ||
| This algorithm can estimate the coefficients of the finite difference formula | ||
| used to estimate any derivative of an unidimensional function at a point `x_0` | ||
| given a grid of points (mostly neighbors of `x_0`). The accuracy level is | ||
| determined by the number of grid points used in each estimation. | ||
| Highlights | ||
| ---------- | ||
| 1. Grid points do not have to be equally spaced. | ||
| 2. `x_0` does not have to be one of the grid points. | ||
| 3. As a result of 2., the algorithm can also be used to interpolate a function | ||
| at a point `x_0`, by using the coefficients of the derivative of order zero. | ||
| 4. In a single `M` order derivative approximation the coefficients needed to | ||
| estimate the derivative at any order from zero to `M` are calculated. |
+9
-25
@@ -1,27 +0,11 @@ | ||
| [tool.poetry] | ||
| name = "fdce" | ||
| version = "0.1.1-alpha.2" | ||
| description = "Finite difference coefficients estimator" | ||
| authors = ["Jorge Morgado Vega <jorge.morgadov@gmail.com>"] | ||
| license = "MIT" | ||
| include = [ | ||
| { path = "fdce/_extension/*.so", format = "wheel" }, | ||
| { path = "fdce/_extension/*.pyd", format = "wheel" } | ||
| [build-system] | ||
| requires = [ | ||
| "setuptools", | ||
| "setuptools-scm", | ||
| "oldest-supported-numpy; python_version>='3.5'" | ||
| ] | ||
| build-backend = "setuptools.build_meta" | ||
| [tool.poetry.dependencies] | ||
| python = "^3.8" | ||
| numpy = ">=1.16.5" | ||
| [tool.poetry.dev-dependencies] | ||
| pylint = "^2.14.0" | ||
| black = "^22.3.0" | ||
| isort = "^5.10.1" | ||
| [tool.poetry.build] | ||
| generate-setup-file = false | ||
| script = "build.py" | ||
| [build-system] | ||
| requires = ["poetry-core"] | ||
| build-backend = "poetry.core.masonry.api" | ||
| [tool.cibuildwheel] | ||
| build = "cp38-*" | ||
| skip = "cp38-manylinux_[aps]*" |
-73
| import os | ||
| import shutil | ||
| from distutils.command.build_ext import build_ext | ||
| from distutils.core import Distribution | ||
| from distutils.core import Extension | ||
| from distutils.errors import CCompilerError | ||
| from distutils.errors import DistutilsExecError | ||
| from distutils.errors import DistutilsPlatformError | ||
| # C Extensions | ||
| extensions = [ | ||
| Extension("fdce._extension._fdce", ["fdce/_extension/_fdce.c"]), | ||
| ] | ||
| class ExtBuilder(build_ext): | ||
| """This class allows C extension building to fail.""" | ||
| built_extensions = [] | ||
| def run(self): | ||
| try: | ||
| build_ext.run(self) | ||
| except (DistutilsPlatformError, FileNotFoundError) as exc: | ||
| print( | ||
| f"{exc}\n\nUnable to build the C extensions, " | ||
| "fdce will use the pure python code instead." | ||
| ) | ||
| def build_extension(self, ext): | ||
| try: | ||
| build_ext.build_extension(self, ext) | ||
| except ( | ||
| CCompilerError, | ||
| DistutilsExecError, | ||
| DistutilsPlatformError, | ||
| ValueError, | ||
| ) as exc: | ||
| print( | ||
| f"{exc}\n\nUnable to build the '{ext.name}' C extension, " | ||
| "fdce will use the pure python version of the extension." | ||
| ) | ||
| def build(setup_kwargs): | ||
| """ | ||
| This function is mandatory in order to build the extensions. | ||
| """ | ||
| distribution = Distribution({"name": "fdce", "ext_modules": extensions}) | ||
| distribution.package_dir = "fdce" | ||
| cmd = ExtBuilder(distribution) | ||
| cmd.ensure_finalized() | ||
| cmd.run() | ||
| # Copy built extensions back to the project | ||
| for output in cmd.get_outputs(): | ||
| relative_extension = os.path.relpath(output, cmd.build_lib) | ||
| if not os.path.exists(output): | ||
| continue | ||
| shutil.copyfile(output, relative_extension) | ||
| mode = os.stat(relative_extension).st_mode | ||
| mode |= (mode & 0o444) >> 2 | ||
| os.chmod(relative_extension, mode) | ||
| return setup_kwargs | ||
| if __name__ == "__main__": | ||
| build({}) |
Sorry, the diff of this file is not supported yet
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
17
70%13791
-71.27%96
-15.79%