diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..c659391b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,65 @@ +name: build + +env: + HF_HUB_DOWNLOAD_TIMEOUT: 100 + +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev,visualize]" + - name: Run tests + run: pytest + - name: Type Checking + uses: jakebailey/pyright-action@v1 + with: + version: 1.1.378 + - name: build + run: pip wheel --no-deps -w dist . + release: + needs: build + permissions: + contents: write + id-token: write + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):') + runs-on: ubuntu-latest + concurrency: release + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-python@v5 + with: + python-version: "3.10" + - name: Install dependencies + run: pip install build twine + - name: Semantic Release + id: release + uses: python-semantic-release/python-semantic-release@v9.19.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Build package + run: python -m build + if: steps.release.outputs.released == 'true' + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: steps.release.outputs.released == 'true' + - name: Publish package distributions to GitHub Releases + uses: python-semantic-release/publish-action@main + if: steps.release.outputs.released == 'true' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index bfc1c435..00000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Tests - -env: - HF_HUB_DOWNLOAD_TIMEOUT: 100 - -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v3 - with: - python-version: '3.10' - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install ".[dev,visualize]" - - - name: Run tests - run: pytest - - - name: Type Checking - uses: jakebailey/pyright-action@v1 - with: - version: 1.1.378 diff --git a/.gitignore b/.gitignore index 1fe6d66d..fe7bd9e1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,6 @@ latents/* results/* extras/* temp/* -tests/* saved* .nfs* diff --git a/README.md b/README.md index f82d1d89..debc22ac 100644 --- a/README.md +++ b/README.md @@ -278,7 +278,9 @@ pytest . Run an end-to-end test: -```python -m delphi.tests.e2e``` +```python -m tests.e2e``` + +We use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for releases. ## License diff --git a/__init__.py b/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/delphi/__init__.py b/delphi/__init__.py index e69de29b..d3ec452c 100644 --- a/delphi/__init__.py +++ b/delphi/__init__.py @@ -0,0 +1 @@ +__version__ = "0.2.0" diff --git a/pyproject.toml b/pyproject.toml index 120fbe90..53c74853 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools"] build-backend = "setuptools.build_meta" [project] -name = "delphi" +name = "eai-delphi" version = "0.2.0" description = "Automated Interpretability" readme = "README.md" @@ -60,3 +60,70 @@ line-length = 88 # Enable pycodestyle (`E`), Pyflakes (`F`), and isort (`I`) codes # See https://beta.ruff.rs/docs/rules/ for more possible rules select = ["E", "F", "I"] + +[tool.semantic_release] +version_variables = ["delphi/__init__.py:__version__"] +version_toml = ["pyproject.toml:project.version"] +assets = [] +build_command_env = [] +commit_message = "{version}\n\nAutomatically generated by python-semantic-release" +commit_parser = "conventional" +logging_use_named_masks = false +major_on_zero = true +allow_zero_version = true +no_git_verify = false +tag_format = "v{version}" + +[tool.semantic_release.branches.main] +match = "(main|master)" +prerelease_token = "rc" +prerelease = false + +[tool.semantic_release.changelog] +changelog_file = "CHANGELOG.md" +exclude_commit_patterns = [] +mode = "init" +insertion_flag = "" +template_dir = "templates" + +[tool.semantic_release.changelog.default_templates] +changelog_file = "CHANGELOG.md" +output_format = "md" +mask_initial_release = false + +[tool.semantic_release.changelog.environment] +block_start_string = "{%" +block_end_string = "%}" +variable_start_string = "{{" +variable_end_string = "}}" +comment_start_string = "{#" +comment_end_string = "#}" +trim_blocks = false +lstrip_blocks = false +newline_sequence = "\n" +keep_trailing_newline = false +extensions = [] +autoescape = false + +[tool.semantic_release.commit_author] +env = "GIT_COMMIT_AUTHOR" +default = "semantic-release " + +[tool.semantic_release.commit_parser_options] +minor_tags = ["feat"] +patch_tags = ["fix", "perf"] +other_allowed_tags = ["build", "chore", "ci", "docs", "style", "refactor", "test"] +allowed_tags = ["feat", "fix", "perf", "build", "chore", "ci", "docs", "style", "refactor", "test"] +default_bump_level = 0 +parse_squash_commits = false +ignore_merge_commits = false + +[tool.semantic_release.remote] +name = "origin" +type = "github" +ignore_token_for_push = false +insecure = false + +[tool.semantic_release.publish] +dist_glob_patterns = ["dist/*"] +upload_to_vcs_release = true diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/delphi/tests/conftest.py b/tests/conftest.py similarity index 100% rename from delphi/tests/conftest.py rename to tests/conftest.py diff --git a/delphi/tests/e2e.py b/tests/e2e.py similarity index 100% rename from delphi/tests/e2e.py rename to tests/e2e.py diff --git a/delphi/tests/test_autoencoders/test_sparse_coders.py b/tests/test_autoencoders/test_sparse_coders.py similarity index 100% rename from delphi/tests/test_autoencoders/test_sparse_coders.py rename to tests/test_autoencoders/test_sparse_coders.py diff --git a/delphi/tests/test_latents/test_cache.py b/tests/test_latents/test_cache.py similarity index 100% rename from delphi/tests/test_latents/test_cache.py rename to tests/test_latents/test_cache.py