From d9eddd08e221c6dec84b3c5a42a7979712f6d61d Mon Sep 17 00:00:00 2001 From: Kafonek Date: Thu, 3 Nov 2022 09:15:59 -0400 Subject: [PATCH 01/15] package management with hatch --- Cargo.toml | 3 --- README.md | 16 +++++++--------- pyproject.toml | 14 ++++++++++++++ setup.cfg | 2 -- setup.py | 3 --- 5 files changed, 21 insertions(+), 17 deletions(-) delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/Cargo.toml b/Cargo.toml index cace70a..c6e256f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,10 +2,7 @@ name = "y-py" version = "0.5.4" rust-version = "1.58" -authors = ["John Waidhofer ", "Kevin Jahns ", "Pierre-Olivier Simonard "] edition = "2018" -homepage = "https://github.com/y-crdt/ypy" -repository = "https://github.com/y-crdt/ypy" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/README.md b/README.md index 43b4bd5..99a7c43 100644 --- a/README.md +++ b/README.md @@ -39,22 +39,20 @@ assert value == "hello world!" ## Development Setup -0. Install Rust and Python -1. Install `maturin` in order to build Ypy - +0. [Install Rust](https://www.rust-lang.org/tools/install) and [Python](https://www.python.org/downloads/) (consider [pyenv](https://github.com/pyenv/pyenv)) +1. Install [hatch](https://hatch.pypa.io/1.2/install/) (`python -m pip install hatch`) +2. Create a development build of the library + ``` -pip install maturin +python -m hatch run maturin develop ``` -2. Create a development build of the library - `maturin develop` - ## Tests All tests are located in `/tests`. You can run them with `pytest`. ``` -pytest +python -m hatch run maturin develop ``` ## Build Ypy : @@ -62,5 +60,5 @@ pytest Build the library as a wheel and store them in `target/wheels` : ``` -maturin build +python -m hatch run maturin build ``` diff --git a/pyproject.toml b/pyproject.toml index 5d44682..7d73e43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,17 @@ [build-system] requires = ["maturin>=0.13,<0.14"] build-backend = "maturin" + +[project] +name = "y-py" +version = "0.5.4" +description = "Python bindings for the Y-CRDT built from yrs (Rust)" +authors = [ + { name = "John Waidofer", email = "waidhoferj@gmail.com" }, + { name = "Kevin Jahns", email = "kevin.jahns@protonmail.com" }, + { name = "Pierre-Olivier Simonard", email = "pierre.olivier.simonard@gmail.com" } +] +readme = "README.md" +homepage = "https://github.com/y-crdt/ypy" +repository = "https://github.com/y-crdt/ypy" +dependencies = ["pytest", "maturin"] \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 8183238..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -license_files = LICENSE diff --git a/setup.py b/setup.py deleted file mode 100644 index b908cbe..0000000 --- a/setup.py +++ /dev/null @@ -1,3 +0,0 @@ -import setuptools - -setuptools.setup() From c97bcc7906fbbd91878f34c5da21bc7449362fef Mon Sep 17 00:00:00 2001 From: Kafonek Date: Thu, 3 Nov 2022 09:34:08 -0400 Subject: [PATCH 02/15] fix copy/paste typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 99a7c43..b610f8b 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ python -m hatch run maturin develop All tests are located in `/tests`. You can run them with `pytest`. ``` -python -m hatch run maturin develop +python -m hatch run pytest ``` ## Build Ypy : From ab88b3cabf82d07d4fe8b451a10645fe3607e786 Mon Sep 17 00:00:00 2001 From: Kafonek Date: Thu, 3 Nov 2022 10:18:43 -0400 Subject: [PATCH 03/15] fix typo on John's name --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7d73e43..d10019f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "y-py" version = "0.5.4" description = "Python bindings for the Y-CRDT built from yrs (Rust)" authors = [ - { name = "John Waidofer", email = "waidhoferj@gmail.com" }, + { name = "John Waidhofer", email = "waidhoferj@gmail.com" }, { name = "Kevin Jahns", email = "kevin.jahns@protonmail.com" }, { name = "Pierre-Olivier Simonard", email = "pierre.olivier.simonard@gmail.com" } ] From 5ecf93c37b4fcca7268535b3829298580d83ab76 Mon Sep 17 00:00:00 2001 From: Matt Kafonek Date: Thu, 3 Nov 2022 10:50:58 -0400 Subject: [PATCH 04/15] Update README.md Co-authored-by: David Brochart --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b610f8b..294910a 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ assert value == "hello world!" ## Development Setup 0. [Install Rust](https://www.rust-lang.org/tools/install) and [Python](https://www.python.org/downloads/) (consider [pyenv](https://github.com/pyenv/pyenv)) -1. Install [hatch](https://hatch.pypa.io/1.2/install/) (`python -m pip install hatch`) +1. Install [hatch](https://hatch.pypa.io/latest/install/) (`python -m pip install hatch`) 2. Create a development build of the library ``` From 5b35ac303a95aaef41d72775e9501ca3296af315 Mon Sep 17 00:00:00 2001 From: Kafonek Date: Thu, 3 Nov 2022 10:57:24 -0400 Subject: [PATCH 05/15] alternative bootstrapping options for python/rust --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 294910a..32eb302 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,8 @@ assert value == "hello world!" ## Development Setup -0. [Install Rust](https://www.rust-lang.org/tools/install) and [Python](https://www.python.org/downloads/) (consider [pyenv](https://github.com/pyenv/pyenv)) +0. [Install Rust](https://www.rust-lang.org/tools/install) and [Python](https://www.python.org/downloads/) + - Some alternative bootstrapping options are [pyenv](https://github.com/pyenv/pyenv) for Python and using [conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) to [conda install rust](https://anaconda.org/conda-forge/rust) 1. Install [hatch](https://hatch.pypa.io/latest/install/) (`python -m pip install hatch`) 2. Create a development build of the library From 50bee5386cc30b125e25565693c7f44e3f422b9a Mon Sep 17 00:00:00 2001 From: Matt Kafonek Date: Thu, 3 Nov 2022 10:58:24 -0400 Subject: [PATCH 06/15] Update README.md Co-authored-by: David Brochart --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 32eb302..0450f27 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,8 @@ assert value == "hello world!" - Some alternative bootstrapping options are [pyenv](https://github.com/pyenv/pyenv) for Python and using [conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) to [conda install rust](https://anaconda.org/conda-forge/rust) 1. Install [hatch](https://hatch.pypa.io/latest/install/) (`python -m pip install hatch`) 2. Create a development build of the library - + +Make sure to `unset CONDA_PREFIX` if you are in a conda environment. ``` python -m hatch run maturin develop ``` From 74a51fe16f2676c5d22abbb0be5035492759961f Mon Sep 17 00:00:00 2001 From: Kafonek Date: Thu, 3 Nov 2022 11:03:11 -0400 Subject: [PATCH 07/15] use 'hatch' alone in examples, with caveat if not found on PATH --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0450f27..67b5b94 100644 --- a/README.md +++ b/README.md @@ -44,9 +44,9 @@ assert value == "hello world!" 1. Install [hatch](https://hatch.pypa.io/latest/install/) (`python -m pip install hatch`) 2. Create a development build of the library -Make sure to `unset CONDA_PREFIX` if you are in a conda environment. +*Make sure to `unset CONDA_PREFIX` if you are in a conda environment. If `hatch` is not found on your PATH, you can run `python -m hatch` instead* ``` -python -m hatch run maturin develop +hatch run maturin develop ``` ## Tests @@ -54,7 +54,7 @@ python -m hatch run maturin develop All tests are located in `/tests`. You can run them with `pytest`. ``` -python -m hatch run pytest +hatch run pytest ``` ## Build Ypy : @@ -62,5 +62,5 @@ python -m hatch run pytest Build the library as a wheel and store them in `target/wheels` : ``` -python -m hatch run maturin build +hatch run maturin build ``` From 8af19b5a1e17f65d7afc13b8c7b160403a10b0cd Mon Sep 17 00:00:00 2001 From: Matt Kafonek Date: Thu, 3 Nov 2022 11:16:23 -0400 Subject: [PATCH 08/15] Update README.md Co-authored-by: David Brochart --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 67b5b94..c48aa56 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ assert value == "hello world!" ## Development Setup 0. [Install Rust](https://www.rust-lang.org/tools/install) and [Python](https://www.python.org/downloads/) - - Some alternative bootstrapping options are [pyenv](https://github.com/pyenv/pyenv) for Python and using [conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) to [conda install rust](https://anaconda.org/conda-forge/rust) + - Some alternative bootstrapping options are [pyenv](https://github.com/pyenv/pyenv) for Python and using [mamba](https://github.com/conda-forge/miniforge) to [mamba install rust](https://github.com/conda-forge/rust-feedstock) 1. Install [hatch](https://hatch.pypa.io/latest/install/) (`python -m pip install hatch`) 2. Create a development build of the library From fa1788063d5e070520b4574716b84a6eb6317a41 Mon Sep 17 00:00:00 2001 From: Matt Kafonek Date: Thu, 3 Nov 2022 11:45:56 -0400 Subject: [PATCH 09/15] Update README.md Co-authored-by: David Brochart --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c48aa56..a9ec302 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ assert value == "hello world!" ## Development Setup 0. [Install Rust](https://www.rust-lang.org/tools/install) and [Python](https://www.python.org/downloads/) - - Some alternative bootstrapping options are [pyenv](https://github.com/pyenv/pyenv) for Python and using [mamba](https://github.com/conda-forge/miniforge) to [mamba install rust](https://github.com/conda-forge/rust-feedstock) + - Some alternative bootstrapping options are [pyenv](https://github.com/pyenv/pyenv) for Python, or using [mamba](https://github.com/conda-forge/miniforge) to `mamba install rust python`. 1. Install [hatch](https://hatch.pypa.io/latest/install/) (`python -m pip install hatch`) 2. Create a development build of the library From 5e9492860af421eb5a0c7ff3d757db7efa4c265e Mon Sep 17 00:00:00 2001 From: Kafonek Date: Sat, 5 Nov 2022 14:23:57 -0400 Subject: [PATCH 10/15] add test env with matrix of python versions --- README.md | 6 +++--- pyproject.toml | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a9ec302..708c960 100644 --- a/README.md +++ b/README.md @@ -51,15 +51,15 @@ hatch run maturin develop ## Tests -All tests are located in `/tests`. You can run them with `pytest`. +All tests are located in `/tests`. There is a `test` environment matrix defined in `pyproject.toml` that will run `pytest` against `py37` through `py310`. ``` -hatch run pytest +hatch run test:pytest ``` ## Build Ypy : -Build the library as a wheel and store them in `target/wheels` : +Build the library as a wheel and store them in `target/wheels`: ``` hatch run maturin build diff --git a/pyproject.toml b/pyproject.toml index d10019f..9b60758 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,4 +14,7 @@ authors = [ readme = "README.md" homepage = "https://github.com/y-crdt/ypy" repository = "https://github.com/y-crdt/ypy" -dependencies = ["pytest", "maturin"] \ No newline at end of file +dependencies = ["pytest", "maturin"] + +[[tool.hatch.envs.test.matrix]] +python = ["37", "38", "39", "310"] \ No newline at end of file From 5040782916d01c750e12810873210dfccc75fd42 Mon Sep 17 00:00:00 2001 From: Kafonek Date: Sat, 5 Nov 2022 14:24:09 -0400 Subject: [PATCH 11/15] update ci/cd tests to use hatch --- .github/workflows/test.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf9ad2e..942e0c8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,11 +34,12 @@ jobs: toolchain: stable profile: minimal default: true + - name: Install Hatch + run: | + pip install hatch - name: Build Ypy run: | - pip install maturin - maturin develop + hatch run maturin develop - name: Run Tests run: | - pip install pytest - pytest + hatch run pytest From 88790120fbec0afbc1b846a3bca537e66d8af36a Mon Sep 17 00:00:00 2001 From: Kafonek Date: Sat, 5 Nov 2022 14:59:48 -0400 Subject: [PATCH 12/15] unset CONDA_PREFIX before building with maturin --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 942e0c8..80ef27d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,6 +39,7 @@ jobs: pip install hatch - name: Build Ypy run: | + unset CONDA_PREFIX hatch run maturin develop - name: Run Tests run: | From 019697768b9e29233d3bac5dbd0597f8a05e914c Mon Sep 17 00:00:00 2001 From: Matt Kafonek Date: Mon, 7 Nov 2022 07:16:27 -0500 Subject: [PATCH 13/15] Update pyproject.toml Co-authored-by: David Brochart --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9b60758..ad53ec7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,4 +17,4 @@ repository = "https://github.com/y-crdt/ypy" dependencies = ["pytest", "maturin"] [[tool.hatch.envs.test.matrix]] -python = ["37", "38", "39", "310"] \ No newline at end of file +python = ["37", "38", "39", "310", "311"] \ No newline at end of file From 1decca591dc9f62ca0bdb4aa3d8a9d0b1170b644 Mon Sep 17 00:00:00 2001 From: Kafonek Date: Mon, 7 Nov 2022 07:20:04 -0500 Subject: [PATCH 14/15] update readme to reflect tests through py3.11 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 708c960..8ded142 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ hatch run maturin develop ## Tests -All tests are located in `/tests`. There is a `test` environment matrix defined in `pyproject.toml` that will run `pytest` against `py37` through `py310`. +All tests are located in `/tests`. There is a `test` environment matrix defined in `pyproject.toml` that will run `pytest` against `py37` through `py311`. ``` hatch run test:pytest From e26484c7306ad54e0fe4b43f74890e571773b21b Mon Sep 17 00:00:00 2001 From: waidhoferj Date: Mon, 7 Nov 2022 13:14:57 -0800 Subject: [PATCH 15/15] reverted install directions to use `pip` instead of `hatch` --- README.md | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8ded142..7b614d8 100644 --- a/README.md +++ b/README.md @@ -39,22 +39,17 @@ assert value == "hello world!" ## Development Setup -0. [Install Rust](https://www.rust-lang.org/tools/install) and [Python](https://www.python.org/downloads/) - - Some alternative bootstrapping options are [pyenv](https://github.com/pyenv/pyenv) for Python, or using [mamba](https://github.com/conda-forge/miniforge) to `mamba install rust python`. -1. Install [hatch](https://hatch.pypa.io/latest/install/) (`python -m pip install hatch`) -2. Create a development build of the library - -*Make sure to `unset CONDA_PREFIX` if you are in a conda environment. If `hatch` is not found on your PATH, you can run `python -m hatch` instead* -``` -hatch run maturin develop -``` +0. Install [Rust](https://www.rust-lang.org/tools/install) and [Python](https://www.python.org/downloads/) +1. Install `maturin` in order to build Ypy: `pip install maturin` +2. Create a development build of the library: `maturin develop` ## Tests -All tests are located in `/tests`. There is a `test` environment matrix defined in `pyproject.toml` that will run `pytest` against `py37` through `py311`. +All tests are located in `/tests`. If you are using `hatch`, there is a `test` environment matrix defined in `pyproject.toml` that will run `pytest` against `py37` through `py311`. To run the tests, install `pytest` and run the command line tool from the project root: ``` -hatch run test:pytest +pip install pytest +pytest ``` ## Build Ypy : @@ -62,5 +57,5 @@ hatch run test:pytest Build the library as a wheel and store them in `target/wheels`: ``` -hatch run maturin build +maturin build ```