usmo 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
usmo-0.1.0/.gitignore ADDED
@@ -0,0 +1,137 @@
1
+ # Custom ignore
2
+ test.ipynb
3
+
4
+ # Byte-compiled / optimized / DLL files
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+ uv.lock
9
+
10
+ # C extensions
11
+ *.so
12
+
13
+ # Distribution / packaging
14
+ .Python
15
+ build/
16
+ develop-eggs/
17
+ dist/
18
+ downloads/
19
+ eggs/
20
+ .eggs/
21
+ lib/
22
+ lib64/
23
+ parts/
24
+ sdist/
25
+ var/
26
+ wheels/
27
+ share/python-wheels/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+ MANIFEST
32
+
33
+ # PyInstaller
34
+ # Usually these files are written by a python script from a template
35
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
+ *.manifest
37
+ *.spec
38
+
39
+ # Installer logs
40
+ pip-log.txt
41
+ pip-delete-this-directory.txt
42
+
43
+ # Unit test / coverage reports
44
+ htmlcov/
45
+ .tox/
46
+ .nox/
47
+ .coverage
48
+ .coverage.*
49
+ .cache
50
+ nosetests.xml
51
+ coverage.xml
52
+ *.cover
53
+ *.py,cover
54
+ .hypothesis/
55
+ .pytest_cache/
56
+ cover/
57
+
58
+ # Translations
59
+ *.mo
60
+ *.pot
61
+
62
+ # Django stuff:
63
+ *.log
64
+ local_settings.py
65
+ db.sqlite3
66
+ db.sqlite3-journal
67
+
68
+ # Flask stuff:
69
+ instance/
70
+ .webassets-cache
71
+
72
+ # Scrapy stuff:
73
+ .scrapy
74
+
75
+ # Sphinx documentation
76
+ docs/_build/
77
+
78
+ # PyBuilder
79
+ target/
80
+
81
+ # Jupyter Notebook
82
+ .ipynb_checkpoints
83
+
84
+ # IPython
85
+ profile_default/
86
+ ipython_config.py
87
+
88
+ # pyenv
89
+ .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case you do not want to do that, uncomment the following line to ignore it.
94
+ # Pipfile.lock
95
+
96
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
97
+ __pypackages__/
98
+
99
+ # Celery stuff
100
+ celerybeat-schedule
101
+ celerybeat.pid
102
+
103
+ # SageMath parsed files
104
+ *.sage.py
105
+
106
+ # Environments
107
+ .env
108
+ .venv
109
+ env/
110
+ venv/
111
+ ENV/
112
+ env.bak/
113
+ venv.bak/
114
+
115
+ # Spyder project settings
116
+ .spyderproject
117
+ .spyderworkspace
118
+
119
+ # Rope project settings
120
+ .ropeproject
121
+
122
+ # mkdocs documentation
123
+ /site
124
+
125
+ # mypy
126
+ .mypy_cache/
127
+ .dmypy.json
128
+ dmypy.json
129
+
130
+ # Pyre type checker
131
+ .pyre/
132
+
133
+ # pytype static type analyzer
134
+ .pytype/
135
+
136
+ # Cython debug symbols
137
+ cython_debug/
@@ -0,0 +1,43 @@
1
+ exclude: ".git"
2
+
3
+ repos:
4
+ - repo: https://github.com/astral-sh/ruff-pre-commit
5
+ rev: v0.9.3
6
+ hooks:
7
+ - id: ruff-format # formatter
8
+ types_or: [python, pyi, jupyter, toml]
9
+ - id: ruff # linter
10
+ types_or: [python, pyi, jupyter, toml]
11
+ args: [--fix, --show-fixes]
12
+
13
+ # - repo: https://github.com/pycqa/isort
14
+ # rev: 5.12.0
15
+ # hooks:
16
+ # - id: isort
17
+ # exclude: __init__.py
18
+ # args: ["--profile", "black"]
19
+
20
+ # - repo: https://github.com/RobertCraigie/pyright-python
21
+ # rev: v1.1.379
22
+ # hooks:
23
+ # - id: pyright
24
+ # language_version: python3.10
25
+ # additional_dependencies:
26
+ # [
27
+ # einops,
28
+ # pillow,
29
+ # tensorflow,
30
+ # torch,
31
+ # ]
32
+
33
+ - repo: https://github.com/pre-commit/pre-commit-hooks
34
+ rev: v4.5.0
35
+ hooks:
36
+ - id: check-added-large-files
37
+ - id: check-ast
38
+ - id: check-case-conflict
39
+ - id: check-merge-conflict
40
+ - id: check-toml
41
+ - id: check-yaml
42
+ - id: end-of-file-fixer
43
+ - id: trailing-whitespace
usmo-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.4
2
+ Name: usmo
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ Requires-Python: >=3.10
6
+ Requires-Dist: click>=8.2.1
7
+ Requires-Dist: requests>=2.32.4
8
+ Requires-Dist: rich>=14.0.0
usmo-0.1.0/README.md ADDED
File without changes
@@ -0,0 +1,17 @@
1
+ [project]
2
+ name = "usmo"
3
+ version = "0.1.0"
4
+ description = "Add your description here"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ dependencies = ["click>=8.2.1", "requests>=2.32.4", "rich>=14.0.0"]
8
+
9
+ [project.scripts]
10
+ usm = "usm.cli:cli"
11
+
12
+ [tool.uv]
13
+ package = true
14
+
15
+ [build-system]
16
+ requires = ["hatchling"]
17
+ build-backend = "hatchling.build"
File without changes
@@ -0,0 +1,66 @@
1
+ from pathlib import Path
2
+
3
+ import click
4
+ import rich
5
+
6
+ CACHE_DIR = Path.home() / ".cache" / "usm"
7
+ CACHE_SCRIPT_DIR = CACHE_DIR / "scripts"
8
+ RESOURCE_BASE_URL = "https://raw.githubusercontent.com/hspk/usm/main/"
9
+
10
+
11
+ def download_script(script_name: str) -> Path:
12
+ import requests
13
+
14
+ script_url = f"{RESOURCE_BASE_URL}{script_name}.sh"
15
+ rich.print(
16
+ f"[bold green]Downloading script:[/bold green] {script_name} from {script_url}"
17
+ )
18
+ response = requests.get(script_url)
19
+ if response.status_code == 200:
20
+ script_path = CACHE_SCRIPT_DIR / f"{script_name}.sh"
21
+ CACHE_SCRIPT_DIR.mkdir(parents=True, exist_ok=True)
22
+ with open(script_path, "wb") as file:
23
+ file.write(response.content)
24
+ script_path.chmod(script_path.stat().st_mode | 0o111)
25
+ return script_path
26
+ else:
27
+ raise Exception(
28
+ f"Failed to download script: {script_name}. Status code: {response.status_code}"
29
+ )
30
+
31
+
32
+ def get_script_path(script_name: str, download: bool = True) -> Path:
33
+ script_path = CACHE_SCRIPT_DIR / f"{script_name}.sh"
34
+ if download and not script_path.exists():
35
+ return download_script(script_name)
36
+ elif not script_path.exists():
37
+ raise FileNotFoundError(
38
+ f"Script {script_name} not found in cache. Please download it first."
39
+ )
40
+ return script_path
41
+
42
+
43
+ @click.command()
44
+ @click.argument("script", type=str, required=True)
45
+ @click.argument("args", nargs=-1, type=str)
46
+ @click.option("-h", "--help", is_flag=True, help="Show this message and exit.")
47
+ @click.option("-V", "--version", is_flag=True, help="Show the version and exit.")
48
+ def cli(script, args, help, version):
49
+ if help:
50
+ click.echo(cli.get_help(click.Context(cli)))
51
+ elif version:
52
+ click.echo("Version 1.0.0")
53
+
54
+ script_path = get_script_path(script)
55
+ import subprocess
56
+
57
+ command = ["bash", str(script_path)] + list(args)
58
+ try:
59
+ subprocess.run(command, check=True, text=True)
60
+ except Exception as e:
61
+ rich.print(f"[bold red]An error occurred:[/bold red] {str(e)}")
62
+ raise click.ClickException(str(e))
63
+
64
+
65
+ if __name__ == "__main__":
66
+ cli()