From 8729ce19a65ba3eba351f5166355cbd941376042 Mon Sep 17 00:00:00 2001 From: TAKEKAWA Takashi Date: Sun, 26 May 2024 09:18:46 +0900 Subject: [PATCH 1/5] Use ruff --- README.md | 14 +++++++------- pyproject.toml | 26 +++++++++++++++++--------- src/logbesselk/jax/__init__.py | 10 +++------- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 8bf2fee..4e37ab2 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ TAKEKAWA Takashi ## For Tensorflow ### Require -- Python (>=3.8) -- Tensorflow (>=2.6) +- Python (>=3.10) +- Tensorflow (>=2.9) ### Installation ```shell @@ -25,15 +25,15 @@ pip install tensorflow logbesselk ```python import tensorflow as tf from logbesselk.tensorflow import log_bessel_k as logk -from logbesselk.jax import bessel_ke as ke -from logbesselk.jax import bessel_kratio as kratio +from logbesselk.tensorflow import bessel_ke as ke +from logbesselk.tensorflow import bessel_kratio as kratio v = 1.0 x = 1.0 a = logk(v, x) -v = jnp.linspace(1, 10, 10) -x = jnp.linspace(1, 10, 10) +v = tf.linspace(1, 10, 10) +x = tf.linspace(1, 10, 10) b = logk(v, x) # gradient @@ -58,7 +58,7 @@ logdkdx = lambda v, x: log_abs_deriv_bessel_k(v, x, 0, 1) ## For jax ### Require -- Python (>=3.8) +- Python (>=3.10) - jax (>=0.3) ### Installation diff --git a/pyproject.toml b/pyproject.toml index 0c62a21..10d1849 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,20 +16,28 @@ python = ">=3.8,<3.13" #tensorflow = ">=2.6,<2.12" #jax = "^0.2+cuda" -[tool.isort] -profile = "black" -multi_line_output = 3 -force_grid_wrap = 1 - -[tool.flake8] -max-line-length = 88 -extend-ignore = ["E203"] - [tool.pytest.ini_options] markers = [ "vec", ] +[tool.ruff] +target-versin = "py310" + +[tool.ruff.format] +quote-style = "single" + +[tool.ruff.lint] +select = ["E4", "E7", "E9", "F", "W", "N", "I"] + +[ttol.ruff.lint.per-file-ignores] +"__init__.py" = ["F401"] + +[tool.ruff.lint.isort] +combine-as-imports = true +force-wrap-aliases = true +split-on-trailing-comma = true + [tool.tox] legacy_tox_ini = """ [tox] diff --git a/src/logbesselk/jax/__init__.py b/src/logbesselk/jax/__init__.py index ab1f0a7..ea56fdd 100644 --- a/src/logbesselk/jax/__init__.py +++ b/src/logbesselk/jax/__init__.py @@ -3,13 +3,9 @@ bessel_kratio, log_bessel_k, ) +from .integral import ( + log_abs_deriv_bessel_k, +) from .misc import ( sign_deriv_bessel_k, ) - -__all__ = [ - "bessel_ke", - "bessel_kratio", - "log_bessel_k", - "sign_deriv_bessel_k", -] From 12a0e4c7e7a0061aac9b152e6d84d5f9f3248aa9 Mon Sep 17 00:00:00 2001 From: TAKEKAWA Takashi Date: Sun, 26 May 2024 10:21:37 +0900 Subject: [PATCH 2/5] Use rye --- .github/workflows/test.yml | 7 +++- .github/workflows/upload.yml | 16 ++++----- README.md | 2 +- pyproject.toml | 65 +++++++++++++++++++++++------------- 4 files changed, 55 insertions(+), 35 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0286c55..cdd0f4e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.10', '3.11', '3.12'] + python-version: ['3.10', '3.12'] steps: - name: Check out repository @@ -23,6 +23,11 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Install rye + run: | + curl -sSf https://rye-up.com/get | RYE_INSTALL_OPTION="--yes" bash + source $HOME/.rye/env + - name: Install tox run: | python -m pip install --upgrade pip diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml index d7a1b56..a9b1e9c 100644 --- a/.github/workflows/upload.yml +++ b/.github/workflows/upload.yml @@ -18,18 +18,16 @@ jobs: with: python-version: '3.10' - - name: Install Poetry - uses: snok/install-poetry@v1 - with: - version: 1.3.2 - virtualenvs-create: true - virtualenvs-in-project: true + - name: Install rye + run: | + curl -sSf https://rye-up.com/get | RYE_INSTALL_OPTION="--yes" bash + source $HOME/.rye/env - name: Install Decendencies - run: poetry install + run: rye sync - name: Build package - run: poetry build + run: rye build - name: Publish package - run: poetry publish -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} + run: rye publish --token ${{ secrets.PYPI_TOKEN }} diff --git a/README.md b/README.md index 4e37ab2..79be415 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ logdkdx = lambda v, x: log_abs_deriv_bessel_k(v, x, 0, 1) ### Require - Python (>=3.10) -- jax (>=0.3) +- jax (>=0.4) ### Installation ```shell diff --git a/pyproject.toml b/pyproject.toml index 10d1849..305fd53 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,20 +1,41 @@ -[tool.poetry] +[project] name = "logbesselk" -version = "3.3.0" +version = "3.3.1" description = "Provide function to calculate the modified Bessel function of the second kind" license = "Apache-2.0" -authors = ["TAKEKAWA Takashi "] +authors = [ + { name = "TAKEKAWA Takashi", email = "takekawa@tk2lab.org" } +] readme = "README.md" repository = "https://github.com/tk2lab/logbesselk" +classifiers = [ + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] + +requires-python = ">=3.8" + +[project.optional-dependences] +tensorflow = [ + "tensorflow>=2.9", +] +jax = [ + "jax>=0.4", + "jaxlib>=0.4", +] [build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.rye] +manaed = true -[tool.poetry.dependencies] -python = ">=3.8,<3.13" -#tensorflow = ">=2.6,<2.12" -#jax = "^0.2+cuda" +[[tool.rye.sources]] +name = "jax" +url = "https://storage.googleapis.com/jax-releases/jax_cuda_releases.html" +type = "find-links" [tool.pytest.ini_options] markers = [ @@ -42,32 +63,30 @@ split-on-trailing-comma = true legacy_tox_ini = """ [tox] min_version = 4.0 -isolated_build = True +rye_discovery = true env_list = - py{310,311,312}-jax{3,4} - py{310,311,312}-tf{29,210,211,212,213,214,215,216} - lint + py{310,311,312}-jax{4,latest} + py{310,311,312}-tf{29,210,211,212,213,214,215,216,latest} eval_tf eval_jax [gh-actions] python = - 3.10: py310-jax3, py310-tf29 - 3.12: py312-jax4, py312-tf216 + 3.10: py312-jax4, py310-tf29 + 3.12: py312-jaxlatest, py312-tflatest -[testenv:py{310,311,312}-jax{3,4}] +[testenv:py{310,311,312}-jax{3,4,latest}] deps = - jax3: jax[cuda] (>=0.3,<0.4) - jax4: jax[cuda] (>=0.4,<0.5) + jaxlatest: jax[cuda12] + jax4: jax[cuda12] (>=0.4,<0.5) pytest pandas -install_command = - pip install --upgrade -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html {opts} {packages} commands = {envpython} -m pytest tests/test_jax.py {posargs} -[testenv:py{310,311,312}-tf{29,210,211,212,213,214,215,216}] +[testenv:py{310,311,312}-tf{29,210,211,212,213,214,215,216,latest}] deps = + tflatest: tensorflow tf29: tensorflow (>=2.9,<2.10) tf210: tensorflow (>=2.10,<2.11) tf211: tensorflow (>=2.11,<2.12) @@ -83,10 +102,8 @@ commands = [testenv:eval_jax] deps = - jax[cuda] + jax[cuda12] pandas -install_command = - pip install --upgrade -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html {opts} {packages} commands = {envpython} eval/eval_jax.py From 32c5f8bfa959b6f8f8680e8e45e1f35f70194a54 Mon Sep 17 00:00:00 2001 From: TAKEKAWA Takashi Date: Sun, 26 May 2024 10:48:37 +0900 Subject: [PATCH 3/5] Use Integrate/Cfraction/Asymptotic on tensorflow --- src/logbesselk/tensorflow/ica.py | 67 ++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/logbesselk/tensorflow/ica.py diff --git a/src/logbesselk/tensorflow/ica.py b/src/logbesselk/tensorflow/ica.py new file mode 100644 index 0000000..a4aa3f6 --- /dev/null +++ b/src/logbesselk/tensorflow/ica.py @@ -0,0 +1,67 @@ +import tensorflow as tf + +from .asymptotic import log_bessel_k as log_k_large_v +from .cfraction import log_bessel_ku as log_ku_small_v +from .integral import log_bessel_k as log_k_small_x +from .math import ( + fround, + is_finite, +) +from .misc import ( + log_bessel_recurrence, +) +from .utils import ( + result_type, +) +from .wrap import ( + wrap_bessel_ke, + wrap_bessel_kratio, + wrap_log_bessel_k, +) + +__all__ = [ + "log_bessel_k", + "bessel_kratio", + "bessel_ke", +] + + +@wrap_log_bessel_k +def log_bessel_k(v, x): + """ + Combination of Series, Continued fraction and Asymptotic expansion. + """ + + def small_x_case(): + return log_k_small_x(v, x) + + def large_v_case(): + v_ = tf.where(large_v, v, tf.constant(0, dtype)) + return log_k_large_v(v_, x) + + def small_v_case(): + n = fround(v) + u = v - n + u_ = tf.where(small_v, u, tf.constant(1 / 2, dtype)) + x_ = tf.where(small_v, x, tf.constant(1, dtype)) + logk0, logk1 = log_ku_small_v(u_, x_) + return log_bessel_recurrence(logk0, logk1, u, n, x)[0] + + dtype = result_type(v, x) + finite = is_finite(v) & is_finite(x) & (x > 0) + large_x_ = x >= 100 + large_v_ = v >= 25 + small_v = finite & large_x_ & large_v_ + large_v = finite & large_x_ & ~large_v_ + out = log_k_small_x(v, x) + out = tf.where(small_v, small_v_case(), out) + out = tf.where(large_v, large_v_case(), out) + return out + + +def bessel_kratio(v, x, d: int = 1): + return wrap_bessel_kratio(log_bessel_k, v, x, d) + + +def bessel_ke(v, x): + return wrap_bessel_ke(log_bessel_k, v, x) From e5786980640b1887ed14a099006a6a9ea443ffe8 Mon Sep 17 00:00:00 2001 From: TAKEKAWA Takashi Date: Sun, 26 May 2024 11:32:23 +0900 Subject: [PATCH 4/5] Tune test env --- README.md | 2 +- poetry.lock | 444 -------------------------- pyproject.toml | 36 ++- requirements-dev.lock | 10 + requirements.lock | 10 + src/logbesselk/tensorflow/__init__.py | 6 +- 6 files changed, 44 insertions(+), 464 deletions(-) delete mode 100644 poetry.lock create mode 100644 requirements-dev.lock create mode 100644 requirements.lock diff --git a/README.md b/README.md index 79be415..d827a1a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ TAKEKAWA Takashi ### Require - Python (>=3.10) -- Tensorflow (>=2.9) +- Tensorflow (>=2.8) ### Installation ```shell diff --git a/poetry.lock b/poetry.lock deleted file mode 100644 index 177847a..0000000 --- a/poetry.lock +++ /dev/null @@ -1,444 +0,0 @@ -[[package]] -name = "attrs" -version = "22.2.0" -description = "Classes Without Boilerplate" -category = "dev" -optional = false -python-versions = ">=3.6" - -[package.extras] -cov = ["attrs[tests]", "coverage-enable-subprocess", "coverage[toml] (>=5.3)"] -dev = ["attrs[docs,tests]"] -docs = ["furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier", "zope.interface"] -tests = ["attrs[tests-no-zope]", "zope.interface"] -tests-no-zope = ["cloudpickle", "cloudpickle", "hypothesis", "hypothesis", "mypy (>=0.971,<0.990)", "mypy (>=0.971,<0.990)", "pympler", "pympler", "pytest (>=4.3.0)", "pytest (>=4.3.0)", "pytest-mypy-plugins", "pytest-mypy-plugins", "pytest-xdist[psutil]", "pytest-xdist[psutil]"] - -[[package]] -name = "black" -version = "22.10.0" -description = "The uncompromising code formatter." -category = "dev" -optional = false -python-versions = ">=3.7" - -[package.dependencies] -click = ">=8.0.0" -mypy-extensions = ">=0.4.3" -pathspec = ">=0.9.0" -platformdirs = ">=2" -tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} -typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} - -[package.extras] -colorama = ["colorama (>=0.4.3)"] -d = ["aiohttp (>=3.7.4)"] -jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"] -uvloop = ["uvloop (>=0.15.2)"] - -[[package]] -name = "click" -version = "8.1.3" -description = "Composable command line interface toolkit" -category = "dev" -optional = false -python-versions = ">=3.7" - -[package.dependencies] -colorama = {version = "*", markers = "platform_system == \"Windows\""} - -[[package]] -name = "colorama" -version = "0.4.6" -description = "Cross-platform colored terminal text." -category = "dev" -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" - -[[package]] -name = "colorlog" -version = "4.8.0" -description = "Log formatting with colors!" -category = "dev" -optional = false -python-versions = "*" - -[package.dependencies] -colorama = {version = "*", markers = "sys_platform == \"win32\""} - -[[package]] -name = "dacite" -version = "1.8.0" -description = "Simple creation of data classes from dictionaries." -category = "dev" -optional = false -python-versions = ">=3.6" - -[package.extras] -dev = ["black", "coveralls", "mypy", "pre-commit", "pylint", "pytest (>=5)", "pytest-benchmark", "pytest-cov"] - -[[package]] -name = "flake8" -version = "4.0.1" -description = "the modular source code checker: pep8 pyflakes and co" -category = "dev" -optional = false -python-versions = ">=3.6" - -[package.dependencies] -mccabe = ">=0.6.0,<0.7.0" -pycodestyle = ">=2.8.0,<2.9.0" -pyflakes = ">=2.4.0,<2.5.0" - -[[package]] -name = "flake8-bugbear" -version = "23.1.20" -description = "A plugin for flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle." -category = "dev" -optional = false -python-versions = ">=3.7" - -[package.dependencies] -attrs = ">=19.2.0" -flake8 = ">=3.0.0" - -[package.extras] -dev = ["coverage", "hypothesis", "hypothesmith (>=0.2)", "pre-commit", "pytest", "tox"] - -[[package]] -name = "gitdb" -version = "4.0.10" -description = "Git Object Database" -category = "dev" -optional = false -python-versions = ">=3.7" - -[package.dependencies] -smmap = ">=3.0.1,<6" - -[[package]] -name = "gitpython" -version = "3.1.30" -description = "GitPython is a python library used to interact with Git repositories" -category = "dev" -optional = false -python-versions = ">=3.7" - -[package.dependencies] -gitdb = ">=4.0.1,<5" - -[[package]] -name = "isort" -version = "5.1.4" -description = "A Python utility / library to sort Python imports." -category = "dev" -optional = false -python-versions = ">=3.6,<4.0" - -[package.extras] -pipfile-deprecated-finder = ["pipreqs", "requirementslib", "tomlkit (>=0.5.3)"] -requirements-deprecated-finder = ["pip-api", "pipreqs"] - -[[package]] -name = "mccabe" -version = "0.6.1" -description = "McCabe checker, plugin for flake8" -category = "dev" -optional = false -python-versions = "*" - -[[package]] -name = "mypy" -version = "0.790" -description = "Optional static typing for Python" -category = "dev" -optional = false -python-versions = ">=3.5" - -[package.dependencies] -mypy-extensions = ">=0.4.3,<0.5.0" -typed-ast = ">=1.4.0,<1.5.0" -typing-extensions = ">=3.7.4" - -[package.extras] -dmypy = ["psutil (>=4.0)"] - -[[package]] -name = "mypy-extensions" -version = "0.4.3" -description = "Experimental type system extensions for programs checked with the mypy typechecker." -category = "dev" -optional = false -python-versions = "*" - -[[package]] -name = "pathspec" -version = "0.11.0" -description = "Utility library for gitignore style pattern matching of file paths." -category = "dev" -optional = false -python-versions = ">=3.7" - -[[package]] -name = "platformdirs" -version = "2.6.2" -description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." -category = "dev" -optional = false -python-versions = ">=3.7" - -[package.extras] -docs = ["furo (>=2022.12.7)", "proselint (>=0.13)", "sphinx (>=5.3)", "sphinx-autodoc-typehints (>=1.19.5)"] -test = ["appdirs (==1.4.4)", "covdefaults (>=2.2.2)", "pytest (>=7.2)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"] - -[[package]] -name = "pycodestyle" -version = "2.8.0" -description = "Python style guide checker" -category = "dev" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" - -[[package]] -name = "pyflakes" -version = "2.4.0" -description = "passive checker of Python programs" -category = "dev" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" - -[[package]] -name = "pysen" -version = "0.10.3" -description = "Python linting made easy. Also a casual yet honorific way to address individuals who have entered an organization prior to you." -category = "dev" -optional = false -python-versions = "*" - -[package.dependencies] -black = {version = ">=19.10b0,<=22.10", optional = true, markers = "extra == \"lint\""} -colorlog = ">=4.0.0,<5.0.0" -dacite = ">=1.1.0,<2.0.0" -flake8 = {version = ">=3.7,<5", optional = true, markers = "extra == \"lint\""} -flake8-bugbear = {version = "*", optional = true, markers = "extra == \"lint\""} -GitPython = ">=3.0.0,<4.0.0" -isort = {version = ">=4.3,<5.2.0", optional = true, markers = "extra == \"lint\""} -mypy = {version = ">=0.770,<0.800", optional = true, markers = "extra == \"lint\""} -tomlkit = ">=0.5.11,<1.0.0" -unidiff = ">=0.6.0,<1.0.0" - -[package.extras] -lint = ["black (>=19.10b0,<=22.10)", "flake8 (>=3.7,<5)", "flake8-bugbear", "isort (>=4.3,<5.2.0)", "mypy (>=0.770,<0.800)"] - -[[package]] -name = "smmap" -version = "5.0.0" -description = "A pure Python implementation of a sliding window memory map manager" -category = "dev" -optional = false -python-versions = ">=3.6" - -[[package]] -name = "tomli" -version = "2.0.1" -description = "A lil' TOML parser" -category = "dev" -optional = false -python-versions = ">=3.7" - -[[package]] -name = "tomlkit" -version = "0.11.6" -description = "Style preserving TOML library" -category = "dev" -optional = false -python-versions = ">=3.6" - -[[package]] -name = "typed-ast" -version = "1.4.3" -description = "a fork of Python 2 and 3 ast modules with type comment support" -category = "dev" -optional = false -python-versions = "*" - -[[package]] -name = "typing-extensions" -version = "4.4.0" -description = "Backported and Experimental Type Hints for Python 3.7+" -category = "dev" -optional = false -python-versions = ">=3.7" - -[[package]] -name = "unidiff" -version = "0.7.4" -description = "Unified diff parsing/metadata extraction library." -category = "dev" -optional = false -python-versions = "*" - -[metadata] -lock-version = "1.1" -python-versions = ">=3.8,<3.12" -content-hash = "7dcbeed22540dff429208b912e4b4755e9cc19864bd6a2e52be2211f636065af" - -[metadata.files] -attrs = [ - {file = "attrs-22.2.0-py3-none-any.whl", hash = "sha256:29e95c7f6778868dbd49170f98f8818f78f3dc5e0e37c0b1f474e3561b240836"}, - {file = "attrs-22.2.0.tar.gz", hash = "sha256:c9227bfc2f01993c03f68db37d1d15c9690188323c067c641f1a35ca58185f99"}, -] -black = [ - {file = "black-22.10.0-1fixedarch-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:5cc42ca67989e9c3cf859e84c2bf014f6633db63d1cbdf8fdb666dcd9e77e3fa"}, - {file = "black-22.10.0-1fixedarch-cp311-cp311-macosx_11_0_x86_64.whl", hash = "sha256:5d8f74030e67087b219b032aa33a919fae8806d49c867846bfacde57f43972ef"}, - {file = "black-22.10.0-1fixedarch-cp37-cp37m-macosx_10_16_x86_64.whl", hash = "sha256:197df8509263b0b8614e1df1756b1dd41be6738eed2ba9e9769f3880c2b9d7b6"}, - {file = "black-22.10.0-1fixedarch-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:2644b5d63633702bc2c5f3754b1b475378fbbfb481f62319388235d0cd104c2d"}, - {file = "black-22.10.0-1fixedarch-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:e41a86c6c650bcecc6633ee3180d80a025db041a8e2398dcc059b3afa8382cd4"}, - {file = "black-22.10.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2039230db3c6c639bd84efe3292ec7b06e9214a2992cd9beb293d639c6402edb"}, - {file = "black-22.10.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14ff67aec0a47c424bc99b71005202045dc09270da44a27848d534600ac64fc7"}, - {file = "black-22.10.0-cp310-cp310-win_amd64.whl", hash = "sha256:819dc789f4498ecc91438a7de64427c73b45035e2e3680c92e18795a839ebb66"}, - {file = "black-22.10.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5b9b29da4f564ba8787c119f37d174f2b69cdfdf9015b7d8c5c16121ddc054ae"}, - {file = "black-22.10.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8b49776299fece66bffaafe357d929ca9451450f5466e997a7285ab0fe28e3b"}, - {file = "black-22.10.0-cp311-cp311-win_amd64.whl", hash = "sha256:21199526696b8f09c3997e2b4db8d0b108d801a348414264d2eb8eb2532e540d"}, - {file = "black-22.10.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1e464456d24e23d11fced2bc8c47ef66d471f845c7b7a42f3bd77bf3d1789650"}, - {file = "black-22.10.0-cp37-cp37m-win_amd64.whl", hash = "sha256:9311e99228ae10023300ecac05be5a296f60d2fd10fff31cf5c1fa4ca4b1988d"}, - {file = "black-22.10.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:fba8a281e570adafb79f7755ac8721b6cf1bbf691186a287e990c7929c7692ff"}, - {file = "black-22.10.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:915ace4ff03fdfff953962fa672d44be269deb2eaf88499a0f8805221bc68c87"}, - {file = "black-22.10.0-cp38-cp38-win_amd64.whl", hash = "sha256:444ebfb4e441254e87bad00c661fe32df9969b2bf224373a448d8aca2132b395"}, - {file = "black-22.10.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:974308c58d057a651d182208a484ce80a26dac0caef2895836a92dd6ebd725e0"}, - {file = "black-22.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:72ef3925f30e12a184889aac03d77d031056860ccae8a1e519f6cbb742736383"}, - {file = "black-22.10.0-cp39-cp39-win_amd64.whl", hash = "sha256:432247333090c8c5366e69627ccb363bc58514ae3e63f7fc75c54b1ea80fa7de"}, - {file = "black-22.10.0-py3-none-any.whl", hash = "sha256:c957b2b4ea88587b46cf49d1dc17681c1e672864fd7af32fc1e9664d572b3458"}, - {file = "black-22.10.0.tar.gz", hash = "sha256:f513588da599943e0cde4e32cc9879e825d58720d6557062d1098c5ad80080e1"}, -] -click = [ - {file = "click-8.1.3-py3-none-any.whl", hash = "sha256:bb4d8133cb15a609f44e8213d9b391b0809795062913b383c62be0ee95b1db48"}, - {file = "click-8.1.3.tar.gz", hash = "sha256:7682dc8afb30297001674575ea00d1814d808d6a36af415a82bd481d37ba7b8e"}, -] -colorama = [ - {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, - {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, -] -colorlog = [ - {file = "colorlog-4.8.0-py2.py3-none-any.whl", hash = "sha256:3dd15cb27e8119a24c1a7b5c93f9f3b455855e0f73993b1c25921b2f646f1dcd"}, - {file = "colorlog-4.8.0.tar.gz", hash = "sha256:59b53160c60902c405cdec28d38356e09d40686659048893e026ecbd589516b1"}, -] -dacite = [ - {file = "dacite-1.8.0-py3-none-any.whl", hash = "sha256:f7b1205cc5d9b62835aac8cbc1e6e37c1da862359a401f1edbe2ae08fbdc6193"}, - {file = "dacite-1.8.0.tar.gz", hash = "sha256:6257a5e505b61a8cafee7ef3ad08cf32ee9b885718f42395d017e0a9b4c6af65"}, -] -flake8 = [ - {file = "flake8-4.0.1-py2.py3-none-any.whl", hash = "sha256:479b1304f72536a55948cb40a32dce8bb0ffe3501e26eaf292c7e60eb5e0428d"}, - {file = "flake8-4.0.1.tar.gz", hash = "sha256:806e034dda44114815e23c16ef92f95c91e4c71100ff52813adf7132a6ad870d"}, -] -flake8-bugbear = [ - {file = "flake8-bugbear-23.1.20.tar.gz", hash = "sha256:55902ab5a48c5ea53d8689ecd146eda548e72f2724192b9c1d68f6d975d13c06"}, - {file = "flake8_bugbear-23.1.20-py3-none-any.whl", hash = "sha256:04a115e5f9c8e87c38bdbbcdf9f58223ffe05469c07c9a7bd8633330bc4d078b"}, -] -gitdb = [ - {file = "gitdb-4.0.10-py3-none-any.whl", hash = "sha256:c286cf298426064079ed96a9e4a9d39e7f3e9bf15ba60701e95f5492f28415c7"}, - {file = "gitdb-4.0.10.tar.gz", hash = "sha256:6eb990b69df4e15bad899ea868dc46572c3f75339735663b81de79b06f17eb9a"}, -] -gitpython = [ - {file = "GitPython-3.1.30-py3-none-any.whl", hash = "sha256:cd455b0000615c60e286208ba540271af9fe531fa6a87cc590a7298785ab2882"}, - {file = "GitPython-3.1.30.tar.gz", hash = "sha256:769c2d83e13f5d938b7688479da374c4e3d49f71549aaf462b646db9602ea6f8"}, -] -isort = [ - {file = "isort-5.1.4-py3-none-any.whl", hash = "sha256:ae3007f72a2e9da36febd3454d8be4b175d6ca17eb765841d5fe3d038aede79d"}, - {file = "isort-5.1.4.tar.gz", hash = "sha256:145072eedc4927cc9c1f9478f2d83b2fc1e6469df4129c02ef4e8c742207a46c"}, -] -mccabe = [ - {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, - {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, -] -mypy = [ - {file = "mypy-0.790-cp35-cp35m-macosx_10_6_x86_64.whl", hash = "sha256:bd03b3cf666bff8d710d633d1c56ab7facbdc204d567715cb3b9f85c6e94f669"}, - {file = "mypy-0.790-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:2170492030f6faa537647d29945786d297e4862765f0b4ac5930ff62e300d802"}, - {file = "mypy-0.790-cp35-cp35m-win_amd64.whl", hash = "sha256:e86bdace26c5fe9cf8cb735e7cedfe7850ad92b327ac5d797c656717d2ca66de"}, - {file = "mypy-0.790-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:e97e9c13d67fbe524be17e4d8025d51a7dca38f90de2e462243ab8ed8a9178d1"}, - {file = "mypy-0.790-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:0d34d6b122597d48a36d6c59e35341f410d4abfa771d96d04ae2c468dd201abc"}, - {file = "mypy-0.790-cp36-cp36m-win_amd64.whl", hash = "sha256:72060bf64f290fb629bd4a67c707a66fd88ca26e413a91384b18db3876e57ed7"}, - {file = "mypy-0.790-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:eea260feb1830a627fb526d22fbb426b750d9f5a47b624e8d5e7e004359b219c"}, - {file = "mypy-0.790-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:c614194e01c85bb2e551c421397e49afb2872c88b5830e3554f0519f9fb1c178"}, - {file = "mypy-0.790-cp37-cp37m-win_amd64.whl", hash = "sha256:0a0d102247c16ce93c97066443d11e2d36e6cc2a32d8ccc1f705268970479324"}, - {file = "mypy-0.790-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:cf4e7bf7f1214826cf7333627cb2547c0db7e3078723227820d0a2490f117a01"}, - {file = "mypy-0.790-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:af4e9ff1834e565f1baa74ccf7ae2564ae38c8df2a85b057af1dbbc958eb6666"}, - {file = "mypy-0.790-cp38-cp38-win_amd64.whl", hash = "sha256:da56dedcd7cd502ccd3c5dddc656cb36113dd793ad466e894574125945653cea"}, - {file = "mypy-0.790-py3-none-any.whl", hash = "sha256:2842d4fbd1b12ab422346376aad03ff5d0805b706102e475e962370f874a5122"}, - {file = "mypy-0.790.tar.gz", hash = "sha256:2b21ba45ad9ef2e2eb88ce4aeadd0112d0f5026418324176fd494a6824b74975"}, -] -mypy-extensions = [ - {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, - {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, -] -pathspec = [ - {file = "pathspec-0.11.0-py3-none-any.whl", hash = "sha256:3a66eb970cbac598f9e5ccb5b2cf58930cd8e3ed86d393d541eaf2d8b1705229"}, - {file = "pathspec-0.11.0.tar.gz", hash = "sha256:64d338d4e0914e91c1792321e6907b5a593f1ab1851de7fc269557a21b30ebbc"}, -] -platformdirs = [ - {file = "platformdirs-2.6.2-py3-none-any.whl", hash = "sha256:83c8f6d04389165de7c9b6f0c682439697887bca0aa2f1c87ef1826be3584490"}, - {file = "platformdirs-2.6.2.tar.gz", hash = "sha256:e1fea1fe471b9ff8332e229df3cb7de4f53eeea4998d3b6bfff542115e998bd2"}, -] -pycodestyle = [ - {file = "pycodestyle-2.8.0-py2.py3-none-any.whl", hash = "sha256:720f8b39dde8b293825e7ff02c475f3077124006db4f440dcbc9a20b76548a20"}, - {file = "pycodestyle-2.8.0.tar.gz", hash = "sha256:eddd5847ef438ea1c7870ca7eb78a9d47ce0cdb4851a5523949f2601d0cbbe7f"}, -] -pyflakes = [ - {file = "pyflakes-2.4.0-py2.py3-none-any.whl", hash = "sha256:3bb3a3f256f4b7968c9c788781e4ff07dce46bdf12339dcda61053375426ee2e"}, - {file = "pyflakes-2.4.0.tar.gz", hash = "sha256:05a85c2872edf37a4ed30b0cce2f6093e1d0581f8c19d7393122da7e25b2b24c"}, -] -pysen = [ - {file = "pysen-0.10.3-py3-none-any.whl", hash = "sha256:08e79588bf0aa1e9233554d84ac277679d4998dede7768bc7ca8cc5fee6fc846"}, - {file = "pysen-0.10.3.tar.gz", hash = "sha256:3023f48789a90fe660bcacc59a2e57d62297a04c50222ac5d72aff254b53e55c"}, -] -smmap = [ - {file = "smmap-5.0.0-py3-none-any.whl", hash = "sha256:2aba19d6a040e78d8b09de5c57e96207b09ed71d8e55ce0959eeee6c8e190d94"}, - {file = "smmap-5.0.0.tar.gz", hash = "sha256:c840e62059cd3be204b0c9c9f74be2c09d5648eddd4580d9314c3ecde0b30936"}, -] -tomli = [ - {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, - {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, -] -tomlkit = [ - {file = "tomlkit-0.11.6-py3-none-any.whl", hash = "sha256:07de26b0d8cfc18f871aec595fda24d95b08fef89d147caa861939f37230bf4b"}, - {file = "tomlkit-0.11.6.tar.gz", hash = "sha256:71b952e5721688937fb02cf9d354dbcf0785066149d2855e44531ebdd2b65d73"}, -] -typed-ast = [ - {file = "typed_ast-1.4.3-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:2068531575a125b87a41802130fa7e29f26c09a2833fea68d9a40cf33902eba6"}, - {file = "typed_ast-1.4.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:c907f561b1e83e93fad565bac5ba9c22d96a54e7ea0267c708bffe863cbe4075"}, - {file = "typed_ast-1.4.3-cp35-cp35m-manylinux2014_aarch64.whl", hash = "sha256:1b3ead4a96c9101bef08f9f7d1217c096f31667617b58de957f690c92378b528"}, - {file = "typed_ast-1.4.3-cp35-cp35m-win32.whl", hash = "sha256:dde816ca9dac1d9c01dd504ea5967821606f02e510438120091b84e852367428"}, - {file = "typed_ast-1.4.3-cp35-cp35m-win_amd64.whl", hash = "sha256:777a26c84bea6cd934422ac2e3b78863a37017618b6e5c08f92ef69853e765d3"}, - {file = "typed_ast-1.4.3-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f8afcf15cc511ada719a88e013cec87c11aff7b91f019295eb4530f96fe5ef2f"}, - {file = "typed_ast-1.4.3-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:52b1eb8c83f178ab787f3a4283f68258525f8d70f778a2f6dd54d3b5e5fb4341"}, - {file = "typed_ast-1.4.3-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:01ae5f73431d21eead5015997ab41afa53aa1fbe252f9da060be5dad2c730ace"}, - {file = "typed_ast-1.4.3-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:c190f0899e9f9f8b6b7863debfb739abcb21a5c054f911ca3596d12b8a4c4c7f"}, - {file = "typed_ast-1.4.3-cp36-cp36m-win32.whl", hash = "sha256:398e44cd480f4d2b7ee8d98385ca104e35c81525dd98c519acff1b79bdaac363"}, - {file = "typed_ast-1.4.3-cp36-cp36m-win_amd64.whl", hash = "sha256:bff6ad71c81b3bba8fa35f0f1921fb24ff4476235a6e94a26ada2e54370e6da7"}, - {file = "typed_ast-1.4.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:0fb71b8c643187d7492c1f8352f2c15b4c4af3f6338f21681d3681b3dc31a266"}, - {file = "typed_ast-1.4.3-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:760ad187b1041a154f0e4d0f6aae3e40fdb51d6de16e5c99aedadd9246450e9e"}, - {file = "typed_ast-1.4.3-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:5feca99c17af94057417d744607b82dd0a664fd5e4ca98061480fd8b14b18d04"}, - {file = "typed_ast-1.4.3-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:95431a26309a21874005845c21118c83991c63ea800dd44843e42a916aec5899"}, - {file = "typed_ast-1.4.3-cp37-cp37m-win32.whl", hash = "sha256:aee0c1256be6c07bd3e1263ff920c325b59849dc95392a05f258bb9b259cf39c"}, - {file = "typed_ast-1.4.3-cp37-cp37m-win_amd64.whl", hash = "sha256:9ad2c92ec681e02baf81fdfa056fe0d818645efa9af1f1cd5fd6f1bd2bdfd805"}, - {file = "typed_ast-1.4.3-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:b36b4f3920103a25e1d5d024d155c504080959582b928e91cb608a65c3a49e1a"}, - {file = "typed_ast-1.4.3-cp38-cp38-manylinux1_i686.whl", hash = "sha256:067a74454df670dcaa4e59349a2e5c81e567d8d65458d480a5b3dfecec08c5ff"}, - {file = "typed_ast-1.4.3-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7538e495704e2ccda9b234b82423a4038f324f3a10c43bc088a1636180f11a41"}, - {file = "typed_ast-1.4.3-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:af3d4a73793725138d6b334d9d247ce7e5f084d96284ed23f22ee626a7b88e39"}, - {file = "typed_ast-1.4.3-cp38-cp38-win32.whl", hash = "sha256:f2362f3cb0f3172c42938946dbc5b7843c2a28aec307c49100c8b38764eb6927"}, - {file = "typed_ast-1.4.3-cp38-cp38-win_amd64.whl", hash = "sha256:dd4a21253f42b8d2b48410cb31fe501d32f8b9fbeb1f55063ad102fe9c425e40"}, - {file = "typed_ast-1.4.3-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:f328adcfebed9f11301eaedfa48e15bdece9b519fb27e6a8c01aa52a17ec31b3"}, - {file = "typed_ast-1.4.3-cp39-cp39-manylinux1_i686.whl", hash = "sha256:2c726c276d09fc5c414693a2de063f521052d9ea7c240ce553316f70656c84d4"}, - {file = "typed_ast-1.4.3-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:cae53c389825d3b46fb37538441f75d6aecc4174f615d048321b716df2757fb0"}, - {file = "typed_ast-1.4.3-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:b9574c6f03f685070d859e75c7f9eeca02d6933273b5e69572e5ff9d5e3931c3"}, - {file = "typed_ast-1.4.3-cp39-cp39-win32.whl", hash = "sha256:209596a4ec71d990d71d5e0d312ac935d86930e6eecff6ccc7007fe54d703808"}, - {file = "typed_ast-1.4.3-cp39-cp39-win_amd64.whl", hash = "sha256:9c6d1a54552b5330bc657b7ef0eae25d00ba7ffe85d9ea8ae6540d2197a3788c"}, - {file = "typed_ast-1.4.3.tar.gz", hash = "sha256:fb1bbeac803adea29cedd70781399c99138358c26d05fcbd23c13016b7f5ec65"}, -] -typing-extensions = [ - {file = "typing_extensions-4.4.0-py3-none-any.whl", hash = "sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e"}, - {file = "typing_extensions-4.4.0.tar.gz", hash = "sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa"}, -] -unidiff = [ - {file = "unidiff-0.7.4-py2.py3-none-any.whl", hash = "sha256:688622add422f84a873498cc4ff9bf50da5ea6c23dea908f19d2190fa39a8e39"}, - {file = "unidiff-0.7.4.tar.gz", hash = "sha256:2bbcbc986e1fb97f04b1d7b864aa6002ab02f4d8a996bf03aa6e5a81447d1fc5"}, -] diff --git a/pyproject.toml b/pyproject.toml index 305fd53..d0faf8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,16 +14,16 @@ classifiers = [ "Programming Language :: Python :: 3.12", ] -requires-python = ">=3.8" +requires-python = ">=3.10" [project.optional-dependences] -tensorflow = [ - "tensorflow>=2.9", -] jax = [ "jax>=0.4", "jaxlib>=0.4", ] +tensorflow = [ + "tensorflow>=2.8", +] [build-system] requires = ["hatchling"] @@ -43,7 +43,7 @@ markers = [ ] [tool.ruff] -target-versin = "py310" +target-version = "py310" [tool.ruff.format] quote-style = "single" @@ -65,17 +65,18 @@ legacy_tox_ini = """ min_version = 4.0 rye_discovery = true env_list = - py{310,311,312}-jax{4,latest} - py{310,311,312}-tf{29,210,211,212,213,214,215,216,latest} + py{310,311,312}-jax{latest,4} + py{310,311}-tf{latest,28,29,210,211,212,213,214,215,216} + py312-tf{latest,216} eval_tf eval_jax [gh-actions] python = - 3.10: py312-jax4, py310-tf29 + 3.10: py310-jax4, py310-tf28 3.12: py312-jaxlatest, py312-tflatest -[testenv:py{310,311,312}-jax{3,4,latest}] +[testenv:py{310,311,312}-jax{4,latest}] deps = jaxlatest: jax[cuda12] jax4: jax[cuda12] (>=0.4,<0.5) @@ -84,17 +85,18 @@ deps = commands = {envpython} -m pytest tests/test_jax.py {posargs} -[testenv:py{310,311,312}-tf{29,210,211,212,213,214,215,216,latest}] +[testenv:py{310,311,312}-tf{latest,28,29,210,211,212,213,214,215,216}] deps = tflatest: tensorflow - tf29: tensorflow (>=2.9,<2.10) - tf210: tensorflow (>=2.10,<2.11) - tf211: tensorflow (>=2.11,<2.12) - tf212: tensorflow (>=2.12,<2.13) - tf213: tensorflow (>=2.13,<2.14) - tf214: tensorflow (>=2.14,<2.15) - tf215: tensorflow (>=2.15,<2.16) tf216: tensorflow (>=2.16,<2.17) + tf215: tensorflow (>=2.15,<2.16) + tf214: tensorflow (>=2.14,<2.15) + tf213: tensorflow (>=2.13,<2.14) + tf212: tensorflow (>=2.12,<2.13) + tf211: tensorflow (>=2.11,<2.12) + tf210: tensorflow (>=2.10,<2.11) + tf29: tensorflow (>=2.9,<2.10) + tf28: tensorflow (>=2.8,<2.9) pytest pandas commands = diff --git a/requirements-dev.lock b/requirements-dev.lock new file mode 100644 index 0000000..8f23096 --- /dev/null +++ b/requirements-dev.lock @@ -0,0 +1,10 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: false +# with-sources: false + +-e file:. diff --git a/requirements.lock b/requirements.lock new file mode 100644 index 0000000..8f23096 --- /dev/null +++ b/requirements.lock @@ -0,0 +1,10 @@ +# generated by rye +# use `rye lock` or `rye sync` to update this lockfile +# +# last locked with the following flags: +# pre: false +# features: [] +# all-features: false +# with-sources: false + +-e file:. diff --git a/src/logbesselk/tensorflow/__init__.py b/src/logbesselk/tensorflow/__init__.py index 7343cd9..f43a932 100644 --- a/src/logbesselk/tensorflow/__init__.py +++ b/src/logbesselk/tensorflow/__init__.py @@ -1,9 +1,11 @@ -from .integral import ( +from .ica import ( bessel_ke, bessel_kratio, - log_abs_deriv_bessel_k, log_bessel_k, ) +from .integral import ( + log_abs_deriv_bessel_k, +) from .misc import ( sign_deriv_bessel_k, ) From f4a980f0cff4a640dc695a6dd4efd1a71e80d367 Mon Sep 17 00:00:00 2001 From: TAKEKAWA Takashi Date: Mon, 27 May 2024 20:59:23 +0900 Subject: [PATCH 5/5] Update test.yml fix url for rye --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cdd0f4e..7b12330 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: - name: Install rye run: | - curl -sSf https://rye-up.com/get | RYE_INSTALL_OPTION="--yes" bash + curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash source $HOME/.rye/env - name: Install tox