quickpub 3.0.5__tar.gz → 3.0.6__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-3.0.5/quickpub.egg-info → quickpub-3.0.6}/PKG-INFO +1 -1
- {quickpub-3.0.5 → quickpub-3.0.6}/pyproject.toml +1 -1
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/quality_assurance_runners/unittest_qa_runner.py +19 -11
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/upload_targets/github_upload_target.py +13 -7
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/upload_targets/pypirc_upload_target.py +21 -11
- {quickpub-3.0.5 → quickpub-3.0.6/quickpub.egg-info}/PKG-INFO +1 -1
- {quickpub-3.0.5 → quickpub-3.0.6}/LICENSE +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/MANIFEST.in +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/README.md +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/__init__.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/__main__.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/classifiers.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/enforcers.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/files.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/functions.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/logging_.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/proxy.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/py.typed +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/qa.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/__init__.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/build_schema.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/constraint_enforcer.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/__init__.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/build_schemas/__init__.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/build_schemas/setuptools_build_schema.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/constraint_enforcers/__init__.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/constraint_enforcers/license_enforcer.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/constraint_enforcers/local_version_enforcer.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/constraint_enforcers/pypi_remote_version_enforcer.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/constraint_enforcers/pypirc_enforcer.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/constraint_enforcers/readme_enforcer.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/python_providers/__init__.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/python_providers/conda_python_provider.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/python_providers/default_python_provider.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/quality_assurance_runners/__init__.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/quality_assurance_runners/mypy_qa_runner.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/quality_assurance_runners/pylint_qa_runner.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/quality_assurance_runners/pytest_qa_runner.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/upload_targets/__init__.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/python_provider.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/quality_assurance_runner.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/quickpub_strategy.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/upload_target.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/structures/__init__.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/structures/bound.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/structures/dependency.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/structures/version.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/validators.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub/worker_pool.py +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub.egg-info/SOURCES.txt +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub.egg-info/dependency_links.txt +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub.egg-info/requires.txt +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/quickpub.egg-info/top_level.txt +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/setup.cfg +0 -0
- {quickpub-3.0.5 → quickpub-3.0.6}/setup.py +0 -0
|
@@ -24,7 +24,8 @@ def _removesuffix(string: str, suffix: str) -> str:
|
|
|
24
24
|
|
|
25
25
|
class UnittestRunner(QualityAssuranceRunner):
|
|
26
26
|
"""Quality assurance runner for unittest testing."""
|
|
27
|
-
NUM_TESTS_PATTERN: re.Pattern = re.compile(
|
|
27
|
+
NUM_TESTS_PATTERN: re.Pattern = re.compile(
|
|
28
|
+
r"Ran (\d+) tests? in \d+\.\d+s")
|
|
28
29
|
NUM_FAILED_PATTERN: re.Pattern = re.compile(
|
|
29
30
|
r"FAILED \((?:failures=(\d+))?(?:, )?(?:errors=(\d+))?(?:, )?(?:skipped=(\d+))?\)|"
|
|
30
31
|
r"FAILED \((?:errors=(\d+))?(?:, )?(?:failures=(\d+))?(?:, )?(?:skipped=(\d+))?\)|"
|
|
@@ -41,27 +42,33 @@ class UnittestRunner(QualityAssuranceRunner):
|
|
|
41
42
|
# set_current_working_directory(self._cwd)
|
|
42
43
|
|
|
43
44
|
def __init__(self, target: Optional[str] = "./tests", bound: str = ">=0.8", no_tests_score: float = 0) -> None:
|
|
44
|
-
QualityAssuranceRunner.__init__(
|
|
45
|
+
QualityAssuranceRunner.__init__(
|
|
46
|
+
self, name="unittest", bound=bound, target=target)
|
|
45
47
|
self.no_tests_score = no_tests_score
|
|
46
48
|
logger.info("Initialized UnittestRunner with target='%s', bound='%s', no_tests_score=%s", target, bound,
|
|
47
49
|
no_tests_score)
|
|
48
50
|
|
|
49
51
|
def _build_command(self, src: str, *args, use_system_interpreter: bool = False) -> str:
|
|
50
52
|
command: str = self.get_executable()
|
|
51
|
-
rel = _removesuffix(os.path.relpath(
|
|
53
|
+
rel = _removesuffix(os.path.relpath(
|
|
54
|
+
src, self.target), src.lstrip("./\\"))
|
|
52
55
|
command += f" discover -s {rel}"
|
|
53
|
-
normalized_target_path = Path(
|
|
54
|
-
|
|
56
|
+
normalized_target_path = Path(
|
|
57
|
+
os.path.join(os.getcwd(), self.target)).resolve()
|
|
58
|
+
# This is for concurrency reasons
|
|
59
|
+
return f"cd {normalized_target_path} & {command} & cd {Path(os.getcwd()).resolve()}"
|
|
55
60
|
|
|
56
61
|
def _calculate_score(self, ret: int, lines: List[str], *, verbose: bool = False) -> float:
|
|
57
|
-
logger.
|
|
62
|
+
logger.debug("Calculating unittest score from test results")
|
|
58
63
|
|
|
59
64
|
try:
|
|
60
65
|
num_tests_ran_line = lines[-3]
|
|
61
66
|
num_tests_failed_line = lines[-1]
|
|
62
|
-
num_tests = int(self.NUM_TESTS_PATTERN.match(
|
|
67
|
+
num_tests = int(self.NUM_TESTS_PATTERN.match(
|
|
68
|
+
num_tests_ran_line).group(1))
|
|
63
69
|
if num_tests == 0:
|
|
64
|
-
logger.
|
|
70
|
+
logger.debug(
|
|
71
|
+
"No tests found, returning no_tests_score: %s", self.no_tests_score)
|
|
65
72
|
return self.no_tests_score
|
|
66
73
|
|
|
67
74
|
num_failed = 0
|
|
@@ -87,14 +94,15 @@ class UnittestRunner(QualityAssuranceRunner):
|
|
|
87
94
|
num_errors = int(m.group(2) or "0")
|
|
88
95
|
else:
|
|
89
96
|
# If regex doesn't match, treat as malformed
|
|
90
|
-
raise ValueError(
|
|
97
|
+
raise ValueError(
|
|
98
|
+
f"Failed to parse FAILED line: {num_tests_failed_line}")
|
|
91
99
|
elif num_tests_failed_line.startswith("OK"):
|
|
92
100
|
# 'OK (skipped=3)' could it also be other stuff?
|
|
93
101
|
pass
|
|
94
102
|
|
|
95
103
|
score = 1 - ((num_failed + num_errors) / num_tests)
|
|
96
|
-
logger.
|
|
97
|
-
|
|
104
|
+
logger.debug("Unittest score calculated: %.3f (tests: %d, failed: %d, errors: %d)", score, num_tests,
|
|
105
|
+
num_failed, num_errors)
|
|
98
106
|
return score
|
|
99
107
|
|
|
100
108
|
except Exception as e:
|
|
@@ -7,6 +7,7 @@ logger = logging.getLogger(__name__)
|
|
|
7
7
|
|
|
8
8
|
class GithubUploadTarget(UploadTarget):
|
|
9
9
|
"""Upload target implementation for GitHub releases."""
|
|
10
|
+
|
|
10
11
|
def upload(self, version: str, **kwargs) -> None: # type: ignore
|
|
11
12
|
from quickpub.proxy import cm
|
|
12
13
|
from quickpub.enforcers import exit_if
|
|
@@ -14,27 +15,32 @@ class GithubUploadTarget(UploadTarget):
|
|
|
14
15
|
logger.info("Starting GitHub upload for version '%s'", version)
|
|
15
16
|
|
|
16
17
|
if self.verbose:
|
|
17
|
-
logger.
|
|
18
|
+
logger.debug("Staging files for Git commit")
|
|
18
19
|
|
|
19
20
|
ret, stdout, stderr = cm("git add .")
|
|
20
21
|
if ret != 0:
|
|
21
|
-
logger.error("Git add failed with return code %d: %s",
|
|
22
|
+
logger.error("Git add failed with return code %d: %s",
|
|
23
|
+
ret, stderr.decode(encoding='utf8'))
|
|
22
24
|
exit_if(ret != 0, stderr.decode(encoding="utf8"))
|
|
23
25
|
|
|
24
26
|
if self.verbose:
|
|
25
|
-
logger.
|
|
27
|
+
logger.debug(
|
|
28
|
+
"Committing changes with message 'updated to version %s'", version)
|
|
26
29
|
|
|
27
|
-
ret, stdout, stderr = cm(
|
|
30
|
+
ret, stdout, stderr = cm(
|
|
31
|
+
f"git commit -m \"updated to version {version}\"")
|
|
28
32
|
if ret != 0:
|
|
29
|
-
logger.error("Git commit failed with return code %d: %s",
|
|
33
|
+
logger.error("Git commit failed with return code %d: %s",
|
|
34
|
+
ret, stderr.decode(encoding='utf8'))
|
|
30
35
|
exit_if(ret != 0, stderr.decode(encoding="utf8"))
|
|
31
36
|
|
|
32
37
|
if self.verbose:
|
|
33
|
-
logger.
|
|
38
|
+
logger.debug("Pushing changes to GitHub")
|
|
34
39
|
|
|
35
40
|
ret, stdout, stderr = cm("git push")
|
|
36
41
|
if ret != 0:
|
|
37
|
-
logger.error("Git push failed with return code %d: %s",
|
|
42
|
+
logger.error("Git push failed with return code %d: %s",
|
|
43
|
+
ret, stderr.decode(encoding='utf8'))
|
|
38
44
|
exit_if(ret != 0, stderr.decode(encoding="utf8"))
|
|
39
45
|
|
|
40
46
|
logger.info("Successfully uploaded version '%s' to GitHub", version)
|
|
@@ -17,7 +17,8 @@ class PypircUploadTarget(UploadTarget):
|
|
|
17
17
|
from quickpub.proxy import cm
|
|
18
18
|
from quickpub.enforcers import exit_if
|
|
19
19
|
|
|
20
|
-
logger.info(
|
|
20
|
+
logger.info(
|
|
21
|
+
"Starting PyPI upload for package '%s' version '%s'", name, version)
|
|
21
22
|
|
|
22
23
|
self._validate_file_exists()
|
|
23
24
|
self._validate_file_contents()
|
|
@@ -29,35 +30,44 @@ class PypircUploadTarget(UploadTarget):
|
|
|
29
30
|
f"dist/{name}-{version}.tar.gz")
|
|
30
31
|
|
|
31
32
|
if ret != 0:
|
|
32
|
-
logger.error(
|
|
33
|
+
logger.error(
|
|
34
|
+
"PyPI upload failed with return code %d: %s", ret, stderr)
|
|
33
35
|
exit_if(
|
|
34
36
|
ret != 0,
|
|
35
37
|
f"Failed uploading the package to pypi. Try running the following command manually:\n\ttwine upload --config-file .pypirc dist/{name}-{version}.tar.gz"
|
|
36
38
|
)
|
|
37
39
|
|
|
38
|
-
logger.info(
|
|
40
|
+
logger.info(
|
|
41
|
+
"Successfully uploaded package '%s' version '%s' to PyPI", name, version)
|
|
39
42
|
|
|
40
43
|
def _validate_file_exists(self) -> None:
|
|
41
|
-
logger.
|
|
44
|
+
logger.debug("Validating .pypirc file exists at '%s'",
|
|
45
|
+
self.pypirc_file_path)
|
|
42
46
|
if not file_exists(self.pypirc_file_path):
|
|
43
|
-
logger.error(".pypirc file not found at '%s'",
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
logger.error(".pypirc file not found at '%s'",
|
|
48
|
+
self.pypirc_file_path)
|
|
49
|
+
raise RuntimeError(
|
|
50
|
+
f"{self.__class__.__name__} can't find pypirc file at '{self.pypirc_file_path}'")
|
|
51
|
+
logger.debug(".pypirc file found at '%s'", self.pypirc_file_path)
|
|
46
52
|
|
|
47
53
|
def _validate_file_contents(self) -> None:
|
|
48
|
-
logger.
|
|
54
|
+
logger.debug("Validating .pypirc file contents at '%s'",
|
|
55
|
+
self.pypirc_file_path)
|
|
49
56
|
with open(self.pypirc_file_path, "r", encoding="utf8") as f:
|
|
50
57
|
text = f.read()
|
|
51
58
|
if not self.REGEX_PATTERN.match(text):
|
|
52
|
-
logger.error(
|
|
59
|
+
logger.error(
|
|
60
|
+
".pypirc file contents validation failed for '%s'", self.pypirc_file_path)
|
|
53
61
|
raise RuntimeError(
|
|
54
62
|
f"{self.__class__.__name__} checked the contents of '{self.pypirc_file_path}' and it failed to match the following regex: r\"{self.REGEX_PATTERN.pattern}\"")
|
|
55
|
-
logger.
|
|
63
|
+
logger.debug(
|
|
64
|
+
".pypirc file contents validation passed for '%s'", self.pypirc_file_path)
|
|
56
65
|
|
|
57
66
|
def __init__(self, pypirc_file_path: str = "./.pypirc", verbose: bool = False) -> None:
|
|
58
67
|
super().__init__(verbose)
|
|
59
68
|
self.pypirc_file_path = pypirc_file_path
|
|
60
|
-
logger.info("Initialized PypircUploadTarget with pypirc_file_path='%s', verbose=%s",
|
|
69
|
+
logger.info("Initialized PypircUploadTarget with pypirc_file_path='%s', verbose=%s",
|
|
70
|
+
pypirc_file_path, verbose)
|
|
61
71
|
|
|
62
72
|
|
|
63
73
|
__all__ = [
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/build_schemas/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/python_providers/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{quickpub-3.0.5 → quickpub-3.0.6}/quickpub/strategies/implementations/upload_targets/__init__.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|