Commit ddeb2372 authored by one's avatar one
Browse files

[hytop] Add a github action for publishing

parent 81950065
name: Publish hytop to PyPI
on:
release:
types: [published]
permissions:
contents: read
jobs:
release-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Build release distributions
working-directory: projects/hytop
run: uv build
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: projects/hytop/dist/
pypi-publish:
runs-on: ubuntu-latest
needs:
- release-build
permissions:
# Required for Trusted Publishing (OIDC) - no PyPI token needed
# See: https://docs.pypi.org/trusted-publishers/
id-token: write
environment:
name: pypi
url: https://pypi.org/project/hytop/${{ github.event.release.tag_name }}
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
MIT License
Copyright (c) 2025 alephpiece
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
.PHONY: help setup format lint test clean bump
.PHONY: help setup format lint test clean bump build publish
help:
@echo "Available targets:"
......@@ -7,7 +7,9 @@ help:
@echo " make lint - Check code style and errors without modifying files (ruff)"
@echo " make test - Run all unit tests (pytest)"
@echo " make clean - Remove build caches and the virtual environment"
@echo " make bump part=X - Bump version (patch/minor/major or X.Y.Z)"
@echo " make bump part=X - Bump version (patch/minor/major or set X.Y.Z)"
@echo " make build - Build wheel and sdist into dist/"
@echo " make publish - Upload dist/ to PyPI (requires UV_PUBLISH_TOKEN)"
setup:
@echo ">> Initializing virtual environment and installing dependencies..."
......@@ -32,4 +34,10 @@ clean:
find src tests -type d -name "__pycache__" -delete
bump:
uv run hytop-bump $(part)
uv run python -m hytop._bump $(part)
build:
uv build
publish:
uv publish
......@@ -2,16 +2,23 @@
## Quick start
Use `uv` to run hytop:
uv:
```bash
uv run hytop --help
```
Run hytop directly:
pip:
```bash
source .venv/Scripts/activate
pip install .
hytop --help
```
pipx:
```bash
pipx install .
hytop --help
```
......
......@@ -5,14 +5,31 @@ build-backend = "hatchling.build"
[project]
name = "hytop"
dynamic = ["version"]
description = "hytop toolkit"
description = "Lightweight monitoring toolkit for Hygon DCU clusters"
readme = "README.md"
license = { text = "MIT" }
authors = [{ name = "alephpiece", email = "wangan.cs@gmail.com" }]
requires-python = ">=3.10"
dependencies = ["rich>=13", "typer>=0.12"]
dependencies = ["rich>=14", "typer>=0.23"]
keywords = ["monitoring", "gpu", "dcu", "hygon", "hytop"]
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Operating System :: POSIX :: Linux",
"Environment :: Console",
]
[project.urls]
Homepage = "https://github.com/alephpiece/hg-misc-tools"
Repository = "https://github.com/alephpiece/hg-misc-tools"
Issues = "https://github.com/alephpiece/hg-misc-tools/issues"
[project.scripts]
hytop = "hytop.main:main"
hytop-bump = "hytop._bump:main"
[dependency-groups]
dev = ["pytest>=8", "ruff>=0.15"]
......@@ -23,6 +40,9 @@ path = "src/hytop/__init__.py"
[tool.hatch.build.targets.wheel]
packages = ["src/hytop"]
[tool.hatch.build.targets.sdist]
exclude = ["tests/__pycache__", ".ruff_cache", ".pytest_cache"]
[tool.pytest.ini_options]
testpaths = ["tests"]
......@@ -34,8 +54,8 @@ src = ["src", "tests"]
[tool.ruff.lint]
select = [
"F", # pyflakes
"E",
"W", # pycodestyle
"E", # pycodestyle errors
"W", # pycodestyle warnings
"I", # isort
"UP", # pyupgrade
"B", # flake8-bugbear
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment