Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
34 changes: 15 additions & 19 deletions .github/workflows/autorelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,37 @@ jobs:
name: Check version and create release
runs-on: ubuntu-latest
outputs:
tag_exists: ${{ steps.check_tag.outputs.exists }}
release_created: ${{ steps.check_tag.outputs.exists }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
fetch-depth: 0 # Fetch all history and tags

- name: Get current version
id: get_version
run: |
VERSION=$(python - <<'PY'
import tomllib

with open("pyproject.toml", "rb") as f:
print(tomllib.load(f)["project"]["version"])
PY
VERSION=$(python -c "
with open('src/VisualizePhonon/__init__.py') as f:
for line in f:
if '__version__' in line:
print(line.split('=')[1].strip().strip('\"\''))
break
"
)
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Check if tag exists
id: check_tag
run: |
TAG_NAME="v${{ env.VERSION }}"
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
echo "Tag $TAG_NAME already exists. Skipping release."
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "Tag $TAG_NAME does not exist. A new release will be created."
echo "exists=false" >> "$GITHUB_OUTPUT"
echo "exists=false" >> $GITHUB_OUTPUT
fi

- name: Create GitHub Release
Expand All @@ -65,7 +61,7 @@ jobs:
publish:
name: Build & Publish to PyPI
needs: autorelease
if: needs.autorelease.outputs.tag_exists == 'false'
if: needs.autorelease.outputs.release_created == 'false'
runs-on: ubuntu-latest
environment:
name: pypi
Expand All @@ -77,7 +73,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: "3.10"

- name: Install build dependencies
run: pip install build
Expand Down
11 changes: 7 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ CLIで指定できる出力形式は`xsf`、`xyz`、`asy`です。
LaTeX出力を作る例。
- `mode_*`ファイルの多くは可視化の生成物です。明示的にexample出力の更新を
求められていない限り、sourceではなく生成物として扱ってください。
- `pyproject.toml`: package metadata、console script、pytest設定、Black/isort設定。
- `setup.py`: 最小限のsetuptools shim。
- `pyproject.toml`: package metadata、hatchling build設定、console script、
pytest設定、Black/isort設定。
- `setup.py`: legacyの最小shim。通常のbuild/installは`pyproject.toml`の
hatchling設定を使います。
- `README.md`: install方法、CLI usage、citation、関連ツール。

## 主要データフロー
Expand Down Expand Up @@ -83,8 +85,9 @@ vaspvis generate -i test/OUTCAR -f xsf -m 0 -s 1

- codeは`ase`に依存します。parser/exporterやCIを触る場合は、`pyproject.toml`の
dependencyとworkflowのinstall手順を同期させてください。
- `pyproject.toml`のversionは`0.0.2`、`src/VisualizePhonon/__init__.py`の
`__version__`は`0.1.0`で不一致です。
- versionは`cellify`と同じく`src/VisualizePhonon/__init__.py`の`__version__`を
source of truthにしています。`pyproject.toml`はhatchling dynamic versionで
同じ値を読み、autorelease workflowも対応する`v<version>` tagを確認します。
- `cmdline.py`の`--scale`は`float`です。README例のように`1.0`を受け取れます。
- `vibrational_analysis.py`と`vibrational_analysis_io.py`の両方にXSF writer logic
があります。出力形式を変える場合は挙動をそろえてください。
Expand Down
20 changes: 9 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build-system]
requires = ["setuptools>=42", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "VisualizePhonon"
version = "0.0.2"
dynamic = ["version"]
description = "A tool for analyzing vibrational modes from VASP OUTCAR files"
readme = "README.md"
authors = [
Expand Down Expand Up @@ -38,14 +38,6 @@ vesta = [
"pymatgen>=2022.0.0",
]

[tool.setuptools]
package-dir = {"" = "src"}
# packages = [""]
license-files = []

# [tool.setuptools.packages.find]
# where = ["src"]

[tool.pytest.ini_options]
testpaths = ["test"]
python_files = "test_*.py"
Expand All @@ -60,3 +52,9 @@ line_length = 88

[project.scripts]
vaspvis = "VisualizePhonon.cmdline:main"

[tool.hatch.build.targets.wheel]
packages = ["src/VisualizePhonon"]

[tool.hatch.version]
path = "src/VisualizePhonon/__init__.py"
2 changes: 1 addition & 1 deletion src/VisualizePhonon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- Export vibration modes to VESTA format
"""

__version__ = "0.1.0"
__version__ = "0.0.2"

from VisualizePhonon.vibrational_analysis import VibrationalMode, VibrationAnalysis
__all__ = ["VibrationalMode", "VibrationAnalysis"]
Loading