quickpub 0.8.0__tar.gz → 0.8.2__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.
Files changed (36) hide show
  1. {quickpub-0.8.0/quickpub.egg-info → quickpub-0.8.2}/PKG-INFO +6 -5
  2. {quickpub-0.8.0 → quickpub-0.8.2}/README.md +4 -3
  3. {quickpub-0.8.0 → quickpub-0.8.2}/pyproject.toml +2 -2
  4. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/__main__.py +3 -2
  5. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/enforcers.py +29 -2
  6. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/files.py +4 -4
  7. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/proxy.py +2 -2
  8. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/runnables/common_check.py +5 -7
  9. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/runnables/implementations/mypy.py +5 -9
  10. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/runnables/implementations/pylint.py +5 -9
  11. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/runnables/implementations/unittest.py +4 -3
  12. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/structures/additional_configuration.py +2 -1
  13. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/validators.py +3 -3
  14. {quickpub-0.8.0 → quickpub-0.8.2/quickpub.egg-info}/PKG-INFO +6 -5
  15. {quickpub-0.8.0 → quickpub-0.8.2}/LICENSE +0 -0
  16. {quickpub-0.8.0 → quickpub-0.8.2}/MANIFEST.in +0 -0
  17. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/__init__.py +0 -0
  18. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/classifiers.py +0 -0
  19. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/custom_types.py +0 -0
  20. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/functions.py +0 -0
  21. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/py.typed +0 -0
  22. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/runnables/__init__.py +0 -0
  23. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/runnables/configurable.py +0 -0
  24. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/runnables/has_optional_executable.py +0 -0
  25. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/runnables/implementations/__init__.py +0 -0
  26. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/runnables/implementations/pytest.py +0 -0
  27. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/runnables/runnable.py +0 -0
  28. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/structures/__init__.py +0 -0
  29. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/structures/bound.py +0 -0
  30. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub/structures/version.py +0 -0
  31. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub.egg-info/SOURCES.txt +0 -0
  32. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub.egg-info/dependency_links.txt +0 -0
  33. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub.egg-info/requires.txt +0 -0
  34. {quickpub-0.8.0 → quickpub-0.8.2}/quickpub.egg-info/top_level.txt +0 -0
  35. {quickpub-0.8.0 → quickpub-0.8.2}/setup.cfg +0 -0
  36. {quickpub-0.8.0 → quickpub-0.8.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quickpub
3
- Version: 0.8.0
3
+ Version: 0.8.2
4
4
  Summary: A python package to quickly configure and publish a new package
5
5
  Author-email: danielnachumdev <danielnachumdev@gmail.com>
6
6
  License: MIT License
@@ -30,11 +30,12 @@ Classifier: Development Status :: 3 - Alpha
30
30
  Classifier: Intended Audience :: Developers
31
31
  Classifier: Programming Language :: Python :: 3
32
32
  Classifier: Operating System :: Microsoft :: Windows
33
- Requires-Python: >=3.9.19
33
+ Requires-Python: >=3.8.0
34
34
  Description-Content-Type: text/markdown
35
35
  License-File: LICENSE
36
36
 
37
37
  # quickpub
38
+ **Tested python versions**: `3.8.0`, `3.9.0`, `3.10.13`,
38
39
 
39
40
  Example usage of how this package was published
40
41
  ```python
@@ -53,9 +54,9 @@ def main() -> None:
53
54
  min_python="3.9.19",
54
55
  config=AdditionalConfiguration(
55
56
  runners=[
56
- MypyRunner(),
57
- PylintRunner(),
58
- UnittestRunner(),
57
+ MypyRunner(bound="<15"),
58
+ PylintRunner(bound=">=0.8"),
59
+ UnittestRunner(bound=">=0.8"),
59
60
  ]
60
61
  )
61
62
  )
@@ -1,4 +1,5 @@
1
1
  # quickpub
2
+ **Tested python versions**: `3.8.0`, `3.9.0`, `3.10.13`,
2
3
 
3
4
  Example usage of how this package was published
4
5
  ```python
@@ -17,9 +18,9 @@ def main() -> None:
17
18
  min_python="3.9.19",
18
19
  config=AdditionalConfiguration(
19
20
  runners=[
20
- MypyRunner(),
21
- PylintRunner(),
22
- UnittestRunner(),
21
+ MypyRunner(bound="<15"),
22
+ PylintRunner(bound=">=0.8"),
23
+ UnittestRunner(bound=">=0.8"),
23
24
  ]
24
25
  )
25
26
  )
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "quickpub"
7
- version = "0.8.0"
7
+ version = "0.8.2"
8
8
  authors = [
9
9
  { name = "danielnachumdev", email = "danielnachumdev@gmail.com" },
10
10
  ]
