From 503ea22522a5863fcf70efaa468468d81aed1e67 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Fri, 12 Jul 2024 09:11:56 -0400 Subject: [PATCH 1/5] Convert to src style package from flat --- MANIFEST.in | 6 +++--- pyproject.toml | 3 --- setup.py | 4 ++-- {ripser => src/ripser}/__init__.py | 0 {ripser => src/ripser}/_version.py | 0 {ripser => src/ripser}/pyRips.pxd | 0 {ripser => src/ripser}/pyRipser.pyx | 0 {ripser => src/ripser}/ripser.cpp | 0 {ripser => src/ripser}/ripser.h | 0 {ripser => src/ripser}/ripser.py | 0 10 files changed, 5 insertions(+), 8 deletions(-) rename {ripser => src/ripser}/__init__.py (100%) rename {ripser => src/ripser}/_version.py (100%) rename {ripser => src/ripser}/pyRips.pxd (100%) rename {ripser => src/ripser}/pyRipser.pyx (100%) rename {ripser => src/ripser}/ripser.cpp (100%) rename {ripser => src/ripser}/ripser.h (100%) rename {ripser => src/ripser}/ripser.py (100%) diff --git a/MANIFEST.in b/MANIFEST.in index 69907f2..f2199ec 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,5 @@ include *.txt include *.md -include ripser/pyRips.pxd -include ripser/ripser.cpp -include ripser/pyRipser.pyx +include src/ripser/pyRips.pxd +include src/ripser/ripser.cpp +include src/ripser/pyRipser.pyx diff --git a/pyproject.toml b/pyproject.toml index ea9a8d9..0159013 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,9 +47,6 @@ docs = ["sktda_docs_config"] examples = ["tadasets", "jupyter", "pillow"] -[tool.setuptools.packages.find] -where = ["ripser"] - [project.urls] Homepage = "https://ripser.scikit-tda.org" Documentation = "https://ripser.scikit-tda.org" diff --git a/setup.py b/setup.py index 1d75635..5e51fe5 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ def get_version(): - VERSIONFILE = "ripser/_version.py" + VERSIONFILE = "src/ripser/_version.py" verstrline = open(VERSIONFILE, "rt").read() VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]" mo = re.search(VSRE, verstrline, re.M) @@ -81,7 +81,7 @@ def run(self): ext_modules = Extension( "pyRipser", - sources=["ripser/pyRipser.pyx"], + sources=["src/ripser/pyRipser.pyx"], define_macros=macros, extra_compile_args=extra_compile_args, extra_link_args=extra_link_args, diff --git a/ripser/__init__.py b/src/ripser/__init__.py similarity index 100% rename from ripser/__init__.py rename to src/ripser/__init__.py diff --git a/ripser/_version.py b/src/ripser/_version.py similarity index 100% rename from ripser/_version.py rename to src/ripser/_version.py diff --git a/ripser/pyRips.pxd b/src/ripser/pyRips.pxd similarity index 100% rename from ripser/pyRips.pxd rename to src/ripser/pyRips.pxd diff --git a/ripser/pyRipser.pyx b/src/ripser/pyRipser.pyx similarity index 100% rename from ripser/pyRipser.pyx rename to src/ripser/pyRipser.pyx diff --git a/ripser/ripser.cpp b/src/ripser/ripser.cpp similarity index 100% rename from ripser/ripser.cpp rename to src/ripser/ripser.cpp diff --git a/ripser/ripser.h b/src/ripser/ripser.h similarity index 100% rename from ripser/ripser.h rename to src/ripser/ripser.h diff --git a/ripser/ripser.py b/src/ripser/ripser.py similarity index 100% rename from ripser/ripser.py rename to src/ripser/ripser.py From d4fcc3aa96ac36aa9b68c48886a8ca45a173e5d8 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Fri, 12 Jul 2024 09:52:05 -0400 Subject: [PATCH 2/5] Update robinhood path for src structure --- .github/workflows/build_and_deploy.yml | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 216aef8..b436a67 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -20,7 +20,7 @@ jobs: - name: Clone robinhood run: | - git clone https://github.com/martinus/robin-hood-hashing ripser/robinhood + git clone https://github.com/martinus/robin-hood-hashing robinhood - name: Build wheels uses: pypa/cibuildwheel@v2.19.2 @@ -41,7 +41,7 @@ jobs: - name: Clone robinhood run: | - git clone https://github.com/martinus/robin-hood-hashing ripser/robinhood + git clone https://github.com/martinus/robin-hood-hashing robinhood - name: Build sdist run: pipx run build --sdist diff --git a/setup.py b/setup.py index 5e51fe5..3621869 100644 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ def run(self): macros = [("USE_COEFFICIENTS", 1), ("NDEBUG", 1), ("ASSEMBLE_REDUCTION_MATRIX", 1)] # Robinhood -robinhood_path = os.path.join("ripser", "robinhood") +robinhood_path = os.path.join("robinhood") if os.path.isdir(robinhood_path): print( "\nFound local copy of robinhood! Using robinhood for ripser.py compilation.\n" From 1c81ae56ea02aec9e9561c071ced0b6d422e757f Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Fri, 12 Jul 2024 10:39:25 -0400 Subject: [PATCH 3/5] Bump version, modify changelog --- CHANGELOG.md | 5 +++++ src/ripser/_version.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fb420d..5bf36ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.6.9 + + - Convert package to `src` style. + - Fix build command not including python source files. + # 0.6.8 - Update CD commands for newer build system. diff --git a/src/ripser/_version.py b/src/ripser/_version.py index 5c2c6c5..54149df 100644 --- a/src/ripser/_version.py +++ b/src/ripser/_version.py @@ -1 +1 @@ -__version__ = "0.6.9" +__version__ = "0.6.10" From b64bd6385881f526c102f576016bc165de23efc7 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Fri, 12 Jul 2024 11:24:33 -0400 Subject: [PATCH 4/5] Update robinhood instructions in README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a09be72..e0488c0 100644 --- a/README.md +++ b/README.md @@ -60,16 +60,16 @@ To be able to use `robin_hood` instead of STL, you only need to clone the reposi ``` # Run this command at the root of the project -git clone https://github.com/martinus/robin-hood-hashing ripser/robinhood +git clone https://github.com/martinus/robin-hood-hashing robinhood ``` After cloning robinhood with the above command, install `ripser.py` with ``` -pip install -v -e . +pip install -v . ``` -This will install a local, editable version of `ripser.py` with verbose output. In the verbose output, +This will install a local version of `ripser.py` with verbose output. In the verbose output, you will see confirmation that robinhood was found or not. 1 The Python package is already compiled with `robin_hood` by default. From 2f65eb38811aa6241bec57c03bdec10e4ff8878c Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Fri, 12 Jul 2024 11:31:20 -0400 Subject: [PATCH 5/5] Update README --- README.md | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e0488c0..1df4abc 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,15 @@ If you're looking for a GPU-accelerated version of Ripser, you can find it at [R ## Setup -Ripser.py is available on all major platforms. All that is required is that you install the standard Python numerical computing libraries and Cython. +Ripser.py is available on `pypi` with wheels for all major platforms. To install, type the following command into your environment: + +```bash +pip install python +``` +### Local build + +If the above command fails, you can build `ripser.py` locally. All that is required is that you +install the standard Python numerical computing libraries and Cython. Dependencies: @@ -47,12 +55,12 @@ Cython should be the only library required before installation. To install, type ``` pip install cython -pip install ripser ``` -If you are having trouble installing, please let us know! +Following this, clone the repository, `cd` into the clone, and execute `pip install -v .` -## Optional dependency + +#### Optional dependency Ripser.py when compiled from source can have a _steroid_1 shot by replacing the standard `unordered_map` from the STL by one of the fastest implementation available: [robin_hood](https://github.com/martinus/robin-hood-hashing). Benchmarking of Ripser.py using the `robin_hood` implementation showed speed-ups up to **30%**. @@ -74,6 +82,8 @@ you will see confirmation that robinhood was found or not. 1 The Python package is already compiled with `robin_hood` by default. +If you are having trouble installing, please let us know! + ## Usage The interface is as simple as can be: