quickpub 0.5.2__tar.gz → 0.6.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quickpub
3
- Version: 0.5.2
3
+ Version: 0.6.0
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "quickpub"
7
- version = "0.5.2"
7
+ version = "0.6.0"
8
8
  authors = [
9
9
  { name = "danielnachumdev", email = "danielnachumdev@gmail.com" },
10
10
  ]
@@ -23,6 +23,8 @@ classifiers = [
23
23
 
24
24
  [tool.setuptools]
25
25
  packages = ["quickpub"]
26
+ [tool.setuptools.package-data]
27
+ "quickpub" = ["py.typed"]
26
28
 
27
29
  [project.urls]
28
30
  "Homepage" = "https://github.com/danielnachumdev/quickpub"
@@ -1,14 +1,16 @@
1
1
  from typing import Optional, Union, cast
2
- from danielutils import get_python_version
2
+ from danielutils import error, get_python_version, get_files, directory_exists
3
3
  from .publish import build, upload, commit, metrics
4
4
  from .structures import Version, Config
5
5
  from .files import create_toml, create_setup
6
6
  from .classifiers import *
7
+ from .enforce_version import enforce_correct_version
7
8
 
8
9
 
9
10
  def publish(
10
11
  *,
11
12
  name: str,
13
+ src: str,
12
14
  version: Optional[Union[Version, str]] = None,
13
15
  author: str,
14
16
  author_email: str,
@@ -26,6 +28,8 @@ def publish(
26
28
  else:
27
29
  version: Version = version if isinstance(version, Version) else Version.from_str(version) # type: ignore
28
30
 
31
+ enforce_correct_version(name, version)
32
+
29
33
  if min_python is None:
30
34
  min_python = Version(*get_python_version())
31
35
 
@@ -38,6 +42,7 @@ def publish(
38
42
  create_setup()
39
43
  create_toml(
40
44
  name=name,
45
+ src=src,
41
46
  version=version,
42
47
  author=author,
43
48
  author_email=author_email,
@@ -0,0 +1,23 @@
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
+ ]
@@ -2,11 +2,13 @@ from typing import Optional
2
2
 
3
3
  from .classifiers import Classifier
4
4
  from .structures import Version
5
+ from danielutils import get_files
5
6
 
6
7
 
7
8
  def create_toml(
8
9
  *,
9
10
  name: str,
11
+ src: str,
10
12
  version: Version,
11
13
  author: str,
12
14
  author_email: str,
@@ -20,6 +22,13 @@ def create_toml(
20
22
  classifiers_string = ",\n\t".join([f"\"{str(c)}\"" for c in classifiers])
21
23
  if len(classifiers_string) > 0:
22
24
  classifiers_string = f"\n\t{classifiers_string}\n"
25
+ py_typed = ""
26
+ for file in get_files(src):
27
+ if file == "py.typed":
28
+ py_typed = f"""[tool.setuptools.package-data]
29
+ "{name}" = ["py.typed"]"""
30
+ break
31
+
23
32
  s = f"""[build-system]
24
33
  requires = ["setuptools>=61.0"]
25
34
  build-backend = "setuptools.build_meta"
@@ -40,6 +49,7 @@ classifiers = [{classifiers_string}]
40
49
 
41
50
  [tool.setuptools]
42
51
  packages = ["{name}"]
52
+ {py_typed}
43
53
 
44
54
  [project.urls]
45
55
  "Homepage" = "{homepage}"
@@ -2,7 +2,7 @@ import danielutils
2
2
 
3
3
 
4
4
  # need it like this for the testing
5
- def cm(*args, **kwargs)->tuple[int,bytes,bytes]:
5
+ def cm(*args, **kwargs) -> tuple[int, bytes, bytes]:
6
6
  return danielutils.cm(*args, **kwargs)
7
7
 
8
8
 
File without changes
@@ -1,7 +1,7 @@
1
1
  from dataclasses import dataclass
2
2
 
3
3
 
4
- @dataclass
4
+ @dataclass(order=True)
5
5
  class Version:
6
6
  @staticmethod
7
7
  def from_str(version_str: str) -> "Version":
@@ -21,7 +21,6 @@ class Config:
21
21
  mypy: bool = False
22
22
 
23
23
 
24
-
25
24
  __all__ = [
26
25
  "Version",
27
26
  "Config",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quickpub
3
- Version: 0.5.2
3
+ Version: 0.6.0
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
@@ -4,9 +4,11 @@ setup.py
4
4
  quickpub/__init__.py
5
5
  quickpub/__main__.py
6
6
  quickpub/classifiers.py
7
+ quickpub/enforce_version.py
7
8
  quickpub/files.py
8
9
  quickpub/proxy.py
9
10
  quickpub/publish.py
11
+ quickpub/py.typed
10
12
  quickpub/structures.py
11
13
  quickpub.egg-info/PKG-INFO
12
14
  quickpub.egg-info/SOURCES.txt
File without changes
File without changes
File without changes
File without changes
File without changes