From 4fb8a52f05294c0cca573f6557e26b0e8a4ffd29 Mon Sep 17 00:00:00 2001 From: Niru Nahesh Date: Sun, 18 May 2025 12:11:55 -0700 Subject: [PATCH 01/10] Adds pyrefly ignore warnings. --- pyproject.toml | 5 +++++ src/jetplot/chart_utils.py | 3 +++ src/jetplot/colors.py | 3 +++ src/jetplot/images.py | 3 +++ src/jetplot/plots.py | 1 + src/jetplot/signals.py | 4 ++++ src/jetplot/style.py | 2 ++ src/jetplot/timepiece.py | 4 ++++ src/jetplot/typing.py | 1 + tests/test_demo.py | 1 + tests/test_signals.py | 5 +++++ tests/test_timepiece.py | 4 ++++ 12 files changed, 36 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 24e62e9..12fdaf6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,6 +31,11 @@ dev = [ "ruff>=0.11.10", ] +[tool.pyrefly] +search_path = [ + "src/jetplot" +] + [tool.ruff] lint.extend-ignore = ["E111", "E114", "E501", "F403"] diff --git a/src/jetplot/chart_utils.py b/src/jetplot/chart_utils.py index 6065179..5441254 100644 --- a/src/jetplot/chart_utils.py +++ b/src/jetplot/chart_utils.py @@ -129,6 +129,7 @@ def get_bounds(axis, ax=None): return ax.spines[spine_key].get_bounds() else: lower, upper = None, None + for tick, label in zip(ticks(), labels()): if label.get_text() != "": if lower is None: @@ -188,6 +189,7 @@ def yclamp(y0=None, y1=None, dt=None, **kwargs): lims = ax.get_ylim() y0 = lims[0] if y0 is None else y0 y1 = lims[1] if y1 is None else y1 + dt = np.mean(np.diff(ax.get_yticks())) if dt is None else dt new_ticks = np.arange(dt * np.floor(y0 / dt), dt * (np.ceil(y1 / dt) + 1), dt) @@ -205,6 +207,7 @@ def xclamp(x0=None, x1=None, dt=None, **kwargs): lims = ax.get_xlim() x0 = lims[0] if x0 is None else x0 x1 = lims[1] if x1 is None else x1 + dt = np.mean(np.diff(ax.get_xticks())) if dt is None else dt new_ticks = np.arange(dt * np.floor(x0 / dt), dt * (np.ceil(x1 / dt) + 1), dt) diff --git a/src/jetplot/colors.py b/src/jetplot/colors.py index d60cfe2..62fa668 100644 --- a/src/jetplot/colors.py +++ b/src/jetplot/colors.py @@ -37,13 +37,16 @@ def cubehelix( lambda_ = np.linspace(vmin, vmax, n) x = lambda_**gamma phi = 2 * np.pi * (start / 3 + rot * lambda_) + alpha = 0.5 * hue * x * (1.0 - x) A = np.array([[-0.14861, 1.78277], [-0.29227, -0.90649], [1.97294, 0.0]]) b = np.stack([np.cos(phi), np.sin(phi)]) + return Palette((x + alpha * (A @ b)).T) def cmap_colors(cmap: str, n: int, vmin: float = 0.0, vmax: float = 1.0): + # pyrefly: ignore # missing-attribute return Palette(cm.__getattribute__(cmap)(np.linspace(vmin, vmax, n))) diff --git a/src/jetplot/images.py b/src/jetplot/images.py index 90d06f7..4d6f9e2 100644 --- a/src/jetplot/images.py +++ b/src/jetplot/images.py @@ -84,6 +84,7 @@ def fsurface(func, xrng=None, yrng=None, n=100, nargs=2, **kwargs): yrng = xrng if yrng is None else yrng xs = np.linspace(*xrng, n) + ys = np.linspace(*yrng, n) xm, ym = np.meshgrid(xs, ys) @@ -126,6 +127,7 @@ def cmat( cb = imv(arr, ax=ax, vmin=vmin, vmax=vmax, cmap=cmap, cbar=cbar) xs, ys = np.meshgrid(np.arange(num_cols), np.arange(num_rows)) + for x, y, value in zip(xs.flat, ys.flat, arr.flat): color = dark_color if (value <= theta) else light_color annot = f"{{:{fmt}}}".format(value) @@ -138,6 +140,7 @@ def cmat( ax.set_yticklabels(labels, fontsize=label_fontsize) ax.xaxis.set_minor_locator(FixedLocator(np.arange(num_cols) - 0.5)) + ax.yaxis.set_minor_locator(FixedLocator(np.arange(num_rows) - 0.5)) ax.grid( diff --git a/src/jetplot/plots.py b/src/jetplot/plots.py index 1061e66..1b7a985 100644 --- a/src/jetplot/plots.py +++ b/src/jetplot/plots.py @@ -120,6 +120,7 @@ def hist2d(x, y, bins=None, range=None, cmap="hot", **kwargs): bins = 25 # compute the histogram + cnt, xe, ye = np.histogram2d(x, y, bins=bins, normed=True, range=range) # generate the plot diff --git a/src/jetplot/signals.py b/src/jetplot/signals.py index bcec339..d80b71a 100644 --- a/src/jetplot/signals.py +++ b/src/jetplot/signals.py @@ -1,9 +1,12 @@ """Tools for signal processing.""" +# pyrefly: ignore # missing-module-attribute from typing import Callable import numpy as np from numpy.typing import ArrayLike + +# pyrefly: ignore # missing-module-attribute from scipy.ndimage import gaussian_filter1d __all__ = ["smooth", "canoncorr", "participation_ratio", "stable_rank", "normalize"] @@ -58,6 +61,7 @@ def canoncorr(X: ArrayLike, Y: ArrayLike) -> ArrayLike: between linear subspaces." Mathematics of computation 27.123 (1973): 579-594. """ # Orthogonalize each subspace + qu, qv = np.linalg.qr(X)[0], np.linalg.qr(Y)[0] # singular values of the inner product between the orthogonalized spaces diff --git a/src/jetplot/style.py b/src/jetplot/style.py index 3f86412..91b0744 100644 --- a/src/jetplot/style.py +++ b/src/jetplot/style.py @@ -1,6 +1,8 @@ """Opinionated matplotlib style defaults.""" from functools import partial + +# pyrefly: ignore # missing-module-attribute from typing import Mapping, Any from cycler import cycler diff --git a/src/jetplot/timepiece.py b/src/jetplot/timepiece.py index eb73bff..e64ad5d 100644 --- a/src/jetplot/timepiece.py +++ b/src/jetplot/timepiece.py @@ -110,9 +110,13 @@ def wrapper(*args, **kwargs): calls.append(tstop - tstart) return results + # pyrefly: ignore # missing-attribute wrapper.calls = calls + # pyrefly: ignore # missing-attribute wrapper.mean = lambda: np.mean(calls) + # pyrefly: ignore # missing-attribute wrapper.serr = lambda: np.std(calls) / np.sqrt(len(calls)) + # pyrefly: ignore # missing-attribute wrapper.summary = lambda: print( "Runtimes: {} {} {}".format( hrtime(wrapper.mean()), "\u00b1", hrtime(wrapper.serr()) diff --git a/src/jetplot/typing.py b/src/jetplot/typing.py index 51e0884..b6b6b29 100644 --- a/src/jetplot/typing.py +++ b/src/jetplot/typing.py @@ -1,3 +1,4 @@ +# pyrefly: ignore # missing-module-attribute from typing import Sequence, Union __all__ = ["Color", "Palette"] diff --git a/tests/test_demo.py b/tests/test_demo.py index dd38ac1..2e8e804 100644 --- a/tests/test_demo.py +++ b/tests/test_demo.py @@ -8,4 +8,5 @@ def test_peaks(): n = 256 xm, ym, zm = demo.peaks(n=n) + # pyrefly: ignore # missing-attribute assert xm.shape == ym.shape == zm.shape == (n, n) diff --git a/tests/test_signals.py b/tests/test_signals.py index 2ecbc96..ffedf17 100644 --- a/tests/test_signals.py +++ b/tests/test_signals.py @@ -6,6 +6,7 @@ def test_stable_rank(): U, _ = np.linalg.qr(np.random.randn(32, 32)) + V, _ = np.linalg.qr(np.random.randn(32, 32)) S = np.random.randn(32) @@ -21,6 +22,7 @@ def test_stable_rank(): def test_participation_ratio(): def _random_matrix(evals): dim = evals.size + Q, _ = np.linalg.qr(np.random.randn(dim, dim)) return Q @ np.diag(evals) @ Q.T @@ -57,6 +59,7 @@ def test_cca(): X = rs.randn(n, k) Y = rs.randn(n, k) + Z = X @ np.linalg.qr(rs.randn(k, k))[0] # Correlation with itself should be all ones. @@ -65,7 +68,9 @@ def test_cca(): # Correlation with a different random subspace. xy = signals.canoncorr(X, Y) + assert np.all(xy <= 1.0) + assert np.all(0.0 <= xy) assert 0 < np.sum(xy) < k diff --git a/tests/test_timepiece.py b/tests/test_timepiece.py index ac09316..e96f1d1 100644 --- a/tests/test_timepiece.py +++ b/tests/test_timepiece.py @@ -37,8 +37,12 @@ def test_profile(): for _ in range(K): wrapper(T) + # pyrefly: ignore # missing-attribute assert isinstance(wrapper.calls, list) assert len(wrapper.calls) == K + # pyrefly: ignore # missing-attribute assert np.allclose(wrapper.mean(), T, atol=0.01) + # pyrefly: ignore # missing-attribute assert np.allclose(wrapper.serr(), 0.0, atol=0.01) + # pyrefly: ignore # missing-attribute assert wrapper.summary() is None From da56154af950d4abc099ed686b9b7478ee4f5103 Mon Sep 17 00:00:00 2001 From: Niru Nahesh Date: Sun, 18 May 2025 12:13:50 -0700 Subject: [PATCH 02/10] Adds typecheck workflow --- .github/workflows/{ci.yaml => ci.yml} | 2 +- .github/workflows/typecheck.yml | 35 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) rename .github/workflows/{ci.yaml => ci.yml} (98%) create mode 100644 .github/workflows/typecheck.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yml similarity index 98% rename from .github/workflows/ci.yaml rename to .github/workflows/ci.yml index b152ae8..c1542ba 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: Tests on: push: diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml new file mode 100644 index 0000000..7a9c941 --- /dev/null +++ b/.github/workflows/typecheck.yml @@ -0,0 +1,35 @@ +name: Tests + +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - name: Check out the code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + + - name: Install project with dev dependencies + run: | + uv pip install --system .[dev] + + - name: Run Pyrefly Type Checker + run: pyrefly check From 9e7cd69fa69f87b3484ea070f664d768a6c5f5f9 Mon Sep 17 00:00:00 2001 From: Niru Nahesh Date: Sun, 18 May 2025 12:11:55 -0700 Subject: [PATCH 03/10] Fixes typo --- .github/workflows/typecheck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index 7a9c941..63fe3bd 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -1,4 +1,4 @@ -name: Tests +name: Typecheck on: push: From 957e0364d6c8f133d026e5d06de4c258b435e399 Mon Sep 17 00:00:00 2001 From: Niru Nahesh Date: Sun, 18 May 2025 12:18:47 -0700 Subject: [PATCH 04/10] Updates pyproject.toml --- pyproject.toml | 16 +--- requirements.txt | 4 - uv.lock | 234 +---------------------------------------------- 3 files changed, 9 insertions(+), 245 deletions(-) delete mode 100644 requirements.txt diff --git a/pyproject.toml b/pyproject.toml index 12fdaf6..23afe31 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,12 +24,16 @@ Homepage = "https://github.com/nirum/jetplot" [project.optional-dependencies] dev = [ - "pre-commit>=2.21.0", "pyrefly>=0.14.0", "pytest>=7.4.4", "pytest-cov>=4.1.0", "ruff>=0.11.10", ] +docs = [ + "mkdocs>=1.5.3", + "mkdocs-material>=9.2.7", + "mkdocstrings[python]>=0.22.0", +] [tool.pyrefly] search_path = [ @@ -44,13 +48,3 @@ package-dir = {"" = "src"} [tool.setuptools.dynamic] version = {attr = "jetplot.__version__"} - -[tool.uv] -default-groups = ["dev", "docs"] - -[dependency-groups] -docs = [ - "mkdocs>=1.5.3", - "mkdocs-material>=9.2.7", - "mkdocstrings[python]>=0.22.0", -] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 703cea5..0000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -numpy -scipy -matplotlib -scikit-learn diff --git a/uv.lock b/uv.lock index c460aab..3d58bf8 100644 --- a/uv.lock +++ b/uv.lock @@ -104,32 +104,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/4a/7e/3db2bd1b1f9e95f7cddca6d6e75e2f2bd9f51b1246e546d88addca0106bd/certifi-2025.4.26-py3-none-any.whl", hash = "sha256:30350364dfe371162649852c63336a15c70c6510c2ad5015b21c2345311805f3", size = 159618 }, ] -[[package]] -name = "cfgv" -version = "3.3.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.8'", -] -sdist = { url = "https://files.pythonhosted.org/packages/c4/bf/d0d622b660d414a47dc7f0d303791a627663f554345b21250e39e7acb48b/cfgv-3.3.1.tar.gz", hash = "sha256:f5a830efb9ce7a445376bb66ec94c638a9787422f96264c98edc6bdeed8ab736", size = 7864 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/6d/82/0a0ebd35bae9981dea55c06f8e6aaf44a49171ad798795c72c6f64cba4c2/cfgv-3.3.1-py2.py3-none-any.whl", hash = "sha256:c6a0883f3917a037485059700b9e75da2464e6c27051014ad85ba6aaa5884426", size = 7312 }, -] - -[[package]] -name = "cfgv" -version = "3.4.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.10'", - "python_full_version == '3.9.*'", - "python_full_version == '3.8.*'", -] -sdist = { url = "https://files.pythonhosted.org/packages/11/74/539e56497d9bd1d484fd863dd69cbbfa653cd2aa27abfe35653494d85e94/cfgv-3.4.0.tar.gz", hash = "sha256:e52591d4c5f5dead8e0f673fb16db7949d2cfb3f7da4582893288f0ded8fe560", size = 7114 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/c5/55/51844dd50c4fc7a33b653bfaba4c2456f06955289ca770a5dbd5fd267374/cfgv-3.4.0-py2.py3-none-any.whl", hash = "sha256:b7265b1f29fd3316bfcd2b330d63d024f2bfd8bcb8b0272f8e19a504856c48f9", size = 7249 }, -] - [[package]] name = "charset-normalizer" version = "3.4.2" @@ -751,15 +725,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e7/05/c19819d5e3d95294a6f5947fb9b9629efb316b96de511b418c53d245aae6/cycler-0.12.1-py3-none-any.whl", hash = "sha256:85cef7cff222d8644161529808465972e51340599459b8ac3ccbac5a854e0d30", size = 8321 }, ] -[[package]] -name = "distlib" -version = "0.3.9" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/0d/dd/1bec4c5ddb504ca60fc29472f3d27e8d4da1257a854e1d96742f15c1d02d/distlib-0.3.9.tar.gz", hash = "sha256:a60f20dea646b8a33f3e7772f74dc0b2d0772d2837ee1342a00645c81edf9403", size = 613923 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/91/a1/cf2472db20f7ce4a6be1253a81cfdf85ad9c7885ffbed7047fb72c24cf87/distlib-0.3.9-py2.py3-none-any.whl", hash = "sha256:47f8c22fd27c27e25a65601af709b38e4f0a45ea4fc2e710f65755fa8caaaf87", size = 468973 }, -] - [[package]] name = "exceptiongroup" version = "1.3.0" @@ -772,43 +737,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/36/f4/c6e662dade71f56cd2f3735141b265c3c79293c109549c1e6933b0651ffc/exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10", size = 16674 }, ] -[[package]] -name = "filelock" -version = "3.12.2" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.8'", -] -sdist = { url = "https://files.pythonhosted.org/packages/00/0b/c506e9e44e4c4b6c89fcecda23dc115bf8e7ff7eb127e0cb9c114cbc9a15/filelock-3.12.2.tar.gz", hash = "sha256:002740518d8aa59a26b0c76e10fb8c6e15eae825d34b6fdf670333fd7b938d81", size = 12441 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/00/45/ec3407adf6f6b5bf867a4462b2b0af27597a26bd3cd6e2534cb6ab029938/filelock-3.12.2-py3-none-any.whl", hash = "sha256:cbb791cdea2a72f23da6ac5b5269ab0a0d161e9ef0100e653b69049a7706d1ec", size = 10923 }, -] - -[[package]] -name = "filelock" -version = "3.16.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version == '3.8.*'", -] -sdist = { url = "https://files.pythonhosted.org/packages/9d/db/3ef5bb276dae18d6ec2124224403d1d67bccdbefc17af4cc8f553e341ab1/filelock-3.16.1.tar.gz", hash = "sha256:c249fbfcd5db47e5e2d6d62198e565475ee65e4831e2561c8e313fa7eb961435", size = 18037 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/b9/f8/feced7779d755758a52d1f6635d990b8d98dc0a29fa568bbe0625f18fdf3/filelock-3.16.1-py3-none-any.whl", hash = "sha256:2082e5703d51fbf98ea75855d9d5527e33d8ff23099bec374a134febee6946b0", size = 16163 }, -] - -[[package]] -name = "filelock" -version = "3.18.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.10'", - "python_full_version == '3.9.*'", -] -sdist = { url = "https://files.pythonhosted.org/packages/0a/10/c23352565a6544bdc5353e0b15fc1c563352101f30e24bf500207a54df9a/filelock-3.18.0.tar.gz", hash = "sha256:adbc88eabb99d2fec8c9c1b229b171f18afa655400173ddc653d5d01501fb9f2", size = 18075 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/4d/36/2a115987e2d8c300a974597416d9de88f2444426de9571f4b59b2cca3acc/filelock-3.18.0-py3-none-any.whl", hash = "sha256:c401f4f8377c4464e6db25fff06205fd89bdd83b65eb0488ed1b160f780e21de", size = 16215 }, -] - [[package]] name = "fonttools" version = "4.38.0" @@ -994,43 +922,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/58/c6/5c20af38c2a57c15d87f7f38bee77d63c1d2a3689f74fefaf35915dd12b2/griffe-1.7.3-py3-none-any.whl", hash = "sha256:c6b3ee30c2f0f17f30bcdef5068d6ab7a2a4f1b8bf1a3e74b56fffd21e1c5f75", size = 129303 }, ] -[[package]] -name = "identify" -version = "2.5.24" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.8'", -] -sdist = { url = "https://files.pythonhosted.org/packages/c4/f8/498e13e408d25ee6ff04aa0acbf91ad8e9caae74be91720fc0e811e649b7/identify-2.5.24.tar.gz", hash = "sha256:0aac67d5b4812498056d28a9a512a483f5085cc28640b02b258a59dac34301d4", size = 98886 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/4f/fd/2c46fba2bc032ba4c970bb8de59d25187087d7138a0ebf7c1dcc91d94f01/identify-2.5.24-py2.py3-none-any.whl", hash = "sha256:986dbfb38b1140e763e413e6feb44cd731faf72d1909543178aa79b0e258265d", size = 98826 }, -] - -[[package]] -name = "identify" -version = "2.6.1" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version == '3.8.*'", -] -sdist = { url = "https://files.pythonhosted.org/packages/29/bb/25024dbcc93516c492b75919e76f389bac754a3e4248682fba32b250c880/identify-2.6.1.tar.gz", hash = "sha256:91478c5fb7c3aac5ff7bf9b4344f803843dc586832d5f110d672b19aa1984c98", size = 99097 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/7d/0c/4ef72754c050979fdcc06c744715ae70ea37e734816bb6514f79df77a42f/identify-2.6.1-py2.py3-none-any.whl", hash = "sha256:53863bcac7caf8d2ed85bd20312ea5dcfc22226800f6d6881f232d861db5a8f0", size = 98972 }, -] - -[[package]] -name = "identify" -version = "2.6.10" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.10'", - "python_full_version == '3.9.*'", -] -sdist = { url = "https://files.pythonhosted.org/packages/0c/83/b6ea0334e2e7327084a46aaaf71f2146fc061a192d6518c0d020120cd0aa/identify-2.6.10.tar.gz", hash = "sha256:45e92fd704f3da71cc3880036633f48b4b7265fd4de2b57627cb157216eb7eb8", size = 99201 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/2b/d3/85feeba1d097b81a44bcffa6a0beab7b4dfffe78e82fc54978d3ac380736/identify-2.6.10-py2.py3-none-any.whl", hash = "sha256:5f34248f54136beed1a7ba6a6b5c4b6cf21ff495aac7c359e1ef831ae3b8ab25", size = 99101 }, -] - [[package]] name = "idna" version = "3.10" @@ -1134,9 +1025,6 @@ dependencies = [ [package.optional-dependencies] dev = [ - { name = "pre-commit", version = "2.21.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.8'" }, - { name = "pre-commit", version = "3.5.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.8.*'" }, - { name = "pre-commit", version = "4.2.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, { name = "pyrefly", version = "0.14.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.8'" }, { name = "pyrefly", version = "0.15.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.8'" }, { name = "pytest", version = "7.4.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.8'" }, @@ -1146,8 +1034,6 @@ dev = [ { name = "pytest-cov", version = "6.1.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, { name = "ruff" }, ] - -[package.dev-dependencies] docs = [ { name = "mkdocs", version = "1.5.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.8'" }, { name = "mkdocs", version = "1.6.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.8'" }, @@ -1161,8 +1047,10 @@ docs = [ [package.metadata] requires-dist = [ { name = "matplotlib" }, + { name = "mkdocs", marker = "extra == 'docs'", specifier = ">=1.5.3" }, + { name = "mkdocs-material", marker = "extra == 'docs'", specifier = ">=9.2.7" }, + { name = "mkdocstrings", extras = ["python"], marker = "extra == 'docs'", specifier = ">=0.22.0" }, { name = "numpy", specifier = ">=1.19" }, - { name = "pre-commit", marker = "extra == 'dev'", specifier = ">=2.21.0" }, { name = "pyrefly", marker = "extra == 'dev'", specifier = ">=0.14.0" }, { name = "pytest", marker = "extra == 'dev'", specifier = ">=7.4.4" }, { name = "pytest-cov", marker = "extra == 'dev'", specifier = ">=4.1.0" }, @@ -1170,14 +1058,7 @@ requires-dist = [ { name = "scikit-learn", specifier = ">=1.0.2" }, { name = "scipy" }, ] -provides-extras = ["dev"] - -[package.metadata.requires-dev] -docs = [ - { name = "mkdocs", specifier = ">=1.5.3" }, - { name = "mkdocs-material", specifier = ">=9.2.7" }, - { name = "mkdocstrings", extras = ["python"], specifier = ">=0.22.0" }, -] +provides-extras = ["dev", "docs"] [[package]] name = "jinja2" @@ -2347,15 +2228,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/53/37/19549c5e0179785308cc988a68e16aa7550e4e270ec8a9878334e86070c6/mkdocstrings_python-1.16.10-py3-none-any.whl", hash = "sha256:63bb9f01f8848a644bdb6289e86dc38ceddeaa63ecc2e291e3b2ca52702a6643", size = 124112 }, ] -[[package]] -name = "nodeenv" -version = "1.9.1" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/43/16/fc88b08840de0e0a72a2f9d8c6bae36be573e475a6326ae854bcc549fc45/nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f", size = 47437 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/d2/1d/1b658dbd2b9fa9c4c9f32accbfc0205d532c8c6194dc0f2a4c0428e7128a/nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9", size = 22314 }, -] - [[package]] name = "numpy" version = "1.21.6" @@ -2954,65 +2826,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538 }, ] -[[package]] -name = "pre-commit" -version = "2.21.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.8'", -] -dependencies = [ - { name = "cfgv", version = "3.3.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.8'" }, - { name = "identify", version = "2.5.24", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.8'" }, - { name = "importlib-metadata", marker = "python_full_version < '3.8'" }, - { name = "nodeenv", marker = "python_full_version < '3.8'" }, - { name = "pyyaml", version = "6.0.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.8'" }, - { name = "virtualenv", version = "20.26.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.8'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/6b/00/1637ae945c6e10838ef5c41965f1c864e59301811bb203e979f335608e7c/pre_commit-2.21.0.tar.gz", hash = "sha256:31ef31af7e474a8d8995027fefdfcf509b5c913ff31f2015b4ec4beb26a6f658", size = 174966 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/a6/6b/6cfe3a8b351b54f4b6c6d2ad4286804e3367f628dce379c603d3b96635f4/pre_commit-2.21.0-py2.py3-none-any.whl", hash = "sha256:e2f91727039fc39a92f58a588a25b87f936de6567eed4f0e673e0507edc75bad", size = 201938 }, -] - -[[package]] -name = "pre-commit" -version = "3.5.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version == '3.8.*'", -] -dependencies = [ - { name = "cfgv", version = "3.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.8.*'" }, - { name = "identify", version = "2.6.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.8.*'" }, - { name = "nodeenv", marker = "python_full_version == '3.8.*'" }, - { name = "pyyaml", version = "6.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.8.*'" }, - { name = "virtualenv", version = "20.31.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.8.*'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/04/b3/4ae08d21eb097162f5aad37f4585f8069a86402ed7f5362cc9ae097f9572/pre_commit-3.5.0.tar.gz", hash = "sha256:5804465c675b659b0862f07907f96295d490822a450c4c40e747d0b1c6ebcb32", size = 177079 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/6c/75/526915fedf462e05eeb1c75ceaf7e3f9cde7b5ce6f62740fe5f7f19a0050/pre_commit-3.5.0-py2.py3-none-any.whl", hash = "sha256:841dc9aef25daba9a0238cd27984041fa0467b4199fc4852e27950664919f660", size = 203698 }, -] - -[[package]] -name = "pre-commit" -version = "4.2.0" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.10'", - "python_full_version == '3.9.*'", -] -dependencies = [ - { name = "cfgv", version = "3.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "identify", version = "2.6.10", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "nodeenv", marker = "python_full_version >= '3.9'" }, - { name = "pyyaml", version = "6.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "virtualenv", version = "20.31.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/08/39/679ca9b26c7bb2999ff122d50faa301e49af82ca9c066ec061cfbc0c6784/pre_commit-4.2.0.tar.gz", hash = "sha256:601283b9757afd87d40c4c4a9b2b5de9637a8ea02eaff7adc2d0fb4e04841146", size = 193424 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/88/74/a88bf1b1efeae488a0c0b7bdf71429c313722d1fc0f377537fbe554e6180/pre_commit-4.2.0-py2.py3-none-any.whl", hash = "sha256:a009ca7205f1eb497d10b845e52c838a98b6cdd2102a6c8e4540e94ee75c58bd", size = 220707 }, -] - [[package]] name = "pygments" version = "2.17.2" @@ -4010,45 +3823,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/6b/11/cc635220681e93a0183390e26485430ca2c7b5f9d33b15c74c2861cb8091/urllib3-2.4.0-py3-none-any.whl", hash = "sha256:4e16665048960a0900c702d4a66415956a584919c03361cac9f1df5c5dd7e813", size = 128680 }, ] -[[package]] -name = "virtualenv" -version = "20.26.6" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version < '3.8'", -] -dependencies = [ - { name = "distlib", marker = "python_full_version < '3.8'" }, - { name = "filelock", version = "3.12.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.8'" }, - { name = "importlib-metadata", marker = "python_full_version < '3.8'" }, - { name = "platformdirs", version = "4.0.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.8'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/3f/40/abc5a766da6b0b2457f819feab8e9203cbeae29327bd241359f866a3da9d/virtualenv-20.26.6.tar.gz", hash = "sha256:280aede09a2a5c317e409a00102e7077c6432c5a38f0ef938e643805a7ad2c48", size = 9372482 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/59/90/57b8ac0c8a231545adc7698c64c5a36fa7cd8e376c691b9bde877269f2eb/virtualenv-20.26.6-py3-none-any.whl", hash = "sha256:7345cc5b25405607a624d8418154577459c3e0277f5466dd79c49d5e492995f2", size = 5999862 }, -] - -[[package]] -name = "virtualenv" -version = "20.31.2" -source = { registry = "https://pypi.org/simple" } -resolution-markers = [ - "python_full_version >= '3.10'", - "python_full_version == '3.9.*'", - "python_full_version == '3.8.*'", -] -dependencies = [ - { name = "distlib", marker = "python_full_version >= '3.8'" }, - { name = "filelock", version = "3.16.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.8.*'" }, - { name = "filelock", version = "3.18.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, - { name = "platformdirs", version = "4.3.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version == '3.8.*'" }, - { name = "platformdirs", version = "4.3.8", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.9'" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/56/2c/444f465fb2c65f40c3a104fd0c495184c4f2336d65baf398e3c75d72ea94/virtualenv-20.31.2.tar.gz", hash = "sha256:e10c0a9d02835e592521be48b332b6caee6887f332c111aa79a09b9e79efc2af", size = 6076316 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/f3/40/b1c265d4b2b62b58576588510fc4d1fe60a86319c8de99fd8e9fec617d2c/virtualenv-20.31.2-py3-none-any.whl", hash = "sha256:36efd0d9650ee985f0cad72065001e66d49a6f24eb44d98980f630686243cf11", size = 6057982 }, -] - [[package]] name = "watchdog" version = "3.0.0" From 76e13e139892255d3f15b72ac6a313a14f4e2bae Mon Sep 17 00:00:00 2001 From: Niru Nahesh Date: Sun, 18 May 2025 12:13:50 -0700 Subject: [PATCH 05/10] Adds typecheck workflow --- .github/workflows/typecheck.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index 63fe3bd..dfa5060 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -1,4 +1,8 @@ +<<<<<<< HEAD name: Typecheck +======= +name: Tests +>>>>>>> da56154 (Adds typecheck workflow) on: push: From 12556b5c61979778e34e370782088f0569efa35b Mon Sep 17 00:00:00 2001 From: Niru Nahesh Date: Sun, 18 May 2025 12:19:33 -0700 Subject: [PATCH 06/10] Fixes merge conflict. --- .github/workflows/typecheck.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index dfa5060..63fe3bd 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -1,8 +1,4 @@ -<<<<<<< HEAD name: Typecheck -======= -name: Tests ->>>>>>> da56154 (Adds typecheck workflow) on: push: From 72fe26d432948208201d7cc3c61881cd0775b813 Mon Sep 17 00:00:00 2001 From: Niru Nahesh Date: Sun, 18 May 2025 12:22:05 -0700 Subject: [PATCH 07/10] Pyrefly fix --- pyproject.toml | 2 +- src/jetplot/chart_utils.py | 3 +++ src/jetplot/colors.py | 2 ++ src/jetplot/images.py | 5 +++++ src/jetplot/plots.py | 4 ++++ src/jetplot/signals.py | 3 ++- src/jetplot/style.py | 2 +- src/jetplot/typing.py | 2 +- tests/test_demo.py | 2 +- tests/test_signals.py | 6 ++++++ tests/test_timepiece.py | 2 ++ 11 files changed, 28 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 23afe31..f67f3b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ docs = [ [tool.pyrefly] search_path = [ - "src/jetplot" + "src/" ] [tool.ruff] diff --git a/src/jetplot/chart_utils.py b/src/jetplot/chart_utils.py index 5441254..a1f8d60 100644 --- a/src/jetplot/chart_utils.py +++ b/src/jetplot/chart_utils.py @@ -130,6 +130,7 @@ def get_bounds(axis, ax=None): else: lower, upper = None, None + # pyrefly: ignore # no-matching-overload, bad-argument-type for tick, label in zip(ticks(), labels()): if label.get_text() != "": if lower is None: @@ -190,6 +191,7 @@ def yclamp(y0=None, y1=None, dt=None, **kwargs): y0 = lims[0] if y0 is None else y0 y1 = lims[1] if y1 is None else y1 + # pyrefly: ignore # no-matching-overload, bad-argument-type dt = np.mean(np.diff(ax.get_yticks())) if dt is None else dt new_ticks = np.arange(dt * np.floor(y0 / dt), dt * (np.ceil(y1 / dt) + 1), dt) @@ -208,6 +210,7 @@ def xclamp(x0=None, x1=None, dt=None, **kwargs): x0 = lims[0] if x0 is None else x0 x1 = lims[1] if x1 is None else x1 + # pyrefly: ignore # no-matching-overload, bad-argument-type dt = np.mean(np.diff(ax.get_xticks())) if dt is None else dt new_ticks = np.arange(dt * np.floor(x0 / dt), dt * (np.ceil(x1 / dt) + 1), dt) diff --git a/src/jetplot/colors.py b/src/jetplot/colors.py index 62fa668..2ff7f67 100644 --- a/src/jetplot/colors.py +++ b/src/jetplot/colors.py @@ -38,10 +38,12 @@ def cubehelix( x = lambda_**gamma phi = 2 * np.pi * (start / 3 + rot * lambda_) + # pyrefly: ignore # bad-argument-type, no-matching-overload alpha = 0.5 * hue * x * (1.0 - x) A = np.array([[-0.14861, 1.78277], [-0.29227, -0.90649], [1.97294, 0.0]]) b = np.stack([np.cos(phi), np.sin(phi)]) + # pyrefly: ignore # no-matching-overload, bad-argument-type return Palette((x + alpha * (A @ b)).T) diff --git a/src/jetplot/images.py b/src/jetplot/images.py index 4d6f9e2..7b4d48a 100644 --- a/src/jetplot/images.py +++ b/src/jetplot/images.py @@ -83,8 +83,10 @@ def fsurface(func, xrng=None, yrng=None, n=100, nargs=2, **kwargs): xrng = (-1, 1) if xrng is None else xrng yrng = xrng if yrng is None else yrng + # pyrefly: ignore # missing-argument, no-matching-overload, bad-argument-type xs = np.linspace(*xrng, n) + # pyrefly: ignore # missing-argument, no-matching-overload, bad-argument-type ys = np.linspace(*yrng, n) xm, ym = np.meshgrid(xs, ys) @@ -128,6 +130,7 @@ def cmat( xs, ys = np.meshgrid(np.arange(num_cols), np.arange(num_rows)) + # pyrefly: ignore # no-matching-overload, bad-argument-type for x, y, value in zip(xs.flat, ys.flat, arr.flat): color = dark_color if (value <= theta) else light_color annot = f"{{:{fmt}}}".format(value) @@ -139,8 +142,10 @@ def cmat( ax.set_yticks(np.arange(num_rows)) ax.set_yticklabels(labels, fontsize=label_fontsize) + # pyrefly: ignore # bad-argument-type ax.xaxis.set_minor_locator(FixedLocator(np.arange(num_cols) - 0.5)) + # pyrefly: ignore # bad-argument-type ax.yaxis.set_minor_locator(FixedLocator(np.arange(num_rows) - 0.5)) ax.grid( diff --git a/src/jetplot/plots.py b/src/jetplot/plots.py index 1b7a985..5e8ed53 100644 --- a/src/jetplot/plots.py +++ b/src/jetplot/plots.py @@ -54,6 +54,7 @@ def violinplot( pc.set_edgecolor(ec) pc.set_alpha(1.0) + # pyrefly: ignore # no-matching-overload, bad-argument-type q1, medians, q3 = np.percentile(data, [25, 50, 75], axis=0) ax.vlines( @@ -76,6 +77,7 @@ def violinplot( if showmeans: ax.scatter( xs, + # pyrefly: ignore # no-matching-overload, bad-argument-type np.mean(data, axis=0), marker="s", color=mc, @@ -121,6 +123,7 @@ def hist2d(x, y, bins=None, range=None, cmap="hot", **kwargs): # compute the histogram + # pyrefly: ignore # no-matching-overload, unexpected-keyword, bad-argument-type cnt, xe, ye = np.histogram2d(x, y, bins=bins, normed=True, range=range) # generate the plot @@ -363,6 +366,7 @@ def ellipse(x, y, n_std=3.0, facecolor="none", estimator="empirical", **kwargs): mean_y = np.mean(y) transform = ( + # pyrefly: ignore # bad-argument-type Affine2D().rotate_deg(45).scale(scale_x, scale_y).translate(mean_x, mean_y) ) diff --git a/src/jetplot/signals.py b/src/jetplot/signals.py index d80b71a..0f466dc 100644 --- a/src/jetplot/signals.py +++ b/src/jetplot/signals.py @@ -1,6 +1,6 @@ """Tools for signal processing.""" -# pyrefly: ignore # missing-module-attribute + from typing import Callable import numpy as np @@ -62,6 +62,7 @@ def canoncorr(X: ArrayLike, Y: ArrayLike) -> ArrayLike: """ # Orthogonalize each subspace + # pyrefly: ignore # no-matching-overload, bad-argument-type qu, qv = np.linalg.qr(X)[0], np.linalg.qr(Y)[0] # singular values of the inner product between the orthogonalized spaces diff --git a/src/jetplot/style.py b/src/jetplot/style.py index 91b0744..51ebc0d 100644 --- a/src/jetplot/style.py +++ b/src/jetplot/style.py @@ -2,7 +2,7 @@ from functools import partial -# pyrefly: ignore # missing-module-attribute + from typing import Mapping, Any from cycler import cycler diff --git a/src/jetplot/typing.py b/src/jetplot/typing.py index b6b6b29..0e98caa 100644 --- a/src/jetplot/typing.py +++ b/src/jetplot/typing.py @@ -1,4 +1,4 @@ -# pyrefly: ignore # missing-module-attribute + from typing import Sequence, Union __all__ = ["Color", "Palette"] diff --git a/tests/test_demo.py b/tests/test_demo.py index 2e8e804..807f644 100644 --- a/tests/test_demo.py +++ b/tests/test_demo.py @@ -8,5 +8,5 @@ def test_peaks(): n = 256 xm, ym, zm = demo.peaks(n=n) - # pyrefly: ignore # missing-attribute + assert xm.shape == ym.shape == zm.shape == (n, n) diff --git a/tests/test_signals.py b/tests/test_signals.py index ffedf17..b221ca4 100644 --- a/tests/test_signals.py +++ b/tests/test_signals.py @@ -5,8 +5,10 @@ def test_stable_rank(): + # pyrefly: ignore # no-matching-overload, bad-argument-type U, _ = np.linalg.qr(np.random.randn(32, 32)) + # pyrefly: ignore # no-matching-overload, bad-argument-type V, _ = np.linalg.qr(np.random.randn(32, 32)) S = np.random.randn(32) @@ -23,6 +25,7 @@ def test_participation_ratio(): def _random_matrix(evals): dim = evals.size + # pyrefly: ignore # no-matching-overload, bad-argument-type Q, _ = np.linalg.qr(np.random.randn(dim, dim)) return Q @ np.diag(evals) @ Q.T @@ -60,6 +63,7 @@ def test_cca(): X = rs.randn(n, k) Y = rs.randn(n, k) + # pyrefly: ignore # no-matching-overload, bad-argument-type Z = X @ np.linalg.qr(rs.randn(k, k))[0] # Correlation with itself should be all ones. @@ -69,8 +73,10 @@ def test_cca(): # Correlation with a different random subspace. xy = signals.canoncorr(X, Y) + # pyrefly: ignore # bad-argument-type assert np.all(xy <= 1.0) + # pyrefly: ignore # bad-argument-type assert np.all(0.0 <= xy) assert 0 < np.sum(xy) < k diff --git a/tests/test_timepiece.py b/tests/test_timepiece.py index e96f1d1..5631620 100644 --- a/tests/test_timepiece.py +++ b/tests/test_timepiece.py @@ -2,6 +2,8 @@ from jetplot.timepiece import hrtime, profile import numpy as np + +# pyrefly: ignore # import-error import pytest import time From 67bc56a913246daa2f3a2b6667d7dc7a27d4718b Mon Sep 17 00:00:00 2001 From: Niru Nahesh Date: Sun, 18 May 2025 12:29:46 -0700 Subject: [PATCH 08/10] Adds python 3.13 --- .github/workflows/ci.yml | 2 +- .github/workflows/typecheck.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1542ba..eb78ba0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - name: Check out the code diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index 63fe3bd..ea9cd30 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - name: Check out the code From cca0d53e0dc762580686e7c4fd018411da24c9c6 Mon Sep 17 00:00:00 2001 From: Niru Nahesh Date: Sun, 18 May 2025 12:33:47 -0700 Subject: [PATCH 09/10] Trying editable mode --- .github/workflows/ci.yml | 2 +- .github/workflows/typecheck.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eb78ba0..4b411b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: - name: Install project with dev dependencies run: | - uv pip install --system .[dev] + uv pip install -e .[dev] - name: Run ruff run: | diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index ea9cd30..d737ee3 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -29,7 +29,7 @@ jobs: - name: Install project with dev dependencies run: | - uv pip install --system .[dev] + uv pip install -e .[dev] - name: Run Pyrefly Type Checker run: pyrefly check From 1d50345952772a9231ccde2cf55a94ec1d1dae32 Mon Sep 17 00:00:00 2001 From: Niru Nahesh Date: Sun, 18 May 2025 12:36:05 -0700 Subject: [PATCH 10/10] Trying editable mode --- .github/workflows/ci.yml | 12 ++++++------ .github/workflows/typecheck.yml | 8 +++++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b411b5..6631e69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,14 +27,14 @@ jobs: curl -LsSf https://astral.sh/uv/install.sh | sh echo "$HOME/.cargo/bin" >> $GITHUB_PATH + - name: Create virtual environment + run: uv venv + - name: Install project with dev dependencies - run: | - uv pip install -e .[dev] + run: uv pip install -e .[dev] - name: Run ruff - run: | - ruff check . + run: uv run ruff check . - name: Run tests with pytest - run: | - pytest --cov --cov-report=term-missing + run: uv run pytest --cov --cov-report=term-missing diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml index d737ee3..2d7885b 100644 --- a/.github/workflows/typecheck.yml +++ b/.github/workflows/typecheck.yml @@ -27,9 +27,11 @@ jobs: curl -LsSf https://astral.sh/uv/install.sh | sh echo "$HOME/.cargo/bin" >> $GITHUB_PATH + - name: Create virtual environment + run: uv venv + - name: Install project with dev dependencies - run: | - uv pip install -e .[dev] + run: uv pip install -e .[dev] - name: Run Pyrefly Type Checker - run: pyrefly check + run: uv run pyrefly check