Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shirayu committed Oct 8, 2022
1 parent c8baed9 commit 77808b1
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 5 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

SHELL=/bin/bash

all: lint_node lint_python

TARGET_DIRS:=./whispering
Expand All @@ -16,7 +18,10 @@ yamllint:
find . \( -name node_modules -o -name .venv \) -prune -o -type f -name '*.yml' -print \
| xargs yamllint --no-warnings

lint_python: flake8 black isort pydocstyle
version_check:
git tag | python ./scripts/check_version.py --toml pyproject.toml -i README.md --tags /dev/stdin

lint_python: flake8 black isort pydocstyle version_check


pyright:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Enough machine power is needed to transcribe in real time.
## Setup

```bash
pip install -U git+https://github.com/shirayu/whispering.git
pip install -U git+https://github.com/shirayu/whispering.git@v0.5.0

# If you use GPU, install proper torch and torchaudio
# Check https://pytorch.org/get-started/locally/
Expand Down
14 changes: 13 additions & 1 deletion poetry.lock

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

17 changes: 15 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
[misc]
stable_version = "0.5.0"

[tool.poetry]
name = "whispering"
version = "0.1.0"
description = ""
version = "0.5.0"
description = "Streaming transcriber with whisper"
license = "MIT"
authors = ["Yuta Hayashibe <[email protected]>"]
readme = "README.md"
repository = "https://github.com/shirayu/whispering.git"
packages = [{include = "whispering"}]

[tool.poetry.dependencies]
Expand All @@ -22,6 +27,7 @@ black = ">=22.8.0"
isort = ">=5.10.1"
flake8 = ">=5.0.4"
pydocstyle = ">=6.1.1"
toml = "^0.10.2"

[build-system]
requires = ["poetry-core"]
Expand All @@ -30,3 +36,10 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry.scripts]
whispering = "whispering.cli:main"

[tool.pyright]
pythonVersion = "3.8"
typeCheckingMode = "basic"
exclude = [".venv", "**/node_modules", "**/__pycache__",]
reportPrivateImportUsage = "information"
reportUnusedVariable="warning"

60 changes: 60 additions & 0 deletions scripts/check_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/usr/bin/env python3

import argparse
import sys
from pathlib import Path
from typing import Final, Tuple

import toml


def get_stable_version(obj) -> str:
stable_version: Final[str] = obj["misc"]["stable_version"]
return f"v{stable_version}"


def check_version(path_in: Path, path_pyproject_toml: Path) -> Tuple[bool, str]:
with path_pyproject_toml.open() as f:
obj = toml.load(f)
stable_version: Final[str] = get_stable_version(obj)
repository: Final[str] = obj["tool"]["poetry"]["repository"]
cmd: Final[str] = f"pip install -U git+{repository}@{stable_version}"

with path_in.open() as f:
for line in f:
if line.strip() == cmd:
return True, stable_version

sys.stderr.write(f"The following command not found in {path_in}: {cmd}\n")
return False, stable_version


def get_opts() -> argparse.Namespace:
oparser = argparse.ArgumentParser()
oparser.add_argument("--input", "-i", type=Path)
oparser.add_argument("--toml", "-t", type=Path, required=True)
oparser.add_argument("--tags", type=Path)
return oparser.parse_args()


def main() -> None:
opts = get_opts()

assert opts.input is not None
ok, stable_version = check_version(opts.input, opts.toml)
if not ok:
sys.exit(1)

if opts.tags:
tags = []
with opts.tags.open() as f:
for line in f:
tags.append(line[:-1])

if stable_version not in tags:
sys.stderr.write(f"Tag {stable_version} not in git tags: {tags}\n")
sys.exit(1)


if __name__ == "__main__":
main()

0 comments on commit 77808b1

Please sign in to comment.