Skip to content

Commit

Permalink
Merge pull request #48 from madeddie/reset_version
Browse files Browse the repository at this point in the history
Reset version and use version from metadata
  • Loading branch information
madeddie authored May 23, 2024
2 parents 1f9acc9 + 1ee4a3e commit a1f79e5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "tyora"
version = "0.1.0"
version = "0.0.1"
description = "CLI to interact with the mooc.fi instance of CSES"
license = "MIT"
authors = [
Expand Down
8 changes: 8 additions & 0 deletions src/tyora/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import importlib.metadata
import json
import logging
from dataclasses import dataclass, field
Expand All @@ -15,6 +16,10 @@
from html2text import html2text

logger = logging.getLogger(name="tyora")
try:
__version__ = importlib.metadata.version("tyora")
except importlib.metadata.PackageNotFoundError:
__version__ = "unknown"


@dataclass
Expand Down Expand Up @@ -102,6 +107,9 @@ def http_request(

def parse_args(args: Optional[list[str]] = None) -> argparse.Namespace:
parser = argparse.ArgumentParser(description="Interact with mooc.fi CSES instance")
parser.add_argument(
"--version", action="version", version=f"%(prog)s {__version__}"
)
parser.add_argument("--username", help="tmc.mooc.fi username")
parser.add_argument("--password", help="tmc.mooc.fi password")
parser.add_argument(
Expand Down

0 comments on commit a1f79e5

Please sign in to comment.