Skip to content

Commit

Permalink
Setup versioning only for releases (#46)
Browse files Browse the repository at this point in the history
Default to 0.0.0 in the codebase, and then let the CD set the correct version on release.
  • Loading branch information
alan-cooney authored Jan 10, 2023
1 parent f80525e commit 62b451c
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 60 deletions.
33 changes: 0 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,39 +87,6 @@ jobs:
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}

commit-version-updates:
name: Bump Python & Node package versions
needs:
- semver-parser
- release-react
- release-python
runs-on: ubuntu-latest
permissions:
actions: write
contents: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Install Poetry
uses: snok/install-poetry@v1
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'poetry'
- name: Bump Python package version
run: poetry version ${{needs.semver-parser.outputs.semver}}
working-directory: python
- name: Bump Node package version
run: yarn version --new-version ${{needs.semver-parser.outputs.semver}} --no-git-tag-version --no-commit-hooks
working-directory: react
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4.16.0
with:
commit_message: Release version ${{needs.semver-parser.outputs.semver}}
branch: main

publish-storybook:
name: Publish docs to GitHub Pages
environment:
Expand Down
4 changes: 2 additions & 2 deletions python/circuitsvis/tests/snapshots/snap_test_activations.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

snapshots['TestTextNeuronActivations.test_multi_matches_snapshot 1'] = '''<div id="circuits-vis-mock" style="margin: 15px 0;"/>
<script crossorigin type="module">
import { render, TextNeuronActivations } from "https://unpkg.com/circuitsvis@1.0.0/dist/cdn/esm.js";
import { render, TextNeuronActivations } from "https://unpkg.com/circuitsvis@0.0.0/dist/cdn/esm.js";
render(
"circuits-vis-mock",
TextNeuronActivations,
Expand All @@ -19,7 +19,7 @@

snapshots['TestTextNeuronActivations.test_single_matches_snapshot 1'] = '''<div id="circuits-vis-mock" style="margin: 15px 0;"/>
<script crossorigin type="module">
import { render, TextNeuronActivations } from "https://unpkg.com/circuitsvis@1.0.0/dist/cdn/esm.js";
import { render, TextNeuronActivations } from "https://unpkg.com/circuitsvis@0.0.0/dist/cdn/esm.js";
render(
"circuits-vis-mock",
TextNeuronActivations,
Expand Down
2 changes: 1 addition & 1 deletion python/circuitsvis/tests/snapshots/snap_test_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

snapshots['TestAttention.test_matches_snapshot 1'] = '''<div id="circuits-vis-mock" style="margin: 15px 0;"/>
<script crossorigin type="module">
import { render, AttentionPatterns } from "https://unpkg.com/circuitsvis@1.0.0/dist/cdn/esm.js";
import { render, AttentionPatterns } from "https://unpkg.com/circuitsvis@0.0.0/dist/cdn/esm.js";
render(
"circuits-vis-mock",
AttentionPatterns,
Expand Down
2 changes: 1 addition & 1 deletion python/circuitsvis/tests/snapshots/snap_test_hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

snapshots['TestHello.test_matches_snapshot 1'] = '''<div id="circuits-vis-mock" style="margin: 15px 0;"/>
<script crossorigin type="module">
import { render, Hello } from "https://unpkg.com/circuitsvis@1.0.0/dist/cdn/esm.js";
import { render, Hello } from "https://unpkg.com/circuitsvis@0.0.0/dist/cdn/esm.js";
render(
"circuits-vis-mock",
Hello,
Expand Down
2 changes: 1 addition & 1 deletion python/circuitsvis/tests/snapshots/snap_test_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

snapshots['TestTokens.test_matches_snapshot 1'] = '''<div id="circuits-vis-mock" style="margin: 15px 0;"/>
<script crossorigin type="module">
import { render, ColoredTokens } from "https://unpkg.com/circuitsvis@1.0.0/dist/cdn/esm.js";
import { render, ColoredTokens } from "https://unpkg.com/circuitsvis@0.0.0/dist/cdn/esm.js";
render(
"circuits-vis-mock",
ColoredTokens,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

snapshots['TestTopkSamples.test_matches_snapshot 1'] = '''<div id="circuits-vis-mock" style="margin: 15px 0;"/>
<script crossorigin type="module">
import { render, TopkSamples } from "https://unpkg.com/circuitsvis@1.0.0/dist/cdn/esm.js";
import { render, TopkSamples } from "https://unpkg.com/circuitsvis@0.0.0/dist/cdn/esm.js";
render(
"circuits-vis-mock",
TopkSamples,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

snapshots['TestTopkTokens.test_matches_snapshot 1'] = '''<div id="circuits-vis-mock" style="margin: 15px 0;"/>
<script crossorigin type="module">
import { render, TopkTokens } from "https://unpkg.com/circuitsvis@1.0.0/dist/cdn/esm.js";
import { render, TopkTokens } from "https://unpkg.com/circuitsvis@0.0.0/dist/cdn/esm.js";
render(
"circuits-vis-mock",
TopkTokens,
Expand Down
2 changes: 0 additions & 2 deletions python/circuitsvis/tests/test_activations.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
class TestTextNeuronActivations:
def test_single_matches_snapshot(self, snapshot, monkeypatch):
monkeypatch.setattr(circuitsvis.utils.render, "uuid4", lambda: "mock")
monkeypatch.setattr(circuitsvis, "__version__", "1.0.0")

res = text_neuron_activations(
tokens=["a", "b"],
Expand All @@ -18,7 +17,6 @@ def test_single_matches_snapshot(self, snapshot, monkeypatch):

def test_multi_matches_snapshot(self, snapshot, monkeypatch):
monkeypatch.setattr(circuitsvis.utils.render, "uuid4", lambda: "mock")
monkeypatch.setattr(circuitsvis, "__version__", "1.0.0")

res = text_neuron_activations(
tokens=[["a", "b"], ["c", "d", "e"]],
Expand Down
1 change: 0 additions & 1 deletion python/circuitsvis/tests/test_attention.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
class TestAttention:
def test_matches_snapshot(self, snapshot, monkeypatch):
monkeypatch.setattr(circuitsvis.utils.render, "uuid4", lambda: "mock")
monkeypatch.setattr(circuitsvis, "__version__", "1.0.0")

res = attention_patterns(
tokens=["a", "b"],
Expand Down
1 change: 0 additions & 1 deletion python/circuitsvis/tests/test_hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
class TestHello:
def test_matches_snapshot(self, snapshot, monkeypatch):
monkeypatch.setattr(circuitsvis.utils.render, "uuid4", lambda: "mock")
monkeypatch.setattr(circuitsvis, "__version__", "1.0.0")

res = hello(name="Bob")
snapshot.assert_match(str(res))
1 change: 0 additions & 1 deletion python/circuitsvis/tests/test_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
class TestTokens:
def test_matches_snapshot(self, snapshot, monkeypatch):
monkeypatch.setattr(circuitsvis.utils.render, "uuid4", lambda: "mock")
monkeypatch.setattr(circuitsvis, "__version__", "1.0.0")

res = colored_tokens(tokens=["a", "b"], values=[1, 2])
snapshot.assert_match(str(res))
2 changes: 0 additions & 2 deletions python/circuitsvis/tests/test_topk_samples.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
from circuitsvis.topk_samples import topk_samples
import circuitsvis.utils.render
import numpy as np


class TestTopkSamples:
def test_matches_snapshot(self, snapshot, monkeypatch):
# Monkeypatch uuid4 to always return the same uuid
monkeypatch.setattr(circuitsvis.utils.render, "uuid4", lambda: "mock")
monkeypatch.setattr(circuitsvis, "__version__", "1.0.0")
tokens = [
[
["And", " here"],
Expand Down
1 change: 0 additions & 1 deletion python/circuitsvis/tests/test_topk_tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class TestTopkTokens:
def test_matches_snapshot(self, snapshot, monkeypatch):
# Monkeypatch uuid4 to always return the same uuid
monkeypatch.setattr(circuitsvis.utils.render, "uuid4", lambda: "mock")
monkeypatch.setattr(circuitsvis, "__version__", "1.0.0")
res = topk_tokens(
tokens=[["a", "b", "c", "d", "e"], ["f", "g", "h"]],
activations=[
Expand Down
20 changes: 10 additions & 10 deletions python/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "circuitsvis"
version = "1.37.0"
version = "0.0.0" # This is updated by the CI/CD pipeline
description = "Mechanistic Interpretability Visualizations"
authors = ["Alan Cooney <41682961+alan-cooney@users.noreply.github.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion react/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "circuitsvis",
"description": "Mechanistic Interpretability Visualizations",
"version": "1.37.0",
"version": "0.0.0",
"main": "dist/commonjs/index.js",
"module": "dist/module/index.js",
"unpkg": "dist/cdn/iife.js",
Expand Down

0 comments on commit 62b451c

Please sign in to comment.