Skip to content
Merged

1.0.0 #470

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
259 commits
Select commit Hold shift + click to select a range
6c776ff
Update gerrychain/graph/graph.py
chief-dweeb Jan 15, 2026
8035e69
Update gerrychain/graph/graph.py
chief-dweeb Jan 15, 2026
cdd7977
Apply suggestions from code review
chief-dweeb Jan 15, 2026
3c74895
Merge pull request #435 from chief-dweeb/frm_rustworkx_post_alpha
peterrrock2 Jan 15, 2026
7ddb808
Added Peter's PR comments to codebase as TODO: comments.
Jan 16, 2026
de40d4c
Renamed tree.py biparition_tree.py and moved it into a new directory
Jan 16, 2026
15812df
Moved uniform_spanning_tree() and random_spanning_tree() into their o…
Jan 17, 2026
e4e385e
Huge refactoring of tree.py! It has been split into a couple of
Jan 19, 2026
1d07806
Documentation tweaks
Jan 20, 2026
6be065d
Update gerrychain/tree/bipartition_tree.py
chief-dweeb Jan 22, 2026
9b75206
Misc. changes responding to code review comments by Peter
Jan 25, 2026
bacb130
changes to comments only
Feb 20, 2026
6ea14fb
Manually made change Peter added to github branch
Feb 20, 2026
4263fe3
Merge remote-tracking branch 'origin/frm_rustworkx_post_alpha' into f…
Feb 20, 2026
356b228
Merge pull request #436 from chief-dweeb/frm_rustworkx_post_alpha
peterrrock2 Feb 20, 2026
5dfa2bd
Changes to documentation - mostly high level stuff
Feb 22, 2026
7d13afb
More documentation updates - mostly at the top level
Feb 22, 2026
237c242
Merge pull request #437 from chief-dweeb/frm_rustworkx_post_alpha
peterrrock2 Feb 25, 2026
d41e8e3
Merge pull request #438 from mggg/wip/rustworkx-migration
peterrrock2 Feb 27, 2026
70c86c3
Update documentation to google style for Args and Returns
peterrrock2 Feb 27, 2026
03492fa
Enable google style for sphinx
peterrrock2 Feb 27, 2026
96fdbcb
Some more reformatting of the doc strings to bring them more in line …
peterrrock2 Feb 27, 2026
828f50f
Bring types and formatted strings up to python 3.11+ standards
peterrrock2 Feb 27, 2026
d33860e
Remove some of the old sphinx stylings
peterrrock2 Feb 27, 2026
5375376
Merge pull request #439 from mggg/tech-debt/docstring-standardization
peterrrock2 Feb 27, 2026
a03a8da
More documentation changes
Feb 27, 2026
56f12c0
Merge remote-tracking branch 'upstream/wip/rustworkx-migration' into …
Feb 27, 2026
e815d31
Clean up - documentation changes, removing TODO comments, some actual…
Mar 5, 2026
fb11c7d
Cosmetic changes - mostly changed to documentation
Mar 6, 2026
9ae1ddb
More cleanup of TODO: Refactoring: issues, but also added a bunch of …
Mar 12, 2026
8c978d5
More clean-up edits - mostly related to TODO: comments
Mar 30, 2026
2730f60
Added a comment to help with code review
Mar 31, 2026
bf6a8bd
Changed _get_possible_edge_cuts_and_populated_graph() to fix test
Apr 7, 2026
148cc7b
Miscellaneous PR fixes, one bug fix in _get_possible_edge_cuts_and_po…
Apr 16, 2026
fad05f1
Misc. minor PR changes
Apr 16, 2026
ada94ff
Cleaned up the implementation of _bounded_find_balanced_edge_cuts_fn()
Apr 16, 2026
5820a42
More PR related changes.
Apr 17, 2026
90b859e
More PR related changes...
Apr 19, 2026
bf96957
Major change is a substantial rewrite of recom() to fix a bug in
Apr 24, 2026
b8a08c2
Initial version of file containing function signature differences fro…
Apr 27, 2026
635463a
Merge pull request #440 from chief-dweeb/frm_rustworkx_post_alpha
peterrrock2 Apr 29, 2026
6c5818d
Documentation updates - mostly removing "chatty" comments.
May 5, 2026
b20362a
Added a type definition (via a Protocol class) for ProposalFn
May 5, 2026
fd6dbe0
Changed "type" of MarkovChain __init__() proposal arg to be ProposalF…
May 5, 2026
aca51c8
Added ProposalFn (duck typing) as a way to make it clearer what a pro…
May 12, 2026
a066007
Finished updating changes to function signatures
May 14, 2026
e524ee0
Update gerrychain/graph/graph.py
chief-dweeb May 26, 2026
4f2d640
Update gerrychain/proposals/proposals.py
chief-dweeb May 26, 2026
5ed9470
Many changes to support use of ProposalFn Protocol - duck typing
May 26, 2026
9f3a650
Pull in changes made by Peter / PR
May 26, 2026
9428896
Removed a comment
May 26, 2026
f1a2970
Merge pull request #443 from chief-dweeb/frm_rustworkx_post_alpha
peterrrock2 Jun 4, 2026
455e41f
performance check -- remove the validate graph call
peterrrock2 Jun 9, 2026
78c45f5
performance getattribute -> getattr
peterrrock2 Jun 9, 2026
048c1dd
fast path for non-region aware
peterrrock2 Jun 9, 2026
6d94e8e
move validate to construction boundary and add way to config for main…
peterrrock2 Jun 9, 2026
55b219d
update the way that graph handles __getattr__ (address frm concern)
peterrrock2 Jun 10, 2026
cf19b24
address the is_directed() concern. Force undirected at construction.
peterrrock2 Jun 10, 2026
e4a70e0
devops fixup
peterrrock2 Jun 10, 2026
914c41e
update contiguity to use faster library functions
peterrrock2 Jun 10, 2026
249e797
update test suite
peterrrock2 Jun 10, 2026
7ce0821
update are_reachable to use BFS rather than Djikstra
peterrrock2 Jun 10, 2026
539fb22
Inline hlper in single_flip_contiguous and remove dead code
peterrrock2 Jun 10, 2026
3f2e9e9
Get rid of list constructer when it is not needed
peterrrock2 Jun 10, 2026
6bdb028
Add in benchmark suite
peterrrock2 Jun 10, 2026
0745b4b
condense graphs
peterrrock2 Jun 10, 2026
3785ab1
fix reproducibility test
peterrrock2 Jun 11, 2026
f553dec
add in jeanne idea about combining bfs
peterrrock2 Jun 11, 2026
c16b00b
add a way to test everything
peterrrock2 Jun 11, 2026
8523e4b
fix non-symmetric matrix bug in new normalized laplacian method
peterrrock2 Jun 11, 2026
a2735cd
remove usless flips function
peterrrock2 Jun 11, 2026
24d30fa
spell out difference between nodes and node_indices (likewise for edges)
peterrrock2 Jun 11, 2026
ad6d560
clarification on how partition[<key>] semantics work
peterrrock2 Jun 11, 2026
910c4ca
synchronize admin unit to 'region' for consistency
peterrrock2 Jun 11, 2026
34ba19f
update names to "build_<x>_proposal_fn"
peterrrock2 Jun 11, 2026
799e544
consistent naming on L^p metrics
peterrrock2 Jun 11, 2026
e1be8b5
Add module level doc string for partition
peterrrock2 Jun 11, 2026
882eb3b
incorporate gerrymandria example
peterrrock2 Jun 11, 2026
3f63145
add meaningful doc string to random_spanning_tree
peterrrock2 Jun 11, 2026
50b606b
documentation for flows
peterrrock2 Jun 11, 2026
108d9b4
update doc strings for from_json and to_json
peterrrock2 Jun 11, 2026
04dec9c
add wiring for the "treat_unassigned_as_single_region" -> super-user …
peterrrock2 Jun 12, 2026
6340460
Added some comments to proposals/proposals.py
Jun 12, 2026
514e5d9
review comments fixes
peterrrock2 Jun 15, 2026
535d732
Merge pull request #444 from mggg/opt/1p0p0-opt-pass
peterrrock2 Jun 17, 2026
bbd820c
add todo for checking passed graph is tree
peterrrock2 Jun 17, 2026
a71c732
Merge pull request #445 from mggg/opt/incorporate-jeanne-bfs-ideas
peterrrock2 Jun 17, 2026
e4cf1d8
Merge pull request #447 from mggg/bugfix/normalized-laplacian-matrix
peterrrock2 Jun 17, 2026
0972397
address frm comments
peterrrock2 Jun 17, 2026
f587e23
Merge pull request #448 from mggg/docs/standardize-wording-and-module…
peterrrock2 Jun 17, 2026
585a63e
Merge remote-tracking branch 'upstream/1.0.0' into frm_rustworkx_post…
Jun 17, 2026
c17e15c
This action removes comments that I had put in that say essentially
Jun 17, 2026
e1843f6
Working on the User Guide / Tutorial.
Jul 1, 2026
547c52f
Finished with first pass of edits for User Guide / Tutorial
Jul 2, 2026
5ece4a2
Some minor tweaks to the User Guide tutorial (rst files) and
Jul 3, 2026
21f4e0d
Minor edits to the User Guide / Tutorial. In particular, edits
Jul 3, 2026
9827a9d
Added a reasonable amount of text/content to the first section of
Jul 4, 2026
420ba92
make _rng.py and specify the MarkovChain ownership and the AcceptFn c…
peterrrock2 Jul 11, 2026
0b80ef4
Wire RNG through the main library
peterrrock2 Jul 11, 2026
60711f1
Wire RNG through optiziers
peterrrock2 Jul 11, 2026
88c186a
update tests for RNG
peterrrock2 Jul 11, 2026
4eb353e
update docs
peterrrock2 Jul 11, 2026
555c4eb
Fix the test I broke because I popped my stashes wrong
peterrrock2 Jul 11, 2026
c21986a
Fix typo in docs/user/data.rst
chief-dweeb Jul 11, 2026
22f5820
Update docs/user/data.rst
chief-dweeb Jul 11, 2026
c2f8448
Update docs/user/geometric_optimizers.rst - add logic to handle Censu…
chief-dweeb Jul 11, 2026
7a90ff2
Update docs/user/geometric_optimizers.rst - nicer code
chief-dweeb Jul 11, 2026
4e6cdc0
Update docs/user/intro.rst - better wording
chief-dweeb Jul 11, 2026
7e7f36b
Update docs/user/intro.rst - better wording
chief-dweeb Jul 11, 2026
c043ade
Update docs/user/intro.rst - better wording
chief-dweeb Jul 11, 2026
88f2fd1
Update docs/user/intro.rst - better wording
chief-dweeb Jul 11, 2026
4ad48f7
Update docs/user/intro.rst - better wording
chief-dweeb Jul 11, 2026
38dbe97
Update docs/user/intro.rst - better wording
chief-dweeb Jul 11, 2026
d9fe4f7
Update docs/user/intro.rst - better wording
chief-dweeb Jul 11, 2026
6a702ab
Update docs/user/intro.rst - better wording
chief-dweeb Jul 11, 2026
59af555
Update docs/user/intro.rst - better wording
chief-dweeb Jul 11, 2026
f0a6052
Update docs/user/intro.rst - better wording
chief-dweeb Jul 11, 2026
c9d0e04
Update docs/user/intro.rst - better wording
chief-dweeb Jul 11, 2026
413d002
Update docs/user/intro.rst - better wording
chief-dweeb Jul 11, 2026
533cfce
Update docs/user/intro.rst - better wording
chief-dweeb Jul 11, 2026
17ebc3b
Update docs/user/intro.rst - better wording
chief-dweeb Jul 11, 2026
52eb23a
Update docs/user/partitions.rst
chief-dweeb Jul 11, 2026
e649aa1
Merge pull request #449 from chief-dweeb/frm_rustworkx_post_alpha
peterrrock2 Jul 11, 2026
9263a15
Merge branch 'wip/rustworkx-migration' into feat/better-rng-handling
peterrrock2 Jul 11, 2026
dfe609e
Make tree samp deterministic (b/c strings) + redraw by default (node_…
peterrrock2 Jul 11, 2026
a8460e1
Fix up documentation assets (now seeded)
peterrrock2 Jul 11, 2026
8272bd7
Merge frm documentation edits in and make sure things are deterministic
peterrrock2 Jul 11, 2026
b010fd7
make sphinx less mad
peterrrock2 Jul 11, 2026
172c41c
Update all of the types and get them passing ty + pyright
peterrrock2 Jul 12, 2026
f6dafd7
fix small-subgraph issue found when porting and checking doc reproduc…
peterrrock2 Jul 12, 2026
5037822
Merge branch 'feat/better-rng-handling' into docs/migration-to-notebo…
peterrrock2 Jul 12, 2026
b05eb6d
Update docs style, build pipeline, and port notebook/snippet checks f…
peterrrock2 Jul 12, 2026
8b54419
migrate from RST files to IPYNB with MyST
peterrrock2 Jul 12, 2026
1a2b752
reprocibility: remove the PYTHONHASHSEED workaround
peterrrock2 Jul 12, 2026
c69062e
tweaks to the styles so that they all come out nicely
peterrrock2 Jul 13, 2026
5faa1ca
make the animations work correctly
peterrrock2 Jul 13, 2026
6f9e1ae
finalize the theming for the documentation
peterrrock2 Jul 13, 2026
309c168
PCompress -> BEN
peterrrock2 Jul 13, 2026
895440e
stub out v1.0.0 doc spots
peterrrock2 Jul 13, 2026
d5081db
one last docs links and tests update
peterrrock2 Jul 13, 2026
af3830a
wait to check links until later
peterrrock2 Jul 13, 2026
a6ec955
Fix max of empty list
campioru Jul 13, 2026
19529f0
Merge pull request #450 from mggg/feat/better-rng-handling
peterrrock2 Jul 14, 2026
cb67271
Merge pull request #451 from mggg/tech-debt/typing-updates
peterrrock2 Jul 14, 2026
3c2c983
Update contributing.md
peterrrock2 Jul 14, 2026
386be39
convert README from RST to MD
peterrrock2 Jul 14, 2026
b622885
Merge pull request #452 from mggg/docs/migration-to-notebook-derived-…
peterrrock2 Jul 14, 2026
77b50ff
Merge pull request #455 from mggg/wip/rustworkx-migration
peterrrock2 Jul 14, 2026
0c86558
Merge branch 'main' into 1.0.0 (need PR templates)
peterrrock2 Jul 14, 2026
d985c6a
Add regression tests
campioru Jul 14, 2026
c62e1a6
fix enormous output of ipynb
peterrrock2 Jul 14, 2026
5fb5b68
move to a dynamically rendered docs + caching strategy
peterrrock2 Jul 14, 2026
6deb324
make the recom namespace
peterrrock2 Jul 14, 2026
c8c160d
update tests
peterrrock2 Jul 14, 2026
6649a17
add builder equivalence tests
peterrrock2 Jul 14, 2026
21921d4
fix bug that appeared when re-running builder equivalence tests
peterrrock2 Jul 14, 2026
525a695
Update regression tests
campioru Jul 14, 2026
94fd370
Merge pull request #454 from campioru/max_empty_list
peterrrock2 Jul 14, 2026
e46aef5
move to allow users to build MarkovChain class rather than needing th…
peterrrock2 Jul 14, 2026
49ee111
Updated the Migration Guide for v1.0.0
Jul 17, 2026
02bf04d
add ConstraintFn type alias to slim down a couple of things
peterrrock2 Jul 14, 2026
4d870be
add_updater and add_constraint utility funcitons + tests
peterrrock2 Jul 18, 2026
b28c217
add in assignment vector semantics to partition
peterrrock2 Jul 14, 2026
f870e87
Update all callables to use the "_fn" suffix convention
peterrrock2 Jul 17, 2026
8c3baa9
Make the tests all pass the type checkers as well
peterrrock2 Jul 17, 2026
b35bec1
make proposal functions
peterrrock2 Jul 17, 2026
82f8710
add parallel validity checker for MM recom (for parallelism's sake)
peterrrock2 Jul 17, 2026
a1758b5
add mm recom tests
peterrrock2 Jul 17, 2026
a913731
update make it easy to regenerate assets
peterrrock2 Jul 18, 2026
ec722ca
add quick placeholder for mm docs
peterrrock2 Jul 18, 2026
f5a1336
add some quality of life stuff for MarkovChains and update recom.ipynb
peterrrock2 Jul 18, 2026
e44203b
one_sided_cut -> single_district_cut and finish docs for FindBalanced…
peterrrock2 Jul 19, 2026
2aced0e
refactor find_balanced_edge_cuts_memoization slightly
peterrrock2 Jul 19, 2026
4a34587
Quick README fix I noticed, and an update to .gitignore
peterrrock2 Jul 19, 2026
c9e2676
add a note about when epsilon is the issu for cutting things
peterrrock2 Jul 19, 2026
4e8d8ca
update install instructions
peterrrock2 Jul 19, 2026
0fa2fb6
Update documentation to use the builder pattern for MarkovChain insta…
peterrrock2 Jul 19, 2026
b7ccc7a
have format apply to the notebooks as well
peterrrock2 Jul 19, 2026
22e7f55
regenerate doc figures
peterrrock2 Jul 19, 2026
b2d9e0c
Merge pull request #456 from mggg/feat/recom-namespacing
peterrrock2 Jul 19, 2026
dc253ca
I forgot that I changed my dev env, and that caused issues. Put prote…
peterrrock2 Jul 19, 2026
dbce5df
version update
peterrrock2 Jul 19, 2026
300c4b8
Update rx_migration_guide.md
chief-dweeb Jul 22, 2026
c5e913e
Update rx_migration_guide.md
chief-dweeb Jul 22, 2026
9232f88
Update rx_migration_guide.md
chief-dweeb Jul 22, 2026
393b9a0
Update rx_migration_guide.md
chief-dweeb Jul 22, 2026
8864019
Update rx_migration_guide.md
chief-dweeb Jul 22, 2026
b3a8204
Merge pull request #457 from chief-dweeb/frm_rustworkx_post_alpha
peterrrock2 Jul 22, 2026
260714f
Merge pull request #458 from mggg/feat/builder-pattern-mc
peterrrock2 Jul 22, 2026
ea68d1c
Merge pull request #459 from mggg/misc/odds-and-ends-for-1p0p0
peterrrock2 Jul 22, 2026
2122723
Merge branch 'feat/builder-pattern-mc' into 1.0.0
peterrrock2 Jul 22, 2026
10b881e
Merge pull request #460 from mggg/tech-debt/finish-fixing-types
peterrrock2 Jul 22, 2026
a73f82e
Merge pull request #461 from mggg/feat/multi-member-recom
peterrrock2 Jul 22, 2026
6dd2a8a
Merge pull request #462 from mggg/misc/odds-and-ends-pt2
peterrrock2 Jul 22, 2026
41791ce
Merge branch 'wip/rustworkx-migration' into 1.0.0
peterrrock2 Jul 22, 2026
48f5d98
Merge pull request #463 from mggg/docs/update_venv_and_mc_usage
peterrrock2 Jul 22, 2026
6111b02
Documentation update to User Guide files.
Jul 27, 2026
3ed204f
Minor edits based on PR feedback
Jul 27, 2026
5f52492
Added migration guide contents
Jul 27, 2026
4038fbe
Merge pull request #464 from chief-dweeb/frm_rustworkx_post_alpha
peterrrock2 Jul 27, 2026
005fab5
add note about why we have _added_updaters
peterrrock2 Jul 28, 2026
a348590
small fixes to migration guide and toc stuff
peterrrock2 Jul 28, 2026
4226771
quick mdformat
peterrrock2 Jul 28, 2026
63a2992
nit: change "meth" to "attr" for links to things like `nodes` and `no…
peterrrock2 Jul 28, 2026
d3e2794
cleanup: remove dead test
peterrrock2 Jul 28, 2026
a3ea83c
fix gif regression
peterrrock2 Jul 28, 2026
d0fcf95
surcharge wording and a note on the animation controls
peterrrock2 Jul 28, 2026
56c0ee6
switch section headings to title case everywhere
peterrrock2 Jul 28, 2026
85e67fe
remove orphan migration guide
peterrrock2 Jul 28, 2026
10475ab
improve multi-member recom docs
peterrrock2 Jul 28, 2026
1b84d07
updates for ReCom and MultiMemberReCom
peterrrock2 Jul 28, 2026
1bd6aa9
add the hero gif to the generated assets
peterrrock2 Jul 29, 2026
6efae48
maybe improve the multi region recom demo
peterrrock2 Jul 29, 2026
741a2ca
add in page skip directive for migration guide
peterrrock2 Jul 29, 2026
f76cfee
formatting: dedent code blocks in migration guide
peterrrock2 Jul 29, 2026
9f87b1c
address Fred comments
peterrrock2 Jul 29, 2026
1b59b05
quick spell-check / capitalization / accidental repeates pass
peterrrock2 Jul 29, 2026
1b63745
quick grammar pass
peterrrock2 Jul 29, 2026
c777f36
Merge pull request #466 from mggg/docs/polish-round-1-1p0p0
peterrrock2 Jul 29, 2026
e4efc64
Added a new file, v1.0.0_changelog.md with what has been
Jul 29, 2026
64f4892
Merge remote-tracking branch 'upstream/wip/rustworkx-migration' into …
Jul 29, 2026
12b7be4
make deprecation wrappers
peterrrock2 Jul 30, 2026
74be098
decorate some changes with the deprecation marker
peterrrock2 Jul 30, 2026
2712c54
deprecated params and properties in updaters
peterrrock2 Jul 30, 2026
80f0583
adapt parameter and callables in partition
peterrrock2 Jul 30, 2026
9126771
add apapters in accept and chain
peterrrock2 Jul 30, 2026
06678d6
deprecation adapters in tree
peterrrock2 Jul 30, 2026
0dfe895
put back the L1 names
peterrrock2 Jul 30, 2026
2ec5516
add back in old public aliases
peterrrock2 Jul 30, 2026
c69bff6
tests for deprecations
peterrrock2 Jul 30, 2026
83a4283
add in deprecated properties that I missed
peterrrock2 Jul 30, 2026
52a86ad
following my own coding standards for doc strings
peterrrock2 Jul 30, 2026
5f69be0
Modified the change-log for v1.0 to mostly reformat and remove stuff.
Jul 30, 2026
b27717a
Updated documentation about Graph in graph/__init__.py
Jul 30, 2026
56eacf4
Merge pull request #468 from mggg/misc/add-deprecation-shims
peterrrock2 Jul 31, 2026
6d490e1
Apply suggestions from code review
chief-dweeb Jul 31, 2026
ac7ac74
Responded to PR comments and suggestions...
Jul 31, 2026
53e1e47
Reconciling commits in PR to local commits
Jul 31, 2026
e7e03f6
Minor updates based on PR feedback
Jul 31, 2026
b20aae2
Merge pull request #467 from chief-dweeb/frm_rustworkx_post_alpha
peterrrock2 Jul 31, 2026
627cf0a
Merge pull request #469 from mggg/wip/rustworkx-migration
peterrrock2 Jul 31, 2026
a896d21
final cleanup
peterrrock2 Aug 2, 2026
1e1e9f4
update changelog stuff
peterrrock2 Aug 2, 2026
d5917e7
packaging
peterrrock2 Aug 2, 2026
8a626da
small fixes to xfail
peterrrock2 Aug 2, 2026
a545da7
fixing todo stuff
peterrrock2 Aug 2, 2026
27018a2
package updates
peterrrock2 Aug 2, 2026
50278b9
color palette fixes
peterrrock2 Aug 2, 2026
aff8f95
publish workflow
peterrrock2 Aug 2, 2026
e1ab209
prep for test release
peterrrock2 Aug 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/docs-pr-check.yml

This file was deleted.

52 changes: 18 additions & 34 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,33 @@
name: "Publish Docs"
name: "Docs"

on:
pull_request:
push:
branches:
- main

jobs:
docs:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
# uv manages its own interpreter (UV_MANAGED_PYTHON=1 in the Makefile).
- name: Set up uv
uses: astral-sh/setup-uv@v4

- name: Build documentation with Makefile
env:
PYTHON_VERSION: "3.11"
run: |
uv python install "$PYTHON_VERSION"
make docs PYTHON_VERSION="$PYTHON_VERSION"
- name: Build docs (warnings are errors)
run: make docs

- name: Clone gh-pages branch
run: |
git clone --branch gh-pages --single-branch \
"https://github.com/${{ github.repository }}.git" gh-pages
rm -rf gh-pages/*
cp -r docs/_build/* gh-pages/
- name: Run documentation snippet tests
run: make docs-test

- name: Commit documentation changes
run: |
cd gh-pages
touch .nojekyll
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Update documentation" || echo "No changes to commit"
- name: Upload built site
uses: actions/upload-artifact@v4
with:
name: docs
path: docs/_build

- name: Push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd gh-pages
git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git" gh-pages
# ADD THIS BACK IN LATER -- SOME LINKS WILL NOT RESOLVE RIGHT NOW
# - name: Check external links
# run: make docs-linkcheck
188 changes: 188 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
name: Release GerryChain

on:
workflow_dispatch:
inputs:
tag:
description: Release tag, for example v1.0.0
type: string
required: true
upload_to:
description: Upload destination
type: choice
required: true
default: testpypi
options: [testpypi, pypi]

permissions:
contents: read

jobs:
build:
name: Build and test distributions
runs-on: ubuntu-latest
outputs:
version: ${{ steps.release.outputs.version }}
steps:
- name: Check out release tag
uses: actions/checkout@v7
with:
ref: ${{ inputs.tag }}
fetch-depth: 0

- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
version: "0.12.1"

- name: Install Python
run: uv python install 3.13

- name: Validate release tag
id: release
env:
RELEASE_TAG: ${{ inputs.tag }}
run: |
if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then
echo "Dispatch this workflow from the main branch, not $GITHUB_REF_NAME."
exit 1
fi
project_version="$(uv version --short)"
if [[ "$RELEASE_TAG" != "v$project_version" ]]; then
echo "Tag $RELEASE_TAG does not match project version $project_version."
exit 1
fi
if ! git show-ref --verify --quiet "refs/tags/$RELEASE_TAG"; then
echo "$RELEASE_TAG is not a tag in this repository."
exit 1
fi
git fetch --no-tags origin main
if ! git merge-base --is-ancestor HEAD origin/main; then
echo "The tagged commit is not on the main branch."
exit 1
fi
echo "version=$project_version" >> "$GITHUB_OUTPUT"
echo "RELEASE_VERSION=$project_version" >> "$GITHUB_ENV"

- name: Run tests
run: uv run --locked pytest

- name: Build distributions
run: uv build

- name: Smoke test wheel
run: >-
uv run --isolated --no-project --with dist/*.whl python -c
'import os; from importlib.metadata import version;
from gerrychain.examples import gerrymandria;
assert version("gerrychain") == os.environ["RELEASE_VERSION"];
assert len(gerrymandria().nodes) == 64'

- name: Smoke test source distribution
run: >-
uv run --isolated --no-project --with dist/*.tar.gz python -c
'import os; from importlib.metadata import version;
from gerrychain.examples import gerrymandria;
assert version("gerrychain") == os.environ["RELEASE_VERSION"];
assert len(gerrymandria().nodes) == 64'

- name: Upload distributions
uses: actions/upload-artifact@v7
with:
name: distributions
path: dist/
if-no-files-found: error

testpypi:
name: Publish and verify on TestPyPI
needs: build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/project/gerrychain/
permissions:
contents: read
id-token: write
env:
RELEASE_VERSION: ${{ needs.build.outputs.version }}
steps:
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
version: "0.12.1"

- name: Install Python
run: uv python install 3.13

- name: Download distributions
uses: actions/download-artifact@v8
with:
name: distributions
path: dist/

- name: Publish to TestPyPI
run: >-
uv publish --trusted-publishing always
--publish-url https://test.pypi.org/legacy/
--check-url https://test.pypi.org/simple/
dist/*

- name: Install dependencies from PyPI
run: |
uv venv --python 3.13 "$RUNNER_TEMP/testpypi-venv"
uv pip install --python "$RUNNER_TEMP/testpypi-venv/bin/python" dist/*.whl

- name: Install wheel from TestPyPI
run: |
for attempt in {1..10}; do
if uv pip install \
--python "$RUNNER_TEMP/testpypi-venv/bin/python" \
--reinstall-package gerrychain \
--no-deps \
--default-index https://test.pypi.org/simple/ \
"gerrychain==$RELEASE_VERSION"; then
exit 0
fi
if [[ "$attempt" == 10 ]]; then
echo "TestPyPI did not make gerrychain $RELEASE_VERSION available in time."
exit 1
fi
sleep 15
done

- name: Smoke test TestPyPI installation
run: >-
"$RUNNER_TEMP/testpypi-venv/bin/python" -c
'import os; from importlib.metadata import version;
from gerrychain.examples import gerrymandria;
assert version("gerrychain") == os.environ["RELEASE_VERSION"];
assert len(gerrymandria().nodes) == 64'

pypi:
name: Publish to PyPI
needs: [build, testpypi]
if: ${{ inputs.upload_to == 'pypi' }}
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/gerrychain/
permissions:
contents: read
id-token: write
steps:
- name: Install uv
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
version: "0.12.1"

- name: Download distributions
uses: actions/download-artifact@v8
with:
name: distributions
path: dist/

- name: Publish to PyPI
run: >-
uv publish --trusted-publishing always
--check-url https://pypi.org/simple/
dist/*
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ coverage.xml

# Sphinx documentation
docs/_build/
docs/_generated/
_build

# PyBuilder
Expand Down Expand Up @@ -87,3 +88,15 @@ TODO.md
# Environment items
.env
.envrc

# Profiling data
*.prof
docs/jupyter_execute/

# Sample data copied next to a tutorial so it can be run interactively from docs/user/.
# The committed copy lives in docs/_static/ and is staged automatically by
# docs/_refresh_notebooks.py, so this local duplicate must never be committed.
docs/user/PA_VTDs.json

# Written by docs/user/data.ipynb when it runs; not a source file.
docs/user/PA_output.jsonl
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
repos:
- repo: local
hooks:
- id: clear-notebook-outputs
name: Clear notebook outputs
entry: >-
uv run --no-default-groups --group docs-exec
python docs/_clear_notebook_outputs.py
language: system
files: ^docs/user/.*\.ipynb$
- id: make-format
name: Run `make check` (format + lint)
entry: make check
Expand Down
Loading
Loading