omadbek-git-sdk 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.
- omadbek_git_sdk-0.1.0/LICENSE +21 -0
- omadbek_git_sdk-0.1.0/PKG-INFO +63 -0
- omadbek_git_sdk-0.1.0/README.md +49 -0
- omadbek_git_sdk-0.1.0/pyproject.toml +20 -0
- omadbek_git_sdk-0.1.0/setup.cfg +4 -0
- omadbek_git_sdk-0.1.0/src/omadbek_git/__init__.py +3 -0
- omadbek_git_sdk-0.1.0/src/omadbek_git/cli.py +17 -0
- omadbek_git_sdk-0.1.0/src/omadbek_git/manager.py +60 -0
- omadbek_git_sdk-0.1.0/src/omadbek_git_sdk.egg-info/PKG-INFO +63 -0
- omadbek_git_sdk-0.1.0/src/omadbek_git_sdk.egg-info/SOURCES.txt +12 -0
- omadbek_git_sdk-0.1.0/src/omadbek_git_sdk.egg-info/dependency_links.txt +1 -0
- omadbek_git_sdk-0.1.0/src/omadbek_git_sdk.egg-info/entry_points.txt +2 -0
- omadbek_git_sdk-0.1.0/src/omadbek_git_sdk.egg-info/top_level.txt +1 -0
- omadbek_git_sdk-0.1.0/tests/test_manager.py +22 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Omadbek Group
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: omadbek-git-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Git automation SDK and CLI with safe defaults
|
|
5
|
+
Author: Omadbek Group
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: git,automation,developer-tools
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# OMADBEK Git SDK
|
|
16
|
+
|
|
17
|
+
Git boshqaruvi uchun Python kutubxonasi va terminal vositasi.
|
|
18
|
+
|
|
19
|
+
**Muhim:** `tartib_original.py` — yuborgan original faylingiz, o'zgartirilmagan.
|
|
20
|
+
Yangi kutubxona xavfsizroq mustaqil modul sifatida yozildi; eski Node/Vite
|
|
21
|
+
fayl tartiblash avtomatik ishlatilmaydi.
|
|
22
|
+
|
|
23
|
+
## Talablar
|
|
24
|
+
- Python 3.9+
|
|
25
|
+
- Git (`git --version` ishlashi kerak)
|
|
26
|
+
|
|
27
|
+
## Windows PowerShell: o'rnatish
|
|
28
|
+
ZIPni oching va uning ichida PowerShell oching:
|
|
29
|
+
```powershell
|
|
30
|
+
py -m venv .venv
|
|
31
|
+
.\.venv\Scripts\python.exe -m pip install --upgrade pip
|
|
32
|
+
.\.venv\Scripts\python.exe -m pip install -e .
|
|
33
|
+
.\.venv\Scripts\omadbek-git.exe status --path "C:\\loyiha"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Python ichida
|
|
37
|
+
```python
|
|
38
|
+
from omadbek_git import GitManager
|
|
39
|
+
git = GitManager(r"C:\loyiha")
|
|
40
|
+
print(git.status())
|
|
41
|
+
print(git.branch())
|
|
42
|
+
print(git.log(5))
|
|
43
|
+
# git.add("index.html")
|
|
44
|
+
# git.commit("Update index")
|
|
45
|
+
# git.push()
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`add`, `commit`, `push` alohida chaqiriladi; yashirin avtomatik commit yo'q.
|
|
49
|
+
|
|
50
|
+
## PyPI ga chiqarish
|
|
51
|
+
1. `pyproject.toml` ichidagi `name` PyPI da band emasligini tekshiring.
|
|
52
|
+
2. `py -m pip install build twine`
|
|
53
|
+
3. `py -m build`
|
|
54
|
+
4. `py -m twine check dist/*`
|
|
55
|
+
5. Avval `py -m twine upload --repository testpypi dist/*` orqali sinang.
|
|
56
|
+
6. Keyin `py -m twine upload dist/*` orqali PyPI ga yuklang.
|
|
57
|
+
7. Boshqa kompyuterda `py -m pip install omadbek-git-sdk`.
|
|
58
|
+
|
|
59
|
+
PyPI hisobini va tokenni faqat rasmiy saytda yarating. Tokenni kodga yozmang.
|
|
60
|
+
|
|
61
|
+
## Hozirgi versiya
|
|
62
|
+
Status, branch, log, add, commit, fetch, pull (--ff-only), push va remote.
|
|
63
|
+
GitHub login, AI, jamoa statistikasi va GUI hali mavjud emas.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# OMADBEK Git SDK
|
|
2
|
+
|
|
3
|
+
Git boshqaruvi uchun Python kutubxonasi va terminal vositasi.
|
|
4
|
+
|
|
5
|
+
**Muhim:** `tartib_original.py` — yuborgan original faylingiz, o'zgartirilmagan.
|
|
6
|
+
Yangi kutubxona xavfsizroq mustaqil modul sifatida yozildi; eski Node/Vite
|
|
7
|
+
fayl tartiblash avtomatik ishlatilmaydi.
|
|
8
|
+
|
|
9
|
+
## Talablar
|
|
10
|
+
- Python 3.9+
|
|
11
|
+
- Git (`git --version` ishlashi kerak)
|
|
12
|
+
|
|
13
|
+
## Windows PowerShell: o'rnatish
|
|
14
|
+
ZIPni oching va uning ichida PowerShell oching:
|
|
15
|
+
```powershell
|
|
16
|
+
py -m venv .venv
|
|
17
|
+
.\.venv\Scripts\python.exe -m pip install --upgrade pip
|
|
18
|
+
.\.venv\Scripts\python.exe -m pip install -e .
|
|
19
|
+
.\.venv\Scripts\omadbek-git.exe status --path "C:\\loyiha"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Python ichida
|
|
23
|
+
```python
|
|
24
|
+
from omadbek_git import GitManager
|
|
25
|
+
git = GitManager(r"C:\loyiha")
|
|
26
|
+
print(git.status())
|
|
27
|
+
print(git.branch())
|
|
28
|
+
print(git.log(5))
|
|
29
|
+
# git.add("index.html")
|
|
30
|
+
# git.commit("Update index")
|
|
31
|
+
# git.push()
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`add`, `commit`, `push` alohida chaqiriladi; yashirin avtomatik commit yo'q.
|
|
35
|
+
|
|
36
|
+
## PyPI ga chiqarish
|
|
37
|
+
1. `pyproject.toml` ichidagi `name` PyPI da band emasligini tekshiring.
|
|
38
|
+
2. `py -m pip install build twine`
|
|
39
|
+
3. `py -m build`
|
|
40
|
+
4. `py -m twine check dist/*`
|
|
41
|
+
5. Avval `py -m twine upload --repository testpypi dist/*` orqali sinang.
|
|
42
|
+
6. Keyin `py -m twine upload dist/*` orqali PyPI ga yuklang.
|
|
43
|
+
7. Boshqa kompyuterda `py -m pip install omadbek-git-sdk`.
|
|
44
|
+
|
|
45
|
+
PyPI hisobini va tokenni faqat rasmiy saytda yarating. Tokenni kodga yozmang.
|
|
46
|
+
|
|
47
|
+
## Hozirgi versiya
|
|
48
|
+
Status, branch, log, add, commit, fetch, pull (--ff-only), push va remote.
|
|
49
|
+
GitHub login, AI, jamoa statistikasi va GUI hali mavjud emas.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "omadbek-git-sdk"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Git automation SDK and CLI with safe defaults"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [{name = "Omadbek Group"}]
|
|
13
|
+
keywords = ["git", "automation", "developer-tools"]
|
|
14
|
+
classifiers = ["Programming Language :: Python :: 3", "Operating System :: OS Independent"]
|
|
15
|
+
|
|
16
|
+
[project.scripts]
|
|
17
|
+
omadbek-git = "omadbek_git.cli:main"
|
|
18
|
+
|
|
19
|
+
[tool.setuptools.packages.find]
|
|
20
|
+
where = ["src"]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
from .manager import GitManager, GitError
|
|
3
|
+
|
|
4
|
+
def main():
|
|
5
|
+
parser = argparse.ArgumentParser(description="OMADBEK Git SDK")
|
|
6
|
+
parser.add_argument("command", choices=["status", "branch", "log", "fetch", "pull", "push", "remote"])
|
|
7
|
+
parser.add_argument("--path", default=".")
|
|
8
|
+
parser.add_argument("--limit", type=int, default=10)
|
|
9
|
+
args = parser.parse_args()
|
|
10
|
+
try:
|
|
11
|
+
git = GitManager(args.path)
|
|
12
|
+
result = git.log(args.limit) if args.command == "log" else getattr(git, args.command)()
|
|
13
|
+
print(result or "Muvaffaqiyatli bajarildi")
|
|
14
|
+
except (GitError, ValueError) as exc:
|
|
15
|
+
parser.exit(1, f"Xato: {exc}\n")
|
|
16
|
+
if __name__ == "__main__":
|
|
17
|
+
main()
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Git operations with explicit safety checks and no implicit commits."""
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import subprocess
|
|
4
|
+
|
|
5
|
+
class GitError(RuntimeError):
|
|
6
|
+
pass
|
|
7
|
+
|
|
8
|
+
class GitManager:
|
|
9
|
+
def __init__(self, path="."):
|
|
10
|
+
self.path = Path(path).expanduser().resolve()
|
|
11
|
+
if not self.path.is_dir():
|
|
12
|
+
raise ValueError(f"Papka mavjud emas: {self.path}")
|
|
13
|
+
self._run("rev-parse", "--is-inside-work-tree")
|
|
14
|
+
|
|
15
|
+
def _run(self, *args):
|
|
16
|
+
try:
|
|
17
|
+
result = subprocess.run(
|
|
18
|
+
["git", *args], cwd=self.path, text=True,
|
|
19
|
+
capture_output=True, check=False
|
|
20
|
+
)
|
|
21
|
+
except FileNotFoundError as exc:
|
|
22
|
+
raise GitError("Git o'rnatilmagan yoki PATH da topilmadi") from exc
|
|
23
|
+
if result.returncode:
|
|
24
|
+
raise GitError(result.stderr.strip() or result.stdout.strip() or "Git xatosi")
|
|
25
|
+
return result.stdout.strip()
|
|
26
|
+
|
|
27
|
+
def status(self):
|
|
28
|
+
return self._run("status", "--short")
|
|
29
|
+
|
|
30
|
+
def branch(self):
|
|
31
|
+
return self._run("branch", "--show-current")
|
|
32
|
+
|
|
33
|
+
def log(self, limit=10):
|
|
34
|
+
if not isinstance(limit, int) or not 1 <= limit <= 100:
|
|
35
|
+
raise ValueError("limit 1 dan 100 gacha bo'lishi kerak")
|
|
36
|
+
return self._run("log", f"-{limit}", "--pretty=format:%h %an %s")
|
|
37
|
+
|
|
38
|
+
def add(self, *files):
|
|
39
|
+
if not files:
|
|
40
|
+
raise ValueError("Qaysi fayllarni qo'shish kerakligini ko'rsating")
|
|
41
|
+
return self._run("add", "--", *files)
|
|
42
|
+
|
|
43
|
+
def commit(self, message):
|
|
44
|
+
if not message or not message.strip():
|
|
45
|
+
raise ValueError("Commit xabari bo'sh bo'lmasligi kerak")
|
|
46
|
+
return self._run("commit", "-m", message)
|
|
47
|
+
|
|
48
|
+
def fetch(self):
|
|
49
|
+
return self._run("fetch")
|
|
50
|
+
|
|
51
|
+
def pull(self):
|
|
52
|
+
if self.status():
|
|
53
|
+
raise GitError("Pull uchun avval lokal o'zgarishlarni saqlang")
|
|
54
|
+
return self._run("pull", "--ff-only")
|
|
55
|
+
|
|
56
|
+
def push(self):
|
|
57
|
+
return self._run("push")
|
|
58
|
+
|
|
59
|
+
def remote(self):
|
|
60
|
+
return self._run("remote", "-v")
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: omadbek-git-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Git automation SDK and CLI with safe defaults
|
|
5
|
+
Author: Omadbek Group
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: git,automation,developer-tools
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Dynamic: license-file
|
|
14
|
+
|
|
15
|
+
# OMADBEK Git SDK
|
|
16
|
+
|
|
17
|
+
Git boshqaruvi uchun Python kutubxonasi va terminal vositasi.
|
|
18
|
+
|
|
19
|
+
**Muhim:** `tartib_original.py` — yuborgan original faylingiz, o'zgartirilmagan.
|
|
20
|
+
Yangi kutubxona xavfsizroq mustaqil modul sifatida yozildi; eski Node/Vite
|
|
21
|
+
fayl tartiblash avtomatik ishlatilmaydi.
|
|
22
|
+
|
|
23
|
+
## Talablar
|
|
24
|
+
- Python 3.9+
|
|
25
|
+
- Git (`git --version` ishlashi kerak)
|
|
26
|
+
|
|
27
|
+
## Windows PowerShell: o'rnatish
|
|
28
|
+
ZIPni oching va uning ichida PowerShell oching:
|
|
29
|
+
```powershell
|
|
30
|
+
py -m venv .venv
|
|
31
|
+
.\.venv\Scripts\python.exe -m pip install --upgrade pip
|
|
32
|
+
.\.venv\Scripts\python.exe -m pip install -e .
|
|
33
|
+
.\.venv\Scripts\omadbek-git.exe status --path "C:\\loyiha"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Python ichida
|
|
37
|
+
```python
|
|
38
|
+
from omadbek_git import GitManager
|
|
39
|
+
git = GitManager(r"C:\loyiha")
|
|
40
|
+
print(git.status())
|
|
41
|
+
print(git.branch())
|
|
42
|
+
print(git.log(5))
|
|
43
|
+
# git.add("index.html")
|
|
44
|
+
# git.commit("Update index")
|
|
45
|
+
# git.push()
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`add`, `commit`, `push` alohida chaqiriladi; yashirin avtomatik commit yo'q.
|
|
49
|
+
|
|
50
|
+
## PyPI ga chiqarish
|
|
51
|
+
1. `pyproject.toml` ichidagi `name` PyPI da band emasligini tekshiring.
|
|
52
|
+
2. `py -m pip install build twine`
|
|
53
|
+
3. `py -m build`
|
|
54
|
+
4. `py -m twine check dist/*`
|
|
55
|
+
5. Avval `py -m twine upload --repository testpypi dist/*` orqali sinang.
|
|
56
|
+
6. Keyin `py -m twine upload dist/*` orqali PyPI ga yuklang.
|
|
57
|
+
7. Boshqa kompyuterda `py -m pip install omadbek-git-sdk`.
|
|
58
|
+
|
|
59
|
+
PyPI hisobini va tokenni faqat rasmiy saytda yarating. Tokenni kodga yozmang.
|
|
60
|
+
|
|
61
|
+
## Hozirgi versiya
|
|
62
|
+
Status, branch, log, add, commit, fetch, pull (--ff-only), push va remote.
|
|
63
|
+
GitHub login, AI, jamoa statistikasi va GUI hali mavjud emas.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/omadbek_git/__init__.py
|
|
5
|
+
src/omadbek_git/cli.py
|
|
6
|
+
src/omadbek_git/manager.py
|
|
7
|
+
src/omadbek_git_sdk.egg-info/PKG-INFO
|
|
8
|
+
src/omadbek_git_sdk.egg-info/SOURCES.txt
|
|
9
|
+
src/omadbek_git_sdk.egg-info/dependency_links.txt
|
|
10
|
+
src/omadbek_git_sdk.egg-info/entry_points.txt
|
|
11
|
+
src/omadbek_git_sdk.egg-info/top_level.txt
|
|
12
|
+
tests/test_manager.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
omadbek_git
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
import tempfile
|
|
3
|
+
import unittest
|
|
4
|
+
from omadbek_git import GitManager
|
|
5
|
+
|
|
6
|
+
class GitManagerTests(unittest.TestCase):
|
|
7
|
+
def test_status_and_commit(self):
|
|
8
|
+
with tempfile.TemporaryDirectory() as d:
|
|
9
|
+
subprocess.run(["git", "init", d], check=True, capture_output=True)
|
|
10
|
+
subprocess.run(["git", "-C", d, "config", "user.email", "test@example.com"], check=True)
|
|
11
|
+
subprocess.run(["git", "-C", d, "config", "user.name", "Test"], check=True)
|
|
12
|
+
git = GitManager(d)
|
|
13
|
+
self.assertEqual(git.status(), "")
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
Path(d, "hello.txt").write_text("hello")
|
|
16
|
+
self.assertIn("hello.txt", git.status())
|
|
17
|
+
git.add("hello.txt")
|
|
18
|
+
git.commit("first")
|
|
19
|
+
self.assertEqual(git.status(), "")
|
|
20
|
+
self.assertIn("first", git.log())
|
|
21
|
+
if __name__ == "__main__":
|
|
22
|
+
unittest.main()
|