Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset version and use version from metadata #48

Merged
merged 3 commits into from
May 23, 2024
Merged
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
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__}"
)
madeddie marked this conversation as resolved.
Show resolved Hide resolved
parser.add_argument("--username", help="tmc.mooc.fi username")
parser.add_argument("--password", help="tmc.mooc.fi password")
parser.add_argument(
Expand Down