From c544bd5efdf32ab948aff493924ac473318bd801 Mon Sep 17 00:00:00 2001 From: Laurent Sorber Date: Tue, 8 Oct 2024 20:15:38 +0000 Subject: [PATCH 1/2] chore: cruft update --- .cruft.json | 12 +++++----- .devcontainer/devcontainer.json | 3 ++- LICENSE | 2 +- README.md | 8 +++---- notebooks/README.ipynb | 2 +- poetry.lock | 41 +++++++++++++++++---------------- pyproject.toml | 8 +++---- 7 files changed, 39 insertions(+), 37 deletions(-) diff --git a/.cruft.json b/.cruft.json index bf301de..cc6d13c 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,15 +1,15 @@ { - "template": "https://github.com/radix-ai/poetry-cookiecutter", - "commit": "08c7fcd740fc0807e7de1810950c40fc4ac93013", + "template": "https://github.com/superlinear-ai/poetry-cookiecutter", + "commit": "4ee45cc9ba5a0ef51d48b8c637ae066305dc6a06", "checkout": null, "context": { "cookiecutter": { "project_type": "package", "project_name": "Conformal Tights", "project_description": "A Python package that adds conformal prediction of coherent quantiles and intervals to any scikit-learn regressor or Darts forecaster.", - "project_url": "https://github.com/radix-ai/conformal-tights", + "project_url": "https://github.com/superlinear-ai/conformal-tights", "author_name": "Laurent Sorber", - "author_email": "laurent@radix.ai", + "author_email": "laurent@superlinear.ai", "python_version": "3.10", "development_environment": "strict", "with_conventional_commits": "1", @@ -22,8 +22,8 @@ "__docstring_style": "NumPy", "__project_name_kebab_case": "conformal-tights", "__project_name_snake_case": "conformal_tights", - "_template": "https://github.com/radix-ai/poetry-cookiecutter" + "_template": "https://github.com/superlinear-ai/poetry-cookiecutter" } }, "directory": null -} +} \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 49a2f25..c35b0f6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -40,6 +40,7 @@ "files.autoSave": "onFocusChange", "jupyter.kernels.excludePythonEnvironments": ["/usr/local/bin/python"], "mypy-type-checker.importStrategy": "fromEnvironment", + "mypy-type-checker.preferDaemon": true, "notebook.codeActionsOnSave": { "notebook.source.fixAll": "explicit", "notebook.source.organizeImports": "explicit" @@ -49,7 +50,7 @@ "python.terminal.activateEnvironment": false, "python.testing.pytestEnabled": true, "ruff.importStrategy": "fromEnvironment", - "ruff.logLevel": "warn", + "ruff.logLevel": "warning", "terminal.integrated.defaultProfile.linux": "zsh", "terminal.integrated.profiles.linux": { "zsh": { diff --git a/LICENSE b/LICENSE index 3f159f3..c8d7929 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Radix +Copyright (c) 2024 Superlinear Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index f9654f5..16e9d02 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/radix-ai/conformal-tights) [![Open in GitHub Codespaces](https://img.shields.io/static/v1?label=GitHub%20Codespaces&message=Open&color=blue&logo=github)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=765698489&skip_quickstart=true) +[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/superlinear-ai/conformal-tights) [![Open in GitHub Codespaces](https://img.shields.io/static/v1?label=GitHub%20Codespaces&message=Open&color=blue&logo=github)](https://github.com/codespaces/new/superlinear-ai/conformal-tights) # 👖 Conformal Tights @@ -72,7 +72,7 @@ When the input data is a pandas DataFrame, the output is also a pandas DataFrame Let's visualize the predicted quantiles on the test set: - +
Expand to see the code that generated the graph above @@ -225,7 +225,7 @@ Printing the head of the forecast quantiles time series `forecast.quantiles_df(q Let's visualize the forecast and its prediction interval on the test set: - +
Expand to see the code that generated the graph above @@ -306,7 +306,7 @@ plt.tight_layout() The following development environments are supported: 1. ⭐️ *GitHub Codespaces*: click on *Code* and select *Create codespace* to start a Dev Container with [GitHub Codespaces](https://github.com/features/codespaces). -1. ⭐️ *Dev Container (with container volume)*: click on [Open in Dev Containers](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/radix-ai/conformal-tights) to clone this repository in a container volume and create a Dev Container with VS Code. +1. ⭐️ *Dev Container (with container volume)*: click on [Open in Dev Containers](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/superlinear-ai/conformal-tights) to clone this repository in a container volume and create a Dev Container with VS Code. 1. *Dev Container*: clone this repository, open it with VS Code, and run Ctrl/⌘ + + P → *Dev Containers: Reopen in Container*. 1. *PyCharm*: clone this repository, open it with PyCharm, and [configure Docker Compose as a remote interpreter](https://www.jetbrains.com/help/pycharm/using-docker-compose-as-a-remote-interpreter.html#docker-compose-remote) with the `dev` service. 1. *Terminal*: clone this repository, open it with your terminal, and run `docker compose up --detach dev` to start a Dev Container in the background, and then run `docker compose exec dev zsh` to open a shell prompt in the Dev Container. diff --git a/notebooks/README.ipynb b/notebooks/README.ipynb index 0615f50..775405c 100644 --- a/notebooks/README.ipynb +++ b/notebooks/README.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/radix-ai/conformal-tights) [![Open in GitHub Codespaces](https://img.shields.io/static/v1?label=GitHub%20Codespaces&message=Open&color=blue&logo=github)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=765698489&skip_quickstart=true)\n", + "[![Open in Dev Containers](https://img.shields.io/static/v1?label=Dev%20Containers&message=Open&color=blue&logo=visualstudiocode)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/radix-ai/conformal-tights) [![Open in GitHub Codespaces](https://img.shields.io/static/v1?label=GitHub%20Codespaces&message=Open&color=blue&logo=github)](https://github.com/codespaces/new/radix-ai/conformal-tights)\n", "\n", "# 👖 Conformal Tights\n", "\n", diff --git a/poetry.lock b/poetry.lock index b6b7502..ea6ba5f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "adagio" @@ -3255,28 +3255,29 @@ files = [ [[package]] name = "ruff" -version = "0.4.8" +version = "0.6.9" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.4.8-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:7663a6d78f6adb0eab270fa9cf1ff2d28618ca3a652b60f2a234d92b9ec89066"}, - {file = "ruff-0.4.8-py3-none-macosx_11_0_arm64.whl", hash = "sha256:eeceb78da8afb6de0ddada93112869852d04f1cd0f6b80fe464fd4e35c330913"}, - {file = "ruff-0.4.8-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:aad360893e92486662ef3be0a339c5ca3c1b109e0134fcd37d534d4be9fb8de3"}, - {file = "ruff-0.4.8-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:284c2e3f3396fb05f5f803c9fffb53ebbe09a3ebe7dda2929ed8d73ded736deb"}, - {file = "ruff-0.4.8-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a7354f921e3fbe04d2a62d46707e569f9315e1a613307f7311a935743c51a764"}, - {file = "ruff-0.4.8-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:72584676164e15a68a15778fd1b17c28a519e7a0622161eb2debdcdabdc71883"}, - {file = "ruff-0.4.8-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9678d5c9b43315f323af2233a04d747409d1e3aa6789620083a82d1066a35199"}, - {file = "ruff-0.4.8-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704977a658131651a22b5ebeb28b717ef42ac6ee3b11e91dc87b633b5d83142b"}, - {file = "ruff-0.4.8-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d05f8d6f0c3cce5026cecd83b7a143dcad503045857bc49662f736437380ad45"}, - {file = "ruff-0.4.8-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:6ea874950daca5697309d976c9afba830d3bf0ed66887481d6bca1673fc5b66a"}, - {file = "ruff-0.4.8-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:fc95aac2943ddf360376be9aa3107c8cf9640083940a8c5bd824be692d2216dc"}, - {file = "ruff-0.4.8-py3-none-musllinux_1_2_i686.whl", hash = "sha256:384154a1c3f4bf537bac69f33720957ee49ac8d484bfc91720cc94172026ceed"}, - {file = "ruff-0.4.8-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e9d5ce97cacc99878aa0d084c626a15cd21e6b3d53fd6f9112b7fc485918e1fa"}, - {file = "ruff-0.4.8-py3-none-win32.whl", hash = "sha256:6d795d7639212c2dfd01991259460101c22aabf420d9b943f153ab9d9706e6a9"}, - {file = "ruff-0.4.8-py3-none-win_amd64.whl", hash = "sha256:e14a3a095d07560a9d6769a72f781d73259655919d9b396c650fc98a8157555d"}, - {file = "ruff-0.4.8-py3-none-win_arm64.whl", hash = "sha256:14019a06dbe29b608f6b7cbcec300e3170a8d86efaddb7b23405cb7f7dcaf780"}, - {file = "ruff-0.4.8.tar.gz", hash = "sha256:16d717b1d57b2e2fd68bd0bf80fb43931b79d05a7131aa477d66fc40fbd86268"}, + {file = "ruff-0.6.9-py3-none-linux_armv6l.whl", hash = "sha256:064df58d84ccc0ac0fcd63bc3090b251d90e2a372558c0f057c3f75ed73e1ccd"}, + {file = "ruff-0.6.9-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:140d4b5c9f5fc7a7b074908a78ab8d384dd7f6510402267bc76c37195c02a7ec"}, + {file = "ruff-0.6.9-py3-none-macosx_11_0_arm64.whl", hash = "sha256:53fd8ca5e82bdee8da7f506d7b03a261f24cd43d090ea9db9a1dc59d9313914c"}, + {file = "ruff-0.6.9-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:645d7d8761f915e48a00d4ecc3686969761df69fb561dd914a773c1a8266e14e"}, + {file = "ruff-0.6.9-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eae02b700763e3847595b9d2891488989cac00214da7f845f4bcf2989007d577"}, + {file = "ruff-0.6.9-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7d5ccc9e58112441de8ad4b29dcb7a86dc25c5f770e3c06a9d57e0e5eba48829"}, + {file = "ruff-0.6.9-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:417b81aa1c9b60b2f8edc463c58363075412866ae4e2b9ab0f690dc1e87ac1b5"}, + {file = "ruff-0.6.9-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c866b631f5fbce896a74a6e4383407ba7507b815ccc52bcedabb6810fdb3ef7"}, + {file = "ruff-0.6.9-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7b118afbb3202f5911486ad52da86d1d52305b59e7ef2031cea3425142b97d6f"}, + {file = "ruff-0.6.9-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a67267654edc23c97335586774790cde402fb6bbdb3c2314f1fc087dee320bfa"}, + {file = "ruff-0.6.9-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:3ef0cc774b00fec123f635ce5c547dac263f6ee9fb9cc83437c5904183b55ceb"}, + {file = "ruff-0.6.9-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:12edd2af0c60fa61ff31cefb90aef4288ac4d372b4962c2864aeea3a1a2460c0"}, + {file = "ruff-0.6.9-py3-none-musllinux_1_2_i686.whl", hash = "sha256:55bb01caeaf3a60b2b2bba07308a02fca6ab56233302406ed5245180a05c5625"}, + {file = "ruff-0.6.9-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:925d26471fa24b0ce5a6cdfab1bb526fb4159952385f386bdcc643813d472039"}, + {file = "ruff-0.6.9-py3-none-win32.whl", hash = "sha256:eb61ec9bdb2506cffd492e05ac40e5bc6284873aceb605503d8494180d6fc84d"}, + {file = "ruff-0.6.9-py3-none-win_amd64.whl", hash = "sha256:785d31851c1ae91f45b3d8fe23b8ae4b5170089021fbb42402d811135f0b7117"}, + {file = "ruff-0.6.9-py3-none-win_arm64.whl", hash = "sha256:a9641e31476d601f83cd602608739a0840e348bda93fec9f1ee816f8b6798b93"}, + {file = "ruff-0.6.9.tar.gz", hash = "sha256:b076ef717a8e5bc819514ee1d602bbdca5b4420ae13a9cf61a0c0a4f53a2baa2"}, ] [[package]] @@ -4103,4 +4104,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools", [metadata] lock-version = "2.0" python-versions = ">=3.10,<4.0" -content-hash = "6ce6fa286783f5870203d73f11523bacdf9cc1cfa98b6f0872db9dac20c0575e" +content-hash = "834824e595913ed67fbf28de9a73a866676161d7f03e807771ada2688ede3e74" diff --git a/pyproject.toml b/pyproject.toml index 9a7af6e..08fcf16 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,9 +6,9 @@ build-backend = "poetry.core.masonry.api" name = "conformal-tights" version = "0.4.0" description = "A Python package that adds conformal prediction of coherent quantiles and intervals to any scikit-learn regressor or Darts forecaster." -authors = ["Laurent Sorber "] +authors = ["Laurent Sorber "] readme = "README.md" -repository = "https://github.com/radix-ai/conformal-tights" +repository = "https://github.com/superlinear-ai/conformal-tights" [tool.commitizen] # https://commitizen-tools.github.io/commitizen/config/ bump_message = "bump(release): v$current_version → v$new_version" @@ -35,7 +35,7 @@ pre-commit = ">=3.7.0" pytest = ">=8.1.1" pytest-mock = ">=3.14.0" pytest-xdist = ">=3.5.0" -ruff = ">=0.3.5" +ruff = ">=0.5.7" safety = ">=3.1.0" shellcheck-py = ">=0.10.0.1" typeguard = ">=4.2.1" @@ -43,6 +43,7 @@ typeguard = ">=4.2.1" [tool.poetry.group.dev.dependencies] # https://python-poetry.org/docs/master/managing-dependencies/ cruft = ">=2.15.0" ipykernel = ">=6.29.4" +ipython = ">=8.18.0" ipywidgets = ">=8.1.2" matplotlib = ">=3.8.3" nbconvert = ">=7.16.3" @@ -89,7 +90,6 @@ src = ["src", "tests"] target-version = "py310" [tool.ruff.lint] -ignore-init-module-imports = true select = ["A", "ASYNC", "B", "BLE", "C4", "C90", "D", "DTZ", "E", "EM", "ERA", "F", "FBT", "FLY", "FURB", "G", "I", "ICN", "INP", "INT", "ISC", "LOG", "N", "NPY", "PERF", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "Q", "RET", "RSE", "RUF", "S", "SIM", "SLF", "SLOT", "T10", "T20", "TCH", "TID", "TRY", "UP", "W", "YTT"] ignore = ["D203", "D213", "E501", "N803", "N806", "RET504", "RUF002", "RUF003", "S101", "S307"] unfixable = ["ERA001", "F401", "F841", "T201", "T203"] From 09ffae5aa4b39728ad450da0600a4b355537b602 Mon Sep 17 00:00:00 2001 From: Laurent Sorber Date: Tue, 8 Oct 2024 20:20:41 +0000 Subject: [PATCH 2/2] fix: ignore PLC2401 --- pyproject.toml | 2 +- src/conformal_tights/_conformal_coherent_quantile_regressor.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 08fcf16..a927d02 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,7 +91,7 @@ target-version = "py310" [tool.ruff.lint] select = ["A", "ASYNC", "B", "BLE", "C4", "C90", "D", "DTZ", "E", "EM", "ERA", "F", "FBT", "FLY", "FURB", "G", "I", "ICN", "INP", "INT", "ISC", "LOG", "N", "NPY", "PERF", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "Q", "RET", "RSE", "RUF", "S", "SIM", "SLF", "SLOT", "T10", "T20", "TCH", "TID", "TRY", "UP", "W", "YTT"] -ignore = ["D203", "D213", "E501", "N803", "N806", "RET504", "RUF002", "RUF003", "S101", "S307"] +ignore = ["D203", "D213", "E501", "N803", "N806", "PLC2401", "RET504", "RUF002", "RUF003", "S101", "S307"] unfixable = ["ERA001", "F401", "F841", "T201", "T203"] [tool.ruff.lint.flake8-tidy-imports] diff --git a/src/conformal_tights/_conformal_coherent_quantile_regressor.py b/src/conformal_tights/_conformal_coherent_quantile_regressor.py index 8eccb52..52658e8 100644 --- a/src/conformal_tights/_conformal_coherent_quantile_regressor.py +++ b/src/conformal_tights/_conformal_coherent_quantile_regressor.py @@ -53,7 +53,7 @@ class ConformalCoherentQuantileRegressor(MetaEstimatorMixin, RegressorMixin, Bas quantiles to predict, and to select the quantile predictions with the lowest dispersion. """ - def __init__( # noqa: PLR0913 + def __init__( self, estimator: BaseEstimator | Literal["auto"] = "auto", *,