Skip to content

Commit a892e0e

Browse files
authored
Merge pull request #91 from polis-community/dependency-extras
Allow installing only core dependencies
2 parents 021a55f + 7f5a495 commit a892e0e

22 files changed

Lines changed: 216 additions & 42 deletions

.github/workflows/pkg-install-test.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ on:
99
jobs:
1010
install-test:
1111
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
install-method:
15+
- "."
16+
- ".[plots]"
17+
- ".[alt-algos]"
18+
- ".[all]"
1219

1320
steps:
1421
- name: Check out repository
@@ -22,7 +29,7 @@ jobs:
2229
- name: Install dependencies
2330
run: |
2431
python -m pip install --upgrade pip
25-
pip install --no-cache-dir .
32+
pip install ${{ matrix.install-method }}
2633
2734
- name: Verify installation
2835
run: python -c "import reddwarf"

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ jobs:
4040
**/uv.lock
4141
cache-suffix: python-${{ matrix.python-version }}
4242

43+
- name: Create virtual environment
44+
run: make venv
45+
4346
- name: Install dependencies
4447
run: make install-dev
4548

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
- Rename `projected_{participants,statements}` to `{participant,statement}_projections` in run_pipeline results. Also coords keyed to ID, instead of dataframes.
3030
- Remove agora implementation and tests. ([#73](https://github.com/polis-community/red-dwarf/issues/74))
3131
- Migrate from reference HDBSCAN module (in `scikit-learn`) to full-featured HDBSCAN* package.
32+
- Add dependency groups to avoid installing everything. ([#11](https://github.com/polis-community/red-dwarf/issues/11))
3233

3334
### Fixes
3435

@@ -38,6 +39,7 @@
3839
- Only pass unique labels into `generate_figure()` colorbar.
3940
- bugfix: `clusterer_kwargs` and `reducer_kwargs` were not being pass through `run_pipeline()`.
4041
- bugfix: Ensure `run_pipeline()` passes `random_state` to reducer.
42+
- bugfix: Fix overly constrained versions from [#80](https://github.com/polis-community/red-dwarf/issues/80).
4143

4244
### Chores
4345

Makefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
TEST_FILTER ?= .
22

3-
install: ## Install production dependencies
4-
uv pip install --editable .
3+
venv: ## Make a virtualenv
4+
uv venv
55

6-
install-dev: ## Install development dependencies
7-
uv sync --extra dev
6+
install: ## Install only production dependencies
7+
uv pip install --editable .[all]
8+
9+
install-dev: ## Install production with development dependencies
10+
uv pip install --editable .[all,dev]
811

912
docs-build: ## Build the static docs ./site directory
1013
uv run mkdocs build

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,24 @@ Are you or your organization eager to see more platforms and community built aro
5353

5454
## Usage
5555

56+
```
57+
# OFFICIAL RELEASES
58+
59+
# For core, the classic polis pipeline: PCA + K-means
60+
# (~60MB beyond scikit-learn disk space)
61+
pip install red-dwarf
62+
63+
# For additional algorithms beyond classic polis: PaCMAP, LocalMAP, HDBSCAN, etc.
64+
pip install red-dwarf[alt-algos]
65+
66+
# For additional packages for visualizing plots
67+
pip install red-dwarf[plots]
68+
69+
# For everything (~60MB beyond core packages)
70+
pip install red-dwarf[all]
71+
# pip install red-dwarf[alt-algos,plots]
72+
```
73+
5674
See [`docs/notebooks/polis-implementation-demo.ipynb`][notebook] or [`docs/notebooks/`][notebooks] for other examples.
5775

5876

@@ -82,7 +100,7 @@ This is the generalized pipeline of Polis-like processes that we're aiming to ac
82100

83101
- Install python (preferrably virtual environment)
84102
- Install uv (python package manager) (e.g. `pip install uv`)
85-
- Install dependencies with `make install` (or `make install-dev`)
103+
- Install dependencies with `make install-dev`
86104
- Run `make` command alone to see other helpful make subcommands
87105
- Alternatively, run one of the ipynb notebooks; possibly replacing the install command at the top with `%pip install -e ../../` to use the local source instead.
88106

docs/notebooks/alternative-algorithms.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
}
5757
],
5858
"source": [
59-
"%pip install --quiet git+https://github.com/polis-community/red-dwarf.git@main"
59+
"%pip install --quiet red-dwarf[all]@git+https://github.com/polis-community/red-dwarf.git@main"
6060
]
6161
},
6262
{
@@ -397,4 +397,4 @@
397397
]
398398
}
399399
]
400-
}
400+
}

docs/notebooks/dump-downloaded-polis-data.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
}
3838
],
3939
"source": [
40-
"%pip install --quiet --no-cache-dir git+https://github.com/polis-community/red-dwarf.git@main"
40+
"%pip install --quiet red-dwarf[all]@git+https://github.com/polis-community/red-dwarf.git@main"
4141
]
4242
},
4343
{

docs/notebooks/dup-votes.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
}
4141
],
4242
"source": [
43-
"%pip install --quiet --no-cache-dir git+https://github.com/polis-community/red-dwarf.git@main"
43+
"%pip install --quiet red-dwarf[all]@git+https://github.com/polis-community/red-dwarf.git@main"
4444
]
4545
},
4646
{

docs/notebooks/heatmap.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
}
3838
],
3939
"source": [
40-
"%pip install --quiet --no-cache-dir git+https://github.com/polis-community/red-dwarf.git@main"
40+
"%pip install --quiet red-dwarf[all]@git+https://github.com/polis-community/red-dwarf.git@main"
4141
]
4242
},
4343
{

docs/notebooks/loading-data.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
}
5454
],
5555
"source": [
56-
"%pip install --quiet git+https://github.com/polis-community/red-dwarf.git@main"
56+
"%pip install --quiet red-dwarf[all]@git+https://github.com/polis-community/red-dwarf.git@main"
5757
]
5858
},
5959
{

0 commit comments

Comments
 (0)