quickpub 0.6.0__tar.gz → 0.6.30__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.
- {quickpub-0.6.0 → quickpub-0.6.30}/PKG-INFO +1 -1
- {quickpub-0.6.0 → quickpub-0.6.30}/pyproject.toml +1 -1
- quickpub-0.6.30/quickpub/__init__.py +2 -0
- {quickpub-0.6.0 → quickpub-0.6.30}/quickpub/__main__.py +30 -17
- quickpub-0.6.30/quickpub/custom_types.py +7 -0
- quickpub-0.6.30/quickpub/enforcers.py +42 -0
- {quickpub-0.6.0 → quickpub-0.6.30}/quickpub/publish.py +28 -11
- quickpub-0.6.30/quickpub/validators.py +46 -0
- {quickpub-0.6.0 → quickpub-0.6.30}/quickpub.egg-info/PKG-INFO +1 -1
- {quickpub-0.6.0 → quickpub-0.6.30}/quickpub.egg-info/SOURCES.txt +3 -1
- quickpub-0.6.0/quickpub/__init__.py +0 -6
- quickpub-0.6.0/quickpub/enforce_version.py +0 -23
- {quickpub-0.6.0 → quickpub-0.6.30}/README.md +0 -0
- {quickpub-0.6.0 → quickpub-0.6.30}/quickpub/classifiers.py +0 -0
- {quickpub-0.6.0 → quickpub-0.6.30}/quickpub/files.py +0 -0
- {quickpub-0.6.0 → quickpub-0.6.30}/quickpub/proxy.py +0 -0
- {quickpub-0.6.0 → quickpub-0.6.30}/quickpub/py.typed +0 -0
- {quickpub-0.6.0 → quickpub-0.6.30}/quickpub/structures.py +0 -0
- {quickpub-0.6.0 → quickpub-0.6.30}/quickpub.egg-info/dependency_links.txt +0 -0
- {quickpub-0.6.0 → quickpub-0.6.30}/quickpub.egg-info/requires.txt +0 -0
- {quickpub-0.6.0 → quickpub-0.6.30}/quickpub.egg-info/top_level.txt +0 -0
- {quickpub-0.6.0 → quickpub-0.6.30}/setup.cfg +0 -0
- {quickpub-0.6.0 → quickpub-0.6.30}/setup.py +0 -0
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
from typing import Optional, Union
|
|
2
|
-
from danielutils import
|
|
1
|
+
from typing import Optional, Union
|
|
2
|
+
from danielutils import warning
|
|
3
|
+
from .validators import validate_version, validate_python_version, validate_keywords, validate_dependencies, \
|
|
4
|
+
validate_source
|
|
3
5
|
from .publish import build, upload, commit, metrics
|
|
4
6
|
from .structures import Version, Config
|
|
5
7
|
from .files import create_toml, create_setup
|
|
6
8
|
from .classifiers import *
|
|
7
|
-
from .
|
|
9
|
+
from .enforcers import enforce_correct_version, enforce_pypirc_exists
|
|
10
|
+
from .custom_types import Path
|
|
8
11
|
|
|
9
12
|
|
|
10
13
|
def publish(
|
|
11
14
|
*,
|
|
12
15
|
name: str,
|
|
13
|
-
src:
|
|
16
|
+
src: Optional[Path] = None,
|
|
14
17
|
version: Optional[Union[Version, str]] = None,
|
|
15
18
|
author: str,
|
|
16
19
|
author_email: str,
|
|
@@ -23,21 +26,31 @@ def publish(
|
|
|
23
26
|
dependencies: Optional[list[str]] = None,
|
|
24
27
|
config: Optional[Config] = None
|
|
25
28
|
) -> None:
|
|
26
|
-
|
|
27
|
-
version = Version(0, 0, 1)
|
|
28
|
-
else:
|
|
29
|
-
version: Version = version if isinstance(version, Version) else Version.from_str(version) # type: ignore
|
|
29
|
+
"""
|
|
30
30
|
|
|
31
|
+
:param name: The display name of the package
|
|
32
|
+
:param src: The source folder of the package, Defaults to CWD/<name>
|
|
33
|
+
:param version:
|
|
34
|
+
:param author:
|
|
35
|
+
:param author_email:
|
|
36
|
+
:param description:
|
|
37
|
+
:param homepage:
|
|
38
|
+
:param min_python:
|
|
39
|
+
:param keywords:
|
|
40
|
+
:param dependencies:
|
|
41
|
+
:param config:
|
|
42
|
+
:return:
|
|
43
|
+
"""
|
|
44
|
+
enforce_pypirc_exists()
|
|
45
|
+
src = validate_source(name, src)
|
|
46
|
+
if src != f"./{name}":
|
|
47
|
+
warning(
|
|
48
|
+
"The source folder's name is different from the package's name. this may not be currently supported correctly")
|
|
49
|
+
version = validate_version(version)
|
|
31
50
|
enforce_correct_version(name, version)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if keywords is None:
|
|
37
|
-
keywords = []
|
|
38
|
-
|
|
39
|
-
if dependencies is None:
|
|
40
|
-
dependencies = []
|
|
51
|
+
min_python = validate_python_version(min_python)
|
|
52
|
+
keywords = validate_keywords(keywords)
|
|
53
|
+
dependencies = validate_dependencies(dependencies)
|
|
41
54
|
|
|
42
55
|
create_setup()
|
|
43
56
|
create_toml(
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
from typing import Union, Callable
|
|
3
|
+
|
|
4
|
+
from danielutils import directory_exists, get_files, error, file_exists
|
|
5
|
+
from .structures import Version
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def exit_if(predicate: Union[bool, Callable[[], bool]], msg: str) -> None:
|
|
9
|
+
if isinstance(predicate, bool):
|
|
10
|
+
if predicate:
|
|
11
|
+
error(msg)
|
|
12
|
+
sys.exit(1)
|
|
13
|
+
else:
|
|
14
|
+
if predicate():
|
|
15
|
+
error(msg)
|
|
16
|
+
sys.exit(1)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def enforce_correct_version(name: str, version: Version) -> None:
|
|
20
|
+
if directory_exists("./dist"):
|
|
21
|
+
max_version = Version(0, 0, 0)
|
|
22
|
+
for d in get_files("./dist"):
|
|
23
|
+
d = d.removeprefix(f"{name}-").removesuffix(".tar.gz")
|
|
24
|
+
v = Version.from_str(d)
|
|
25
|
+
max_version = max(max_version, v)
|
|
26
|
+
exit_if(
|
|
27
|
+
version <= max_version,
|
|
28
|
+
f"Specified version is '{version}' but (locally available) latest existing is '{max_version}'"
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def enforce_pypirc_exists() -> None:
|
|
33
|
+
exit_if(
|
|
34
|
+
not file_exists("./.pypirc"),
|
|
35
|
+
"No .pypirc file found"
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
__all__ = [
|
|
40
|
+
"enforce_correct_version",
|
|
41
|
+
"enforce_pypirc_exists"
|
|
42
|
+
]
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import sys
|
|
2
|
+
from typing import Optional, Literal
|
|
3
|
+
|
|
2
4
|
from danielutils import info, error
|
|
3
5
|
|
|
6
|
+
from .enforcers import exit_if
|
|
4
7
|
from .proxy import cm
|
|
5
8
|
from .structures import Version
|
|
6
9
|
|
|
@@ -149,9 +152,10 @@ def build(
|
|
|
149
152
|
if verbose:
|
|
150
153
|
info("Creating new distribution...")
|
|
151
154
|
ret, stdout, stderr = cm("python", "setup.py", "sdist")
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
exit_if(
|
|
156
|
+
ret != 0,
|
|
157
|
+
stderr.decode(encoding="utf8")
|
|
158
|
+
)
|
|
155
159
|
|
|
156
160
|
|
|
157
161
|
def upload(
|
|
@@ -162,10 +166,11 @@ def upload(
|
|
|
162
166
|
) -> None:
|
|
163
167
|
if verbose:
|
|
164
168
|
info("Uploading")
|
|
165
|
-
ret, stdout, stderr = cm("
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
+
ret, stdout, stderr = cm("twine", "upload", "--config-file", ".pypirc", f"dist/{name}-{version}.tar.gz")
|
|
170
|
+
exit_if(
|
|
171
|
+
ret != 0,
|
|
172
|
+
f"Failed uploading the package to pypi. Try running the following command manually:\n\ttwine upload --config-file .pypirc dist/{name}-{version}.tar.gz"
|
|
173
|
+
)
|
|
169
174
|
|
|
170
175
|
|
|
171
176
|
def commit(
|
|
@@ -176,16 +181,28 @@ def commit(
|
|
|
176
181
|
if verbose:
|
|
177
182
|
info("Git")
|
|
178
183
|
info("\tStaging")
|
|
179
|
-
cm("git add .")
|
|
184
|
+
ret, stdout, stderr = cm("git add .")
|
|
185
|
+
exit_if(
|
|
186
|
+
ret != 0,
|
|
187
|
+
stderr.decode(encoding="utf8")
|
|
188
|
+
)
|
|
180
189
|
if verbose:
|
|
181
190
|
info("\tCommitting")
|
|
182
|
-
cm(f"git commit -m \"updated to version {version}\"")
|
|
191
|
+
ret, stdout, stderr = cm(f"git commit -m \"updated to version {version}\"")
|
|
192
|
+
exit_if(
|
|
193
|
+
ret != 0,
|
|
194
|
+
stderr.decode(encoding="utf8")
|
|
195
|
+
)
|
|
183
196
|
if verbose:
|
|
184
197
|
info("\tPushing")
|
|
185
|
-
cm("git push")
|
|
198
|
+
ret, stdout, stderr = cm("git push")
|
|
199
|
+
exit_if(
|
|
200
|
+
ret != 0,
|
|
201
|
+
stderr.decode(encoding="utf8")
|
|
202
|
+
)
|
|
186
203
|
|
|
187
204
|
|
|
188
|
-
def metrics():
|
|
205
|
+
def metrics(testing_client: Optional[Literal["pytest", "unitest"]] = None):
|
|
189
206
|
pass
|
|
190
207
|
|
|
191
208
|
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from typing import Optional, Union
|
|
2
|
+
|
|
3
|
+
from danielutils import get_python_version
|
|
4
|
+
|
|
5
|
+
from .custom_types import Path
|
|
6
|
+
from .structures import Version
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def validate_version(version: Optional[Union[str, Version]]) -> Version:
|
|
10
|
+
if version is None:
|
|
11
|
+
version = Version(0, 0, 1)
|
|
12
|
+
else:
|
|
13
|
+
version: Version = version if isinstance(version, Version) else Version.from_str(version) # type: ignore
|
|
14
|
+
return version
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def validate_python_version(min_python: Optional[Version]) -> Version:
|
|
18
|
+
if min_python is not None:
|
|
19
|
+
return min_python
|
|
20
|
+
return Version(*get_python_version())
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def validate_keywords(keywords: Optional[list[str]]) -> list[str]:
|
|
24
|
+
if keywords is None:
|
|
25
|
+
return []
|
|
26
|
+
return keywords
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def validate_dependencies(dependencies: Optional[list[str]]) -> list[str]:
|
|
30
|
+
if dependencies is None:
|
|
31
|
+
return []
|
|
32
|
+
return dependencies
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def validate_source(name: str, src: Optional[Path] = None) -> Path:
|
|
36
|
+
if src is not None:
|
|
37
|
+
return src
|
|
38
|
+
return f"./{name}"
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
__all__ = [
|
|
42
|
+
"validate_version",
|
|
43
|
+
"validate_python_version",
|
|
44
|
+
"validate_keywords",
|
|
45
|
+
"validate_dependencies"
|
|
46
|
+
]
|
|
@@ -4,12 +4,14 @@ setup.py
|
|
|
4
4
|
quickpub/__init__.py
|
|
5
5
|
quickpub/__main__.py
|
|
6
6
|
quickpub/classifiers.py
|
|
7
|
-
quickpub/
|
|
7
|
+
quickpub/custom_types.py
|
|
8
|
+
quickpub/enforcers.py
|
|
8
9
|
quickpub/files.py
|
|
9
10
|
quickpub/proxy.py
|
|
10
11
|
quickpub/publish.py
|
|
11
12
|
quickpub/py.typed
|
|
12
13
|
quickpub/structures.py
|
|
14
|
+
quickpub/validators.py
|
|
13
15
|
quickpub.egg-info/PKG-INFO
|
|
14
16
|
quickpub.egg-info/SOURCES.txt
|
|
15
17
|
quickpub.egg-info/dependency_links.txt
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
from danielutils import directory_exists, get_files, error
|
|
3
|
-
from .structures import Version
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def enforce_correct_version(name: str, version: Version) -> None:
|
|
7
|
-
if directory_exists("./dist"):
|
|
8
|
-
max_version = Version(0, 0, 0)
|
|
9
|
-
for d in get_files("./dist"):
|
|
10
|
-
d = d.removeprefix(f"{name}-").removesuffix(".tar.gz")
|
|
11
|
-
v = Version.from_str(d)
|
|
12
|
-
max_version = max(max_version, v)
|
|
13
|
-
if version < max_version:
|
|
14
|
-
error(f"Specified version is '{version}' but (locally available) latest is '{max_version}'")
|
|
15
|
-
sys.exit(1)
|
|
16
|
-
if version == max_version:
|
|
17
|
-
error(f"Version {version} already exists!")
|
|
18
|
-
sys.exit(1)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
__all__ = [
|
|
22
|
-
"enforce_correct_version"
|
|
23
|
-
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|