Sadr 0.1.1__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.
- sadr-0.1.1/PKG-INFO +51 -0
- sadr-0.1.1/README.md +32 -0
- sadr-0.1.1/Sadr.egg-info/PKG-INFO +51 -0
- sadr-0.1.1/Sadr.egg-info/SOURCES.txt +10 -0
- sadr-0.1.1/Sadr.egg-info/dependency_links.txt +1 -0
- sadr-0.1.1/Sadr.egg-info/requires.txt +1 -0
- sadr-0.1.1/Sadr.egg-info/top_level.txt +1 -0
- sadr-0.1.1/pyproject.toml +3 -0
- sadr-0.1.1/sadr/__init__.py +8 -0
- sadr-0.1.1/sadr/pypi.py +83 -0
- sadr-0.1.1/setup.cfg +4 -0
- sadr-0.1.1/setup.py +27 -0
sadr-0.1.1/PKG-INFO
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Sadr
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: A Python package publishing framework
|
|
5
|
+
Keywords: pypi python publishing package
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: requests>=2.31.0
|
|
12
|
+
Dynamic: classifier
|
|
13
|
+
Dynamic: description
|
|
14
|
+
Dynamic: description-content-type
|
|
15
|
+
Dynamic: keywords
|
|
16
|
+
Dynamic: requires-dist
|
|
17
|
+
Dynamic: requires-python
|
|
18
|
+
Dynamic: summary
|
|
19
|
+
|
|
20
|
+
# Sadr
|
|
21
|
+
|
|
22
|
+
A Python package publishing framework, cause I find package releasing very boring
|
|
23
|
+
so I made a automation... Thank me later
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
pip install sadr
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from sadr import PyPI
|
|
35
|
+
|
|
36
|
+
# You have to add the directory here, so Sadr can find the package
|
|
37
|
+
sadr = PyPI(".")
|
|
38
|
+
# This will build the wheel and distribution files and folders
|
|
39
|
+
sadr.build()
|
|
40
|
+
# This will check if the package is right and all things work
|
|
41
|
+
sadr.check()
|
|
42
|
+
# This will release your package, you have to enter the PyPI token
|
|
43
|
+
# Don't worry, I won't steal your token :)
|
|
44
|
+
sadr.upload(token="__token_here__")
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Note
|
|
48
|
+
|
|
49
|
+
So this is the Alpha version, I will update and add more documentation on 19th November, aka Tomorrow, so do not worry
|
|
50
|
+
|
|
51
|
+
---
|
sadr-0.1.1/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Sadr
|
|
2
|
+
|
|
3
|
+
A Python package publishing framework, cause I find package releasing very boring
|
|
4
|
+
so I made a automation... Thank me later
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
pip install sadr
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
from sadr import PyPI
|
|
16
|
+
|
|
17
|
+
# You have to add the directory here, so Sadr can find the package
|
|
18
|
+
sadr = PyPI(".")
|
|
19
|
+
# This will build the wheel and distribution files and folders
|
|
20
|
+
sadr.build()
|
|
21
|
+
# This will check if the package is right and all things work
|
|
22
|
+
sadr.check()
|
|
23
|
+
# This will release your package, you have to enter the PyPI token
|
|
24
|
+
# Don't worry, I won't steal your token :)
|
|
25
|
+
sadr.upload(token="__token_here__")
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Note
|
|
29
|
+
|
|
30
|
+
So this is the Alpha version, I will update and add more documentation on 19th November, aka Tomorrow, so do not worry
|
|
31
|
+
|
|
32
|
+
---
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Sadr
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: A Python package publishing framework
|
|
5
|
+
Keywords: pypi python publishing package
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
9
|
+
Requires-Python: >=3.8
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
Requires-Dist: requests>=2.31.0
|
|
12
|
+
Dynamic: classifier
|
|
13
|
+
Dynamic: description
|
|
14
|
+
Dynamic: description-content-type
|
|
15
|
+
Dynamic: keywords
|
|
16
|
+
Dynamic: requires-dist
|
|
17
|
+
Dynamic: requires-python
|
|
18
|
+
Dynamic: summary
|
|
19
|
+
|
|
20
|
+
# Sadr
|
|
21
|
+
|
|
22
|
+
A Python package publishing framework, cause I find package releasing very boring
|
|
23
|
+
so I made a automation... Thank me later
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
pip install sadr
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from sadr import PyPI
|
|
35
|
+
|
|
36
|
+
# You have to add the directory here, so Sadr can find the package
|
|
37
|
+
sadr = PyPI(".")
|
|
38
|
+
# This will build the wheel and distribution files and folders
|
|
39
|
+
sadr.build()
|
|
40
|
+
# This will check if the package is right and all things work
|
|
41
|
+
sadr.check()
|
|
42
|
+
# This will release your package, you have to enter the PyPI token
|
|
43
|
+
# Don't worry, I won't steal your token :)
|
|
44
|
+
sadr.upload(token="__token_here__")
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Note
|
|
48
|
+
|
|
49
|
+
So this is the Alpha version, I will update and add more documentation on 19th November, aka Tomorrow, so do not worry
|
|
50
|
+
|
|
51
|
+
---
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.31.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
sadr
|
sadr-0.1.1/sadr/pypi.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
import subprocess as sp
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
class PyPI:
|
|
6
|
+
def __init__(self, pr_dir="."):
|
|
7
|
+
self.pr_dir = Path(pr_dir).resolve()
|
|
8
|
+
self.dist_dir = self.pr_dir / "dist"
|
|
9
|
+
|
|
10
|
+
def _run(self, *cmd):
|
|
11
|
+
return sp.run(
|
|
12
|
+
[sys.executable, *cmd],
|
|
13
|
+
cwd=self.pr_dir,
|
|
14
|
+
check=True
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
def val(self):
|
|
18
|
+
required = ["pyproject.toml", "README.md"]
|
|
19
|
+
missing = [
|
|
20
|
+
file for file in required
|
|
21
|
+
if not (self.pr_dir / file).is_file()
|
|
22
|
+
]
|
|
23
|
+
if missing:
|
|
24
|
+
raise FileNotFoundError(
|
|
25
|
+
f"Missing project files: {', '.join(missing)}"
|
|
26
|
+
)
|
|
27
|
+
return True
|
|
28
|
+
|
|
29
|
+
def build(self, clean=False):
|
|
30
|
+
self.val()
|
|
31
|
+
if clean and self.dist_dir.exists():
|
|
32
|
+
for file in self.dist_dir.iterdir():
|
|
33
|
+
if file.is_file(): file.unlink()
|
|
34
|
+
self._run("-m", "build")
|
|
35
|
+
return list(self.dist_dir.glob("*"))
|
|
36
|
+
|
|
37
|
+
def inspect(self):
|
|
38
|
+
if not self.dist_dir.exists(): raise FileNotFoundError("Distribution directory not found")
|
|
39
|
+
files = list(self.dist_dir.glob("*"))
|
|
40
|
+
if not files: raise FileNotFoundError("No distributions found")
|
|
41
|
+
return [
|
|
42
|
+
{
|
|
43
|
+
"name": file.name,
|
|
44
|
+
"size": file.stat().st_size,
|
|
45
|
+
"type": file.suffix
|
|
46
|
+
}
|
|
47
|
+
for file in files
|
|
48
|
+
if file.is_file()
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
def check_twine(self):
|
|
52
|
+
try:
|
|
53
|
+
self._run("-m", "twine", "--version")
|
|
54
|
+
return True
|
|
55
|
+
except sp.CalledProcessError: return False
|
|
56
|
+
|
|
57
|
+
def check(self):
|
|
58
|
+
if not self.check_twine(): raise RuntimeError("Twine is not installed")
|
|
59
|
+
self._run(
|
|
60
|
+
"-m", "twine",
|
|
61
|
+
"check",
|
|
62
|
+
"dist/*"
|
|
63
|
+
)
|
|
64
|
+
return True
|
|
65
|
+
|
|
66
|
+
def upload(self, token, repository="pypi"):
|
|
67
|
+
if not token: raise ValueError("PyPI API token cannot be empty")
|
|
68
|
+
if not self.dist_dir.exists(): raise FileNotFoundError("Build the project first")
|
|
69
|
+
distributions = [
|
|
70
|
+
str(file)
|
|
71
|
+
for file in self.dist_dir.glob("*")
|
|
72
|
+
if file.is_file()
|
|
73
|
+
]
|
|
74
|
+
if not distributions: raise FileNotFoundError("No distributions to upload")
|
|
75
|
+
self._run(
|
|
76
|
+
"-m", "twine",
|
|
77
|
+
"upload",
|
|
78
|
+
"--repository", repository,
|
|
79
|
+
"--username", "__token__",
|
|
80
|
+
"--password", token,
|
|
81
|
+
*distributions
|
|
82
|
+
)
|
|
83
|
+
return True
|
sadr-0.1.1/setup.cfg
ADDED
sadr-0.1.1/setup.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
from setuptools import setup, find_packages
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
setup(
|
|
6
|
+
name="Sadr",
|
|
7
|
+
version="0.1.1",
|
|
8
|
+
description="A Python package publishing framework",
|
|
9
|
+
|
|
10
|
+
long_description=Path("README.md").read_text(encoding="utf-8"),
|
|
11
|
+
long_description_content_type="text/markdown",
|
|
12
|
+
|
|
13
|
+
packages=find_packages(),
|
|
14
|
+
python_requires=">=3.8",
|
|
15
|
+
|
|
16
|
+
install_requires=[
|
|
17
|
+
"requests>=2.31.0"
|
|
18
|
+
],
|
|
19
|
+
|
|
20
|
+
classifiers=[
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Operating System :: OS Independent",
|
|
23
|
+
"Topic :: Software Development :: Build Tools",
|
|
24
|
+
],
|
|
25
|
+
|
|
26
|
+
keywords="pypi python publishing package",
|
|
27
|
+
)
|