@@ -13,7 +13,7 @@ keywords = []
13
13
  license = { "file" = "./LICENSE" }
14
14
  description = "A python package to quickly configure and publish a new package"
15
15
  readme = {file = "./README.md", content-type = "text/markdown"}
16
- requires-python = ">=3.9.19"
16
+ requires-python = ">=3.8.0"
17
17
  classifiers = [
18
18
  "Development Status :: 3 - Alpha",
19
19
  "Intended Audience :: Developers",
@@ -1,5 +1,6 @@
1
1
  from typing import Optional, Union
2
2
  from danielutils import warning, file_exists
3
+ from danielutils.versioned_imports import t_list
3
4
  from .validators import validate_version, validate_python_version, validate_keywords, validate_dependencies, \
4
5
  validate_source
5
6
  from .functions import build, upload, commit, metrics
@@ -24,8 +25,8 @@ def publish(
24
25
 
25
26
  min_python: Optional[Union[Version, str]] = None,
26
27
 
27
- keywords: Optional[list[str]] = None,
28
- dependencies: Optional[list[str]] = None,
28
+ keywords: Optional[t_list[str]] = None,
29
+ dependencies: Optional[t_list[str]] = None,
29
30
  config: Optional[AdditionalConfiguration] = None
30
31
  ) -> None:
31
32
  """The main function of this package. will do all the heavy lifting in order for you to publish your package.
@@ -3,7 +3,7 @@ from typing import Union, Callable
3
3
 
4
4
  import requests
5
5
  # from bs4 import BeautifulSoup
6
- from danielutils import directory_exists, get_files, error, file_exists
6
+ from danielutils import directory_exists, get_files, error, file_exists, get_python_version
7
7
  from .structures import Version
8
8
  from .proxy import get
9
9
 
@@ -14,11 +14,38 @@ def exit_if(predicate: Union[bool, Callable[[], bool]], msg: str) -> None:
14
14
  sys.exit(1)
15
15
 
16
16
 
17
+ def _remove_suffix(s: str, suffix: str) -> str:
18
+ """
19
+ This function is needed because str.removesuffix is not implemented in python == 3.8.0
20
+ :param s: string to remove from
21
+ :param suffix: substring to remove
22
+ :return: modified string
23
+ """
24
+ if get_python_version() >= (3, 9):
25
+ return s.removesuffix(suffix)
26
+ return _remove_prefix(s[::-1], suffix[::-1])[::-1]
27
+
28
+
29
+ def _remove_prefix(s: str, prefix: str) -> str:
30
+ """
31
+
32
+ :param s:
33
+ :param prefix:
34
+ :return:
35
+ """
36
+ if get_python_version() >= (3, 9):
37
+ return s.removeprefix(prefix)
38
+
39
+ if s.startswith(prefix):
40
+ return s[len(prefix):]
41
+ return s
42
+
43
+
17
44
  def enforce_local_correct_version(name: str, version: Version) -> None:
18
45
  if directory_exists("./dist"):
19
46
  max_version = Version(0, 0, 0)
20
47
  for d in get_files("./dist"):
21
- d = d.removeprefix(f"{name}-").removesuffix(".tar.gz")
48
+ d = _remove_suffix(_remove_prefix(d, f"{name}-"), ".tar.gz")
22
49
  v = Version.from_str(d)
23
50
  max_version = max(max_version, v)
24
51
  exit_if(
@@ -2,7 +2,7 @@ from .custom_types import Path
2
2
  from .classifiers import Classifier
3
3
  from .structures import Version
4
4
  from danielutils import get_files
5
-
5
+ from danielutils.versioned_imports import t_list
6
6
 
7
7
  def create_toml(
8
8
  *,
@@ -15,10 +15,10 @@ def create_toml(
15
15
  author_email: str,
16
16
  description: str,
17
17
  homepage: str,
18
- keywords: list[str],
18
+ keywords: t_list[str],
19
19
  min_python: Version,
20
- dependencies: list[str],
21
- classifiers: list[Classifier]
20
+ dependencies: t_list[str],
21
+ classifiers: t_list[Classifier]
22
22
  ) -> None:
23
23
  classifiers_string = ",\n\t".join([f"\"{str(c)}\"" for c in classifiers])
24
24
  if len(classifiers_string) > 0:
@@ -1,9 +1,9 @@
1
1
  import danielutils
2
2
  import requests
3
-
3
+ from danielutils.versioned_imports import t_tuple
4
4
 
5
5
  # need it like this for the testing
6
- def cm(*args, **kwargs) -> tuple[int, bytes, bytes]:
6
+ def cm(*args, **kwargs) -> t_tuple[int, bytes, bytes]:
7
7
  return danielutils.cm(*args, **kwargs)
8
8
 
9
9
 
@@ -1,8 +1,8 @@
1
- import os
2
1
  from abc import abstractmethod
3
2
  from typing import Optional, Union
4
3
 
5
- from danielutils import file_exists, cm, info, get_current_working_directory, set_current_working_directory
4
+ from danielutils import cm, info
5
+ from danielutils.versioned_imports import t_list
6
6
 
7
7
  from .has_optional_executable import HasOptionalExecutable
8
8
  from .runnable import Runnable
@@ -27,13 +27,11 @@ class CommonCheck(Runnable, Configurable, HasOptionalExecutable):
27
27
  command += f" {target}"
28
28
  return command
29
29
 
30
- @abstractmethod
31
30
  def _pre_command(self):
32
- ...
31
+ pass
33
32
 
34
- @abstractmethod
35
33
  def _post_command(self):
36
- ...
34
+ pass
37
35
 
38
36
  def run(self, target: str, *_) -> None:
39
37
  command = self._build_command(target)
@@ -49,7 +47,7 @@ class CommonCheck(Runnable, Configurable, HasOptionalExecutable):
49
47
 
50
48
 
51
49
  @abstractmethod
52
- def _calculate_score(self, ret: int, command_output: list[str]) -> float: ...
50
+ def _calculate_score(self, ret: int, command_output: t_list[str]) -> float: ...
53
51
 
54
52
 
55
53
  __all__ = [
@@ -1,21 +1,17 @@
1
1
  import re
2
2
  from typing import Optional
3
+ from danielutils.versioned_imports import t_list
3
4
  from ..common_check import CommonCheck
4
5
 
5
6
 
6
7
  class MypyRunner(CommonCheck):
7
- def _pre_command(self):
8
- pass
9
-
10
- def _post_command(self):
11
- pass
12
-
13
8
  RATING_PATTERN: re.Pattern = re.compile(r".*?([\d\.\/]+)")
14
9
 
15
- def __init__(self, configuration_path: Optional[str] = None, executable_path: Optional[str] = None) -> None:
16
- CommonCheck.__init__(self, "mypy","<15", configuration_path, executable_path)
10
+ def __init__(self, bound: str = "<15", configuration_path: Optional[str] = None,
11
+ executable_path: Optional[str] = None) -> None:
12
+ CommonCheck.__init__(self, "mypy", bound, configuration_path, executable_path)
17
13
 
18
- def _calculate_score(self, ret, lines: list[str]) -> float:
14
+ def _calculate_score(self, ret, lines: t_list[str]) -> float:
19
15
  from ...enforcers import exit_if
20
16
  rating_line = lines[-1]
21
17
  exit_if(not (m := self.RATING_PATTERN.match(rating_line)),
@@ -1,21 +1,17 @@
1
1
  import re
2
2
  from typing import Optional
3
+ from danielutils.versioned_imports import t_list
3
4
  from ..common_check import CommonCheck
4
5
 
5
6
 
6
7
  class PylintRunner(CommonCheck):
7
- def _pre_command(self):
8
- pass
9
-
10
- def _post_command(self):
11
- pass
12
-
13
- def __init__(self, configuration_path: Optional[str] = None, executable_path: Optional[str] = None) -> None:
14
- CommonCheck.__init__(self, "pylint",">=0.8", configuration_path, executable_path)
8
+ def __init__(self, bound: str = ">=0.8", configuration_path: Optional[str] = None,
9
+ executable_path: Optional[str] = None) -> None:
10
+ CommonCheck.__init__(self, "pylint", bound, configuration_path, executable_path)
15
11
 
16
12
  RATING_PATTERN: re.Pattern = re.compile(r".*?([\d\.\/]+)")
17
13
 
18
- def _calculate_score(self, ret: int, lines: list[str]) -> float:
14
+ def _calculate_score(self, ret: int, lines: t_list[str]) -> float:
19
15
  from ...enforcers import exit_if
20
16
  rating_line = lines[-2]
21
17
  exit_if(not (m := self.RATING_PATTERN.match(rating_line)),
@@ -2,6 +2,7 @@ import re
2
2
  import os
3
3
  from typing import Optional
4
4
  from danielutils import get_current_working_directory, set_current_working_directory
5
+ from danielutils.versioned_imports import t_list
5
6
  from ..common_check import CommonCheck
6
7
 
7
8
 
@@ -15,8 +16,8 @@ class UnittestRunner(CommonCheck):
15
16
 
16
17
  RATING_PATTERN: re.Pattern = re.compile(r".*?([\d\.\/]+)")
17
18
 
18
- def __init__(self, target: Optional[str] = "./tests") -> None:
19
- CommonCheck.__init__(self, "unittest", ">=0.7", target)
19
+ def __init__(self, target: Optional[str] = "./tests", bound: str = ">=0.8") -> None:
20
+ CommonCheck.__init__(self, "unittest", bound, target)
20
21
  self._cwd = ""
21
22
 
22
23
  def _build_command(self, src: str, *args) -> str:
@@ -25,7 +26,7 @@ class UnittestRunner(CommonCheck):
25
26
  command += f" discover -s {rel}"
26
27
  return command # f"cd {self.target}; {command}" # f"; cd {self.target}"
27
28
 
28
- def _calculate_score(self, ret: int, lines: list[str]) -> float:
29
+ def _calculate_score(self, ret: int, lines: t_list[str]) -> float:
29
30
  from ...enforcers import exit_if
30
31
  num_tests_line = lines[-3]
31
32
  num_failed_line = lines[-1] if lines[-1] != "OK" else "0"
@@ -1,11 +1,12 @@
1
1
  from dataclasses import dataclass
2
2
  from typing import Optional
3
+ from danielutils.versioned_imports import t_list
3
4
  from ..runnables import Runnable
4
5
 
5
6
 
6
7
  @dataclass(frozen=True)
7
8
  class AdditionalConfiguration:
8
- runners: Optional[list[Runnable]]
9
+ runners: Optional[t_list[Runnable]]
9
10
 
10
11
 
11
12
  __all__ = [
@@ -1,7 +1,7 @@
1
1
  from typing import Optional, Union
2
2
 
3
3
  from danielutils import get_python_version
4
-
4
+ from danielutils.versioned_imports import t_list
5
5
  from .custom_types import Path
6
6
  from .structures import Version
7
7
 
@@ -20,13 +20,13 @@ def validate_python_version(min_python: Optional[Version]) -> Version:
20
20
  return Version(*get_python_version())
21
21
 
22
22
 
23
- def validate_keywords(keywords: Optional[list[str]]) -> list[str]:
23
+ def validate_keywords(keywords: Optional[t_list[str]]) -> t_list[str]:
24
24
  if keywords is None:
25
25
  return []
26
26
  return keywords
27
27
 
28
28
 
29
- def validate_dependencies(dependencies: Optional[list[str]]) -> list[str]:
29
+ def validate_dependencies(dependencies: Optional[t_list[str]]) -> t_list[str]:
30
30
  if dependencies is None:
31
31
  return []
32
32
  return dependencies
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quickpub
3
- Version: 0.8.0
3
+ Version: 0.8.2
4
4
  Summary: A python package to quickly configure and publish a new package
5
5
  Author-email: danielnachumdev <danielnachumdev@gmail.com>
6
6
  License: MIT License
@@ -30,11 +30,12 @@ Classifier: Development Status :: 3 - Alpha
30
30
  Classifier: Intended Audience :: Developers
31
31
  Classifier: Programming Language :: Python :: 3
32
32
  Classifier: Operating System :: Microsoft :: Windows
33
- Requires-Python: >=3.9.19
33
+ Requires-Python: >=3.8.0
34
34
  Description-Content-Type: text/markdown
35
35
  License-File: LICENSE
36
36
 
37
37
  # quickpub
38
+ **Tested python versions**: `3.8.0`, `3.9.0`, `3.10.13`,
38
39
 
39
40
  Example usage of how this package was published
40
41
  ```python
@@ -53,9 +54,9 @@ def main() -> None:
53
54
  min_python="3.9.19",
54
55
  config=AdditionalConfiguration(
55
56
  runners=[
56
- MypyRunner(),
57
- PylintRunner(),
58
- UnittestRunner(),
57
+ MypyRunner(bound="<15"),
58
+ PylintRunner(bound=">=0.8"),
59
+ UnittestRunner(bound=">=0.8"),
59
60
  ]
60
61
  )
61
62
  )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes