Skip to content

Commit f604299

Browse files
authored
Merge pull request #121 from anthonyduong9/make-changes-to-publish-to-PyPI
makes changes to publish to PyPI
2 parents d57e44c + e90c0e6 commit f604299

File tree

12 files changed

+137
-37
lines changed

12 files changed

+137
-37
lines changed

.github/workflows/build.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: build
2+
3+
env:
4+
HF_HUB_DOWNLOAD_TIMEOUT: 100
5+
6+
on:
7+
push:
8+
branches:
9+
- main
10+
pull_request:
11+
branches:
12+
- main
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.10"
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install -e ".[dev,visualize]"
25+
- name: Run tests
26+
run: pytest
27+
- name: Type Checking
28+
uses: jakebailey/pyright-action@v1
29+
with:
30+
version: 1.1.378
31+
- name: build
32+
run: pip wheel --no-deps -w dist .
33+
release:
34+
needs: build
35+
permissions:
36+
contents: write
37+
id-token: write
38+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):')
39+
runs-on: ubuntu-latest
40+
concurrency: release
41+
steps:
42+
- uses: actions/checkout@v4
43+
with:
44+
fetch-depth: 0
45+
- uses: actions/setup-python@v5
46+
with:
47+
python-version: "3.10"
48+
- name: Install dependencies
49+
run: pip install build twine
50+
- name: Semantic Release
51+
id: release
52+
uses: python-semantic-release/[email protected]
53+
with:
54+
github_token: ${{ secrets.GITHUB_TOKEN }}
55+
- name: Build package
56+
run: python -m build
57+
if: steps.release.outputs.released == 'true'
58+
- name: Publish package distributions to PyPI
59+
uses: pypa/gh-action-pypi-publish@release/v1
60+
if: steps.release.outputs.released == 'true'
61+
- name: Publish package distributions to GitHub Releases
62+
uses: python-semantic-release/publish-action@main
63+
if: steps.release.outputs.released == 'true'
64+
with:
65+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yml

-34
This file was deleted.

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ latents/*
88
results/*
99
extras/*
1010
temp/*
11-
tests/*
1211
saved*
1312
.nfs*
1413

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,9 @@ pytest .
278278

279279
Run an end-to-end test:
280280

281-
```python -m delphi.tests.e2e```
281+
```python -m tests.e2e```
282+
283+
We use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) for releases.
282284

283285
## License
284286

__init__.py

Whitespace-only changes.

delphi/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.2.0"

pyproject.toml

+68-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = ["setuptools"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
6-
name = "delphi"
6+
name = "eai-delphi"
77
version = "0.2.0"
88
description = "Automated Interpretability"
99
readme = "README.md"
@@ -60,3 +60,70 @@ line-length = 88
6060
# Enable pycodestyle (`E`), Pyflakes (`F`), and isort (`I`) codes
6161
# See https://beta.ruff.rs/docs/rules/ for more possible rules
6262
select = ["E", "F", "I"]
63+
64+
[tool.semantic_release]
65+
version_variables = ["delphi/__init__.py:__version__"]
66+
version_toml = ["pyproject.toml:project.version"]
67+
assets = []
68+
build_command_env = []
69+
commit_message = "{version}\n\nAutomatically generated by python-semantic-release"
70+
commit_parser = "conventional"
71+
logging_use_named_masks = false
72+
major_on_zero = true
73+
allow_zero_version = true
74+
no_git_verify = false
75+
tag_format = "v{version}"
76+
77+
[tool.semantic_release.branches.main]
78+
match = "(main|master)"
79+
prerelease_token = "rc"
80+
prerelease = false
81+
82+
[tool.semantic_release.changelog]
83+
changelog_file = "CHANGELOG.md"
84+
exclude_commit_patterns = []
85+
mode = "init"
86+
insertion_flag = "<!-- version list -->"
87+
template_dir = "templates"
88+
89+
[tool.semantic_release.changelog.default_templates]
90+
changelog_file = "CHANGELOG.md"
91+
output_format = "md"
92+
mask_initial_release = false
93+
94+
[tool.semantic_release.changelog.environment]
95+
block_start_string = "{%"
96+
block_end_string = "%}"
97+
variable_start_string = "{{"
98+
variable_end_string = "}}"
99+
comment_start_string = "{#"
100+
comment_end_string = "#}"
101+
trim_blocks = false
102+
lstrip_blocks = false
103+
newline_sequence = "\n"
104+
keep_trailing_newline = false
105+
extensions = []
106+
autoescape = false
107+
108+
[tool.semantic_release.commit_author]
109+
env = "GIT_COMMIT_AUTHOR"
110+
default = "semantic-release <semantic-release>"
111+
112+
[tool.semantic_release.commit_parser_options]
113+
minor_tags = ["feat"]
114+
patch_tags = ["fix", "perf"]
115+
other_allowed_tags = ["build", "chore", "ci", "docs", "style", "refactor", "test"]
116+
allowed_tags = ["feat", "fix", "perf", "build", "chore", "ci", "docs", "style", "refactor", "test"]
117+
default_bump_level = 0
118+
parse_squash_commits = false
119+
ignore_merge_commits = false
120+
121+
[tool.semantic_release.remote]
122+
name = "origin"
123+
type = "github"
124+
ignore_token_for_push = false
125+
insecure = false
126+
127+
[tool.semantic_release.publish]
128+
dist_glob_patterns = ["dist/*"]
129+
upload_to_vcs_release = true

tests/__init__.py

Whitespace-only changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)