From 442bf07fd2743391cf875504e79303d70fe88163 Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Fri, 10 Jan 2025 07:15:14 +0400 Subject: [PATCH 01/13] move to src folder? --- README.md | 4 ++-- book/docs/index.md | 4 ++-- book/marimo/demo.py | 4 ++-- experiment/demo1.py | 2 +- {cvx => src/cvx}/bson/__init__.py | 0 {cvx => src/cvx}/bson/dataclass.py | 0 {cvx => src/cvx}/bson/file.py | 0 {cvx => src/cvx}/bson/io.py | 0 {cvx => src/cvx}/json/__init__.py | 0 {cvx => src/cvx}/json/file.py | 0 {cvx => src/cvx}/json/numpyencoder.py | 0 {tests => src/tests}/conftest.py | 0 {tests => src/tests}/resources/.gitkeep | 0 {tests => src/tests}/test_bson.py | 2 +- {tests => src/tests}/test_dataclass.py | 2 +- {tests => src/tests}/test_encode_decode.py | 2 +- {tests => src/tests}/test_json.py | 2 +- {tests => src/tests}/test_pandas.py | 2 +- 18 files changed, 12 insertions(+), 12 deletions(-) rename {cvx => src/cvx}/bson/__init__.py (100%) rename {cvx => src/cvx}/bson/dataclass.py (100%) rename {cvx => src/cvx}/bson/file.py (100%) rename {cvx => src/cvx}/bson/io.py (100%) rename {cvx => src/cvx}/json/__init__.py (100%) rename {cvx => src/cvx}/json/file.py (100%) rename {cvx => src/cvx}/json/numpyencoder.py (100%) rename {tests => src/tests}/conftest.py (100%) rename {tests => src/tests}/resources/.gitkeep (100%) rename {tests => src/tests}/test_bson.py (95%) rename {tests => src/tests}/test_dataclass.py (97%) rename {tests => src/tests}/test_encode_decode.py (91%) rename {tests => src/tests}/test_json.py (93%) rename {tests => src/tests}/test_pandas.py (96%) diff --git a/README.md b/README.md index f9d7aaf7..118604fd 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,9 @@ and encouraged. ```python import numpy as np -from cvx.bson import read_bson, write_bson +from src.cvx.bson import read_bson, write_bson -data = {"A": np.random.rand(50,50), "B": np.random.rand(50)} +data = {"A": np.random.rand(50, 50), "B": np.random.rand(50)} write_bson("test.bson", data) recovered = read_bson("test.bson") diff --git a/book/docs/index.md b/book/docs/index.md index 2e92f811..16741310 100644 --- a/book/docs/index.md +++ b/book/docs/index.md @@ -33,9 +33,9 @@ and encouraged. ```python import numpy as np -from cvx.bson import read_bson, write_bson +from src.cvx.bson import read_bson, write_bson -data = {"A": np.random.rand(50,50), "B": np.random.rand(50)} +data = {"A": np.random.rand(50, 50), "B": np.random.rand(50)} write_bson("test.bson", data) recovered = read_bson("test.bson") diff --git a/book/marimo/demo.py b/book/marimo/demo.py index 7e05cacc..f751248d 100644 --- a/book/marimo/demo.py +++ b/book/marimo/demo.py @@ -14,8 +14,8 @@ def __(mo): def __(): import numpy as np - from cvx.bson import read_bson, write_bson - from cvx.json import read_json, write_json + from src.cvx.bson import read_bson, write_bson + from src.cvx.json import read_json, write_json return np, read_bson, read_json, write_bson, write_json diff --git a/experiment/demo1.py b/experiment/demo1.py index 5eb65da6..80a3907b 100644 --- a/experiment/demo1.py +++ b/experiment/demo1.py @@ -3,7 +3,7 @@ import polars as pl -from cvx.bson.dataclass import Data +from src.cvx.bson.dataclass import Data @dataclass(frozen=True) diff --git a/cvx/bson/__init__.py b/src/cvx/bson/__init__.py similarity index 100% rename from cvx/bson/__init__.py rename to src/cvx/bson/__init__.py diff --git a/cvx/bson/dataclass.py b/src/cvx/bson/dataclass.py similarity index 100% rename from cvx/bson/dataclass.py rename to src/cvx/bson/dataclass.py diff --git a/cvx/bson/file.py b/src/cvx/bson/file.py similarity index 100% rename from cvx/bson/file.py rename to src/cvx/bson/file.py diff --git a/cvx/bson/io.py b/src/cvx/bson/io.py similarity index 100% rename from cvx/bson/io.py rename to src/cvx/bson/io.py diff --git a/cvx/json/__init__.py b/src/cvx/json/__init__.py similarity index 100% rename from cvx/json/__init__.py rename to src/cvx/json/__init__.py diff --git a/cvx/json/file.py b/src/cvx/json/file.py similarity index 100% rename from cvx/json/file.py rename to src/cvx/json/file.py diff --git a/cvx/json/numpyencoder.py b/src/cvx/json/numpyencoder.py similarity index 100% rename from cvx/json/numpyencoder.py rename to src/cvx/json/numpyencoder.py diff --git a/tests/conftest.py b/src/tests/conftest.py similarity index 100% rename from tests/conftest.py rename to src/tests/conftest.py diff --git a/tests/resources/.gitkeep b/src/tests/resources/.gitkeep similarity index 100% rename from tests/resources/.gitkeep rename to src/tests/resources/.gitkeep diff --git a/tests/test_bson.py b/src/tests/test_bson.py similarity index 95% rename from tests/test_bson.py rename to src/tests/test_bson.py index cd59f2eb..8c1b1c81 100644 --- a/tests/test_bson.py +++ b/src/tests/test_bson.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from cvx.bson.file import from_bson, read_bson, to_bson, write_bson +from src.cvx.bson.file import from_bson, read_bson, to_bson, write_bson @pytest.mark.parametrize("shape", [(50, 50), (1000, 50), (50, 1000), (1000, 1000), (5000, 2000)]) diff --git a/tests/test_dataclass.py b/src/tests/test_dataclass.py similarity index 97% rename from tests/test_dataclass.py rename to src/tests/test_dataclass.py index 0554455f..ac4b58e1 100644 --- a/tests/test_dataclass.py +++ b/src/tests/test_dataclass.py @@ -4,7 +4,7 @@ import pandas as pd import polars as pl -from cvx.bson.dataclass import Data +from src.cvx.bson.dataclass import Data @dataclass(frozen=True) diff --git a/tests/test_encode_decode.py b/src/tests/test_encode_decode.py similarity index 91% rename from tests/test_encode_decode.py rename to src/tests/test_encode_decode.py index 44f1be11..cb544508 100644 --- a/tests/test_encode_decode.py +++ b/src/tests/test_encode_decode.py @@ -2,7 +2,7 @@ import pandas as pd import polars as pl -from cvx.bson.io import decode, encode +from src.cvx.bson.io import decode, encode def test_pl(): diff --git a/tests/test_json.py b/src/tests/test_json.py similarity index 93% rename from tests/test_json.py rename to src/tests/test_json.py index 10b80606..1929c037 100644 --- a/tests/test_json.py +++ b/src/tests/test_json.py @@ -1,7 +1,7 @@ import numpy as np import pytest -from cvx.json import read_json, write_json +from src.cvx.json import read_json, write_json @pytest.mark.parametrize("shape", [(50, 50), (1000, 50), (50, 1000), (1000, 1000), (5000, 2000)]) diff --git a/tests/test_pandas.py b/src/tests/test_pandas.py similarity index 96% rename from tests/test_pandas.py rename to src/tests/test_pandas.py index 749465fa..57e56c9d 100644 --- a/tests/test_pandas.py +++ b/src/tests/test_pandas.py @@ -3,7 +3,7 @@ import polars as pl import pytest -from cvx.bson.file import from_bson, to_bson +from src.cvx.bson.file import from_bson, to_bson @pytest.fixture() From cd47dd2f1219d1ba87c509c7d974be2469cdd52d Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Fri, 10 Jan 2025 07:18:02 +0400 Subject: [PATCH 02/13] move to src folder? --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4829c28f..5f731b56 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,4 +40,4 @@ requires = ["hatchling"] build-backend = "hatchling.build" [tool.hatch.build.targets.wheel] -packages = ["cvx"] +packages = ["src/cvx"] From 0af592cd7732ac6c7b5a11d17e865b43f90a22b3 Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Fri, 10 Jan 2025 07:20:44 +0400 Subject: [PATCH 03/13] move to src folder? --- .github/workflows/book.yml | 4 +++- .github/workflows/pre-commit.yml | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index c30a9d8a..ff7a1065 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -26,7 +26,9 @@ jobs: - name: Checkout [${{ github.repository }}] uses: actions/checkout@v4 - - uses: cvxgrp/.github/actions/uv/coverage@v2.0.0 + - uses: cvxgrp/.github/actions/uv/coverage@v2.0.1 + with: + source-folder: 'src/cvx' jupyter: runs-on: "ubuntu-latest" diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 172483cb..b1a2cd83 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -11,7 +11,8 @@ jobs: uses: actions/checkout@v4 - uses: cvxgrp/.github/actions/uv/coverage@v2.0.0 - + with: + source-folder: 'src/cvx' - name: Coveralls GitHub Action uses: coverallsapp/github-action@v2 with: @@ -25,3 +26,5 @@ jobs: uses: actions/checkout@v4 - uses: cvxgrp/.github/actions/uv/deptry@v2.0.0 + with: + source-folder: 'src/cvx' From ef729a6d9c5bf6ad85532b26a3c3fa0a49b5f83c Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Fri, 10 Jan 2025 07:22:20 +0400 Subject: [PATCH 04/13] move to src folder? --- .github/workflows/pre-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index b1a2cd83..14a716c8 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -27,4 +27,4 @@ jobs: - uses: cvxgrp/.github/actions/uv/deptry@v2.0.0 with: - source-folder: 'src/cvx' + source-folder: 'src' From 99eec587a06eef45706a9b770b4ac6d30a0e2b6d Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Fri, 10 Jan 2025 07:28:17 +0400 Subject: [PATCH 05/13] move to src folder? --- .github/workflows/pre-commit.yml | 3 ++- src/cvx/__init__.py | 0 src/tests/test_bson.py | 2 +- src/tests/test_dataclass.py | 2 +- src/tests/test_encode_decode.py | 2 +- src/tests/test_json.py | 2 +- src/tests/test_pandas.py | 2 +- 7 files changed, 7 insertions(+), 6 deletions(-) create mode 100644 src/cvx/__init__.py diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 14a716c8..f879c242 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -13,6 +13,7 @@ jobs: - uses: cvxgrp/.github/actions/uv/coverage@v2.0.0 with: source-folder: 'src/cvx' + - name: Coveralls GitHub Action uses: coverallsapp/github-action@v2 with: @@ -27,4 +28,4 @@ jobs: - uses: cvxgrp/.github/actions/uv/deptry@v2.0.0 with: - source-folder: 'src' + source-folder: 'src/cvx' diff --git a/src/cvx/__init__.py b/src/cvx/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/tests/test_bson.py b/src/tests/test_bson.py index 8c1b1c81..cd59f2eb 100644 --- a/src/tests/test_bson.py +++ b/src/tests/test_bson.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from src.cvx.bson.file import from_bson, read_bson, to_bson, write_bson +from cvx.bson.file import from_bson, read_bson, to_bson, write_bson @pytest.mark.parametrize("shape", [(50, 50), (1000, 50), (50, 1000), (1000, 1000), (5000, 2000)]) diff --git a/src/tests/test_dataclass.py b/src/tests/test_dataclass.py index ac4b58e1..0554455f 100644 --- a/src/tests/test_dataclass.py +++ b/src/tests/test_dataclass.py @@ -4,7 +4,7 @@ import pandas as pd import polars as pl -from src.cvx.bson.dataclass import Data +from cvx.bson.dataclass import Data @dataclass(frozen=True) diff --git a/src/tests/test_encode_decode.py b/src/tests/test_encode_decode.py index cb544508..44f1be11 100644 --- a/src/tests/test_encode_decode.py +++ b/src/tests/test_encode_decode.py @@ -2,7 +2,7 @@ import pandas as pd import polars as pl -from src.cvx.bson.io import decode, encode +from cvx.bson.io import decode, encode def test_pl(): diff --git a/src/tests/test_json.py b/src/tests/test_json.py index 1929c037..10b80606 100644 --- a/src/tests/test_json.py +++ b/src/tests/test_json.py @@ -1,7 +1,7 @@ import numpy as np import pytest -from src.cvx.json import read_json, write_json +from cvx.json import read_json, write_json @pytest.mark.parametrize("shape", [(50, 50), (1000, 50), (50, 1000), (1000, 1000), (5000, 2000)]) diff --git a/src/tests/test_pandas.py b/src/tests/test_pandas.py index 57e56c9d..749465fa 100644 --- a/src/tests/test_pandas.py +++ b/src/tests/test_pandas.py @@ -3,7 +3,7 @@ import polars as pl import pytest -from src.cvx.bson.file import from_bson, to_bson +from cvx.bson.file import from_bson, to_bson @pytest.fixture() From cf22cf9571e01d53be38be82e2d07ae29c5ca724 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 03:28:30 +0000 Subject: [PATCH 06/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/cvx/bson/file.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cvx/bson/file.py b/src/cvx/bson/file.py index 5ea2747e..7110f830 100644 --- a/src/cvx/bson/file.py +++ b/src/cvx/bson/file.py @@ -20,14 +20,13 @@ from os import PathLike from typing import Any, Dict, Union +import bson import numpy.typing as npt import pandas as pd # see https://github.com/microsoft/pylance-release/issues/2019 from typing_extensions import TypeAlias -import bson - from .io import decode, encode FILE = Union[str, bytes, PathLike] From 0f1a72069d68df5f66fd1b89a3577ced23405d8c Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Fri, 10 Jan 2025 07:41:18 +0400 Subject: [PATCH 07/13] move to src folder? --- .github/workflows/ci.yml | 3 ++- .github/workflows/pre-commit.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 90334d41..b35b19fc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,7 @@ jobs: - name: Checkout [${{ github.repository }}] uses: actions/checkout@v4 - - uses: cvxgrp/.github/actions/uv/test@v2.0.0 + - uses: cvxgrp/.github/actions/uv/test@v2.0.2 with: python-version: ${{ matrix.python-version }} + tests-folder: 'src/tests' diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index f879c242..dcfaa058 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -10,9 +10,10 @@ jobs: - name: Checkout [${{ github.repository }}] uses: actions/checkout@v4 - - uses: cvxgrp/.github/actions/uv/coverage@v2.0.0 + - uses: cvxgrp/.github/actions/uv/coverage@v2.0.2 with: source-folder: 'src/cvx' + tests-folder: 'src/tests' - name: Coveralls GitHub Action uses: coverallsapp/github-action@v2 From 174155f10ec5f59bda3fe985c474567898ce8f09 Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Fri, 10 Jan 2025 07:44:06 +0400 Subject: [PATCH 08/13] move to src folder? --- .github/workflows/book.yml | 19 +++++++++++-------- book/docs/api.md | 4 +--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index ff7a1065..0c358f6f 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -12,13 +12,6 @@ jobs: - uses: cvxgrp/.github/actions/uv/marimo@v2.0.0 - sphinx: - runs-on: "ubuntu-latest" - steps: - - name: Checkout [${{ github.repository }}] - uses: actions/checkout@v4 - - - uses: cvxgrp/.github/actions/uv/sphinx@v2.0.0 test: runs-on: "ubuntu-latest" @@ -38,9 +31,19 @@ jobs: - uses: cvxgrp/.github/actions/uv/jupyter@v2.0.0 + pdoc: + runs-on: ubuntu-latest + steps: + - name: Checkout [${{ github.repository }}] + uses: actions/checkout@v4 + + - uses: cvxgrp/.github/actions/uv/pdoc@v2.0.2 + with: + source-folder: 'src/cvx' + book: runs-on: "ubuntu-latest" - needs: [test, sphinx, jupyter, marimo] + needs: [test, jupyter, marimo, pdoc] permissions: contents: write diff --git a/book/docs/api.md b/book/docs/api.md index 58673ab1..a98c68ba 100644 --- a/book/docs/api.md +++ b/book/docs/api.md @@ -1,5 +1,3 @@ # API -## Sphinx - -[API](https://www.cvxgrp.org/cvxbson/sphinx/) +[API](https://www.cvxgrp.org/cvxbson/pdoc/) From 6f4339fa32acb3734ec5a126d38821b8f7755cbf Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Fri, 10 Jan 2025 07:46:00 +0400 Subject: [PATCH 09/13] move to src folder? --- book/marimo/demo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/marimo/demo.py b/book/marimo/demo.py index f751248d..7e05cacc 100644 --- a/book/marimo/demo.py +++ b/book/marimo/demo.py @@ -14,8 +14,8 @@ def __(mo): def __(): import numpy as np - from src.cvx.bson import read_bson, write_bson - from src.cvx.json import read_json, write_json + from cvx.bson import read_bson, write_bson + from cvx.json import read_json, write_json return np, read_bson, read_json, write_bson, write_json From a76ffb24df1b41935843678afced5f283390a8dc Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Fri, 10 Jan 2025 07:47:03 +0400 Subject: [PATCH 10/13] move to src folder? --- .github/workflows/book.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index 0c358f6f..e833dde9 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -22,6 +22,7 @@ jobs: - uses: cvxgrp/.github/actions/uv/coverage@v2.0.1 with: source-folder: 'src/cvx' + tests-folder: 'src/tests' jupyter: runs-on: "ubuntu-latest" @@ -52,4 +53,4 @@ jobs: - name: Checkout [${{ github.repository }}] uses: actions/checkout@v4 - - uses: cvxgrp/.github/actions/book@v2.0.0 + - uses: cvxgrp/.github/actions/book@v2.0.2 From e37b7d916f010a15283857cf512e3b433a9bd3ec Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Fri, 10 Jan 2025 07:49:03 +0400 Subject: [PATCH 11/13] move to src folder? --- .github/workflows/book.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index e833dde9..565b4c4c 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -19,7 +19,7 @@ jobs: - name: Checkout [${{ github.repository }}] uses: actions/checkout@v4 - - uses: cvxgrp/.github/actions/uv/coverage@v2.0.1 + - uses: cvxgrp/.github/actions/uv/coverage@v2.0.2 with: source-folder: 'src/cvx' tests-folder: 'src/tests' From d277b4136d1df374381dd2b7545a5d95e49649dd Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Fri, 10 Jan 2025 07:50:09 +0400 Subject: [PATCH 12/13] move to src folder? --- src/cvx/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/cvx/__init__.py diff --git a/src/cvx/__init__.py b/src/cvx/__init__.py deleted file mode 100644 index e69de29b..00000000 From 375fe11027d9202a24d2f1a0b4a793c8e2d07ea9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 03:50:21 +0000 Subject: [PATCH 13/13] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/cvx/bson/file.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cvx/bson/file.py b/src/cvx/bson/file.py index 7110f830..5ea2747e 100644 --- a/src/cvx/bson/file.py +++ b/src/cvx/bson/file.py @@ -20,13 +20,14 @@ from os import PathLike from typing import Any, Dict, Union -import bson import numpy.typing as npt import pandas as pd # see https://github.com/microsoft/pylance-release/issues/2019 from typing_extensions import TypeAlias +import bson + from .io import decode, encode FILE = Union[str, bytes, PathLike]