Skip to content

Commit 33a787b

Browse files
committed
clean up, use pypa/gh-action-pypi-publish in CI
1 parent 59a8a50 commit 33a787b

File tree

2 files changed

+7
-24
lines changed

2 files changed

+7
-24
lines changed

.github/workflows/ci.yaml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,14 @@ jobs:
6464
python -m pip install --upgrade pip
6565
pip install flake8 pytest coveralls setuptools wheel twine
6666
pip install -e .
67+
- name: Build package
68+
run: python setup.py sdist bdist_wheel
6769
- name: Publish package
68-
env:
69-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
70-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
71-
run: |
72-
old_version=$(pip install cactice==random 2>&1 >/dev/null | sed 's|.*, \([^ ]*\)).*|\1|g' | head -n 1 | xargs)
73-
new_version=$(pip show cactice | sed 's|.*Version: \([^ ]*\).*|\1|g' | sed -n 2p)
74-
echo "$old_version"
75-
echo "$new_version"
76-
if ! [[ "$new_version" = "$old_version" ]]; then
77-
python setup.py sdist bdist_wheel
78-
python -m twine upload dist/*
79-
fi
70+
uses: pypa/gh-action-pypi-publish@release/v1
71+
with:
72+
user: ${{ secrets.PYPI_USERNAME }}
73+
password: ${{ secrets.PYPI_PASSWORD }}
74+
skip_existing: true
8075
- name: Slack success notification
8176
uses: rtCamp/action-slack-notify@v2
8277
env:

cactice/grids.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -594,18 +594,6 @@ def configurational_entropy(grid: np.ndarray, n_perms=100000, macrostate='edge_l
594594

595595
# return ln(W)
596596
return log(len([l for l in lengths if l == length]))
597-
598-
# compute proportion of total edge lengths equal to the original grid's total
599-
# prop = len([l for l in lengths if l == length]) / (len(lengths) + 1)
600-
# return prop
601-
602-
# if the grid is small enough that we enumerated all permutations, no need to rescale
603-
all_perms = (grid.shape[0] * grid.shape[1]) ** len(list(set(flatten([grid]))))
604-
if all_perms <= n_perms:
605-
return prop
606-
# otherwise, rescale the proportion from [0, n_permutations] to [0, n!] where n is the number of grid cells
607-
else:
608-
return prop / n_perms * factorial(grid.shape[0] * grid.shape[1])
609597
elif macrostate == 'kl_divergence':
610598
# TODO
611599
# dists = [undirected_bond_distribution([p]) for p in perms]

0 commit comments

Comments
 (0)