instant-python 0.9.0__py3-none-any.whl → 0.9.2__py3-none-any.whl
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.
- instant_python/cli/__init__.py +0 -0
- instant_python/{cli.py → cli/cli.py} +1 -1
- instant_python/templates/boilerplate/fastapi/success_response.py +1 -1
- instant_python/templates/boilerplate/github/ci.yml +1 -1
- instant_python/templates/boilerplate/github/release.yml +15 -23
- instant_python/templates/boilerplate/pyproject.toml +4 -2
- instant_python/templates/boilerplate/pytest.ini +1 -1
- instant_python/templates/boilerplate/random_generator.py +13 -4
- instant_python/templates/boilerplate/value_object/int_primitives_mother.py +8 -0
- instant_python/templates/boilerplate/value_object/string_primitives_mother.py +8 -0
- instant_python/templates/boilerplate/value_object/test_int_value_object.py +85 -0
- instant_python/templates/boilerplate/value_object/test_string_value_object.py +75 -0
- instant_python/templates/boilerplate/value_object/test_uuid_value_object.py +88 -0
- instant_python/templates/boilerplate/value_object/uuid_primitives_mother.py +12 -0
- instant_python/templates/boilerplate/value_object/value_object.py +8 -0
- instant_python/templates/project_structure/clean_architecture/test.yml.j2 +9 -4
- instant_python/templates/project_structure/domain_driven_design/test.yml.j2 +3 -0
- instant_python/templates/project_structure/makefile.yml.j2 +1 -1
- instant_python/templates/project_structure/standard_project/test.yml.j2 +4 -0
- instant_python/templates/project_structure/test_value_objects.yml.j2 +26 -0
- {instant_python-0.9.0.dist-info → instant_python-0.9.2.dist-info}/METADATA +4 -2
- {instant_python-0.9.0.dist-info → instant_python-0.9.2.dist-info}/RECORD +26 -18
- instant_python-0.9.2.dist-info/entry_points.txt +2 -0
- instant_python-0.9.0.dist-info/entry_points.txt +0 -2
- /instant_python/{instant_python_typer.py → cli/instant_python_typer.py} +0 -0
- {instant_python-0.9.0.dist-info → instant_python-0.9.2.dist-info}/WHEEL +0 -0
- {instant_python-0.9.0.dist-info → instant_python-0.9.2.dist-info}/licenses/LICENSE +0 -0
|
File without changes
|
|
@@ -3,7 +3,7 @@ from rich.panel import Panel
|
|
|
3
3
|
|
|
4
4
|
from instant_python.commands import init, config
|
|
5
5
|
from instant_python.shared.application_error import ApplicationError
|
|
6
|
-
from instant_python.instant_python_typer import InstantPythonTyper
|
|
6
|
+
from instant_python.cli.instant_python_typer import InstantPythonTyper
|
|
7
7
|
|
|
8
8
|
app = InstantPythonTyper()
|
|
9
9
|
console = Console()
|
|
@@ -19,12 +19,9 @@ jobs:
|
|
|
19
19
|
runs-on: ubuntu-latest
|
|
20
20
|
permissions:
|
|
21
21
|
contents: write
|
|
22
|
-
pull-requests: write
|
|
23
|
-
|
|
24
22
|
outputs:
|
|
25
|
-
released:
|
|
26
|
-
|
|
27
|
-
tag: {% raw %}${{ steps.released.outputs.tag }}{% endraw %}
|
|
23
|
+
released: ${{ steps.released.outputs.released }}
|
|
24
|
+
tag: ${{ steps.released.outputs.tag }}
|
|
28
25
|
|
|
29
26
|
steps:
|
|
30
27
|
- name: 🛡️ Harden runner
|
|
@@ -38,34 +35,30 @@ jobs:
|
|
|
38
35
|
fetch-depth: 0
|
|
39
36
|
persist-credentials: false
|
|
40
37
|
|
|
41
|
-
- name: 🔖
|
|
38
|
+
- name: 🔖 Create release
|
|
42
39
|
id: released
|
|
43
40
|
uses: python-semantic-release/python-semantic-release@2896129e02bb7809d2cf0c1b8e9e795ee27acbcf # v10.0.2
|
|
44
41
|
with:
|
|
45
|
-
build:
|
|
42
|
+
build: true
|
|
46
43
|
push: true
|
|
47
44
|
changelog: true
|
|
48
45
|
commit: true
|
|
49
46
|
tag: true
|
|
50
47
|
vcs_release: true
|
|
51
48
|
config_file: pyproject.toml
|
|
52
|
-
github_token:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
ssh_public_signing_key: {% raw %}${{ vars.SSH_PUBLIC_SIGNING_KEY }}{% endraw %}
|
|
59
|
-
|
|
60
|
-
ssh_private_signing_key: {% raw %}${{ secrets.SSH_PRIVATE_SIGNING_KEY }}{% endraw %}
|
|
49
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
50
|
+
git_committer_email: ${{ vars.GIT_COMMITTER_EMAIL }}
|
|
51
|
+
git_committer_name: ${{ vars.GIT_COMMITTER_NAME }}
|
|
52
|
+
ssh_public_signing_key: ${{ vars.SSH_PUBLIC_SIGNING_KEY }}
|
|
53
|
+
ssh_private_signing_key: ${{ secrets.SSH_PRIVATE_SIGNING_KEY }}
|
|
61
54
|
|
|
62
55
|
build-and-publish:
|
|
63
|
-
name: Publish
|
|
64
|
-
needs:
|
|
65
|
-
|
|
56
|
+
name: Publish to PyPI
|
|
57
|
+
needs:
|
|
58
|
+
- release
|
|
59
|
+
if: needs.release.outputs.released == 'true'
|
|
66
60
|
runs-on: ubuntu-latest
|
|
67
61
|
environment: release
|
|
68
|
-
|
|
69
62
|
permissions:
|
|
70
63
|
id-token: write
|
|
71
64
|
|
|
@@ -80,8 +73,7 @@ jobs:
|
|
|
80
73
|
with:
|
|
81
74
|
fetch-depth: 0
|
|
82
75
|
persist-credentials: false
|
|
83
|
-
ref:
|
|
84
|
-
|
|
76
|
+
ref: refs/tags/${{ needs.release.outputs.tag }}
|
|
85
77
|
|
|
86
78
|
- name: 🛠️ Setup environment
|
|
87
79
|
uses: ./.github/actions/python_setup
|
|
@@ -90,4 +82,4 @@ jobs:
|
|
|
90
82
|
run: uv build
|
|
91
83
|
|
|
92
84
|
- name: 🚀 Publish
|
|
93
|
-
uses: pypa/gh-action-pypi-publish@release/v1
|
|
85
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -72,6 +72,9 @@ test = [
|
|
|
72
72
|
{% endif %}
|
|
73
73
|
|
|
74
74
|
{% if "github_actions" in template.built_in_features %}
|
|
75
|
+
[project.optional-dependencies]
|
|
76
|
+
build = ["uv>=0.7.21"]
|
|
77
|
+
|
|
75
78
|
[tool.semantic_release]
|
|
76
79
|
version_toml = ["pyproject.toml:project.version"]
|
|
77
80
|
commit_message = "bump: new version {version} created"
|
|
@@ -84,8 +87,8 @@ build_command = """
|
|
|
84
87
|
pip install -e '.[build]'
|
|
85
88
|
uv lock --upgrade-package instant-python
|
|
86
89
|
git add uv.lock
|
|
87
|
-
uv build
|
|
88
90
|
"""
|
|
91
|
+
|
|
89
92
|
[tool.semantic_release.commit_parser_options]
|
|
90
93
|
minor_tags = ["feat"]
|
|
91
94
|
patch_tags = ["fix", "perf", "refactor", "test", "build"]
|
|
@@ -95,7 +98,6 @@ parse_squash_commits = false
|
|
|
95
98
|
ignore_merge_commits = true
|
|
96
99
|
|
|
97
100
|
[tool.semantic_release.changelog]
|
|
98
|
-
changelog_file = "CHANGELOG.md"
|
|
99
101
|
exclude_commit_patterns = ['''^Merge pull request #''', '''^Merge branch ''']
|
|
100
102
|
mode = "update"
|
|
101
103
|
#template_dir = "docs/changelog"
|
|
@@ -2,8 +2,17 @@ from faker import Faker
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class RandomGenerator:
|
|
5
|
-
|
|
5
|
+
faker = Faker()
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
@classmethod
|
|
8
|
+
def uuid(cls) -> str:
|
|
9
|
+
return cls.faker.uuid4()
|
|
10
|
+
|
|
11
|
+
@classmethod
|
|
12
|
+
def word(cls) -> str:
|
|
13
|
+
return cls.faker.word()
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@classmethod
|
|
17
|
+
def positive_integer(cls, minimum: int = 0, maximum: int = 100) -> int:
|
|
18
|
+
return cls.faker.pyint(min_value=minimum, max_value=maximum)
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{% set template_domain_import = "shared.domain"|compute_base_path(template.name) %}
|
|
2
|
+
from test.{{ template_domain_import }}.random_generator import RandomGenerator
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class IntPrimitivesMother:
|
|
6
|
+
@staticmethod
|
|
7
|
+
def any() -> int:
|
|
8
|
+
return RandomGenerator.positive_integer()
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{% set template_domain_import = "shared.domain"|compute_base_path(template.name) %}
|
|
2
|
+
from test.{{ template_domain_import }}.random_generator import RandomGenerator
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class StringPrimitivesMother:
|
|
6
|
+
@staticmethod
|
|
7
|
+
def any() -> str:
|
|
8
|
+
return RandomGenerator.word()
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{% set template_domain_import = "shared.domain"|compute_base_path(template.name) %}
|
|
2
|
+
import pytest
|
|
3
|
+
{% if dependencies | has_dependency("expects") %}
|
|
4
|
+
from expects import expect, equal, raise_error
|
|
5
|
+
{% endif %}
|
|
6
|
+
|
|
7
|
+
from {{ general.source_name }}.{{ template_domain_import }}.errors.incorrect_value_type_error import (
|
|
8
|
+
IncorrectValueTypeError,
|
|
9
|
+
)
|
|
10
|
+
from {{ general.source_name }}.{{ template_domain_import }}.errors.invalid_negative_value_error import (
|
|
11
|
+
InvalidNegativeValueError,
|
|
12
|
+
)
|
|
13
|
+
from {{ general.source_name }}.{{ template_domain_import }}.errors.required_value_error import RequiredValueError
|
|
14
|
+
from {{ general.source_name }}.{{ template_domain_import }}.value_objects.usables.int_value_object import (
|
|
15
|
+
IntValueObject,
|
|
16
|
+
)
|
|
17
|
+
from test.{{ template_domain_import }}.value_objects.int_primitives_mother import (
|
|
18
|
+
IntPrimitivesMother,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.mark.unit
|
|
23
|
+
class TestIntValueObject:
|
|
24
|
+
{% if dependencies | has_dependency("expects") %}
|
|
25
|
+
def test_should_create_int_value_object(self) -> None:
|
|
26
|
+
value = IntPrimitivesMother.any()
|
|
27
|
+
|
|
28
|
+
integer = IntValueObject(value)
|
|
29
|
+
|
|
30
|
+
expect(integer.value).to(equal(value))
|
|
31
|
+
|
|
32
|
+
def test_should_raise_error_when_value_is_none(self) -> None:
|
|
33
|
+
expect(lambda: IntValueObject(None)).to(raise_error(RequiredValueError))
|
|
34
|
+
|
|
35
|
+
def test_should_raise_error_when_value_is_not_integer(self) -> None:
|
|
36
|
+
expect(lambda: IntValueObject("123")).to(raise_error(IncorrectValueTypeError))
|
|
37
|
+
|
|
38
|
+
def test_should_raise_error_if_int_value_is_negative(self) -> None:
|
|
39
|
+
expect(lambda: IntValueObject(-1)).to(raise_error(InvalidNegativeValueError))
|
|
40
|
+
|
|
41
|
+
def test_should_compare_equal_with_same_value(self) -> None:
|
|
42
|
+
common_value = IntPrimitivesMother.any()
|
|
43
|
+
first_integer = IntValueObject(common_value)
|
|
44
|
+
second_integer = IntValueObject(common_value)
|
|
45
|
+
|
|
46
|
+
expect(first_integer).to(equal(second_integer))
|
|
47
|
+
|
|
48
|
+
def test_should_not_be_equal_with_different_values(self) -> None:
|
|
49
|
+
first_integer = IntValueObject(IntPrimitivesMother.any())
|
|
50
|
+
second_integer = IntValueObject(IntPrimitivesMother.any())
|
|
51
|
+
|
|
52
|
+
expect(first_integer).to_not(equal(second_integer))
|
|
53
|
+
{% else %}
|
|
54
|
+
def test_should_create_int_value_object(self) -> None:
|
|
55
|
+
value = IntPrimitivesMother.any()
|
|
56
|
+
|
|
57
|
+
integer = IntValueObject(value)
|
|
58
|
+
|
|
59
|
+
assert integer.value == value
|
|
60
|
+
|
|
61
|
+
def test_should_raise_error_when_value_is_none(self) -> None:
|
|
62
|
+
with pytest.raises(RequiredValueError):
|
|
63
|
+
IntValueObject(None)
|
|
64
|
+
|
|
65
|
+
def test_should_raise_error_when_value_is_not_integer(self) -> None:
|
|
66
|
+
with pytest.raises(IncorrectValueTypeError):
|
|
67
|
+
IntValueObject("123")
|
|
68
|
+
|
|
69
|
+
def test_should_raise_error_if_int_value_is_negative(self) -> None:
|
|
70
|
+
with pytest.raises(InvalidNegativeValueError):
|
|
71
|
+
IntValueObject(-1)
|
|
72
|
+
|
|
73
|
+
def test_should_compare_equal_with_same_value(self) -> None:
|
|
74
|
+
common_value = IntPrimitivesMother.any()
|
|
75
|
+
first_integer = IntValueObject(common_value)
|
|
76
|
+
second_integer = IntValueObject(common_value)
|
|
77
|
+
|
|
78
|
+
assert first_integer == second_integer
|
|
79
|
+
|
|
80
|
+
def test_should_not_be_equal_with_different_values(self) -> None:
|
|
81
|
+
first_integer = IntValueObject(IntPrimitivesMother.any())
|
|
82
|
+
second_integer = IntValueObject(IntPrimitivesMother.any())
|
|
83
|
+
|
|
84
|
+
assert first_integer != second_integer
|
|
85
|
+
{% endif %}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{% set template_domain_import = "shared.domain"|compute_base_path(template.name) %}
|
|
2
|
+
import pytest
|
|
3
|
+
{% if dependencies | has_dependency("expects") %}
|
|
4
|
+
from expects import expect, equal, raise_error
|
|
5
|
+
{% endif %}
|
|
6
|
+
|
|
7
|
+
from {{ general.source_name }}.{{ template_domain_import }}.errors.incorrect_value_type_error import (
|
|
8
|
+
IncorrectValueTypeError,
|
|
9
|
+
)
|
|
10
|
+
from {{ general.source_name }}.{{ template_domain_import }}.errors.required_value_error import RequiredValueError
|
|
11
|
+
from {{ general.source_name }}.{{ template_domain_import }}.value_objects.usables.string_value_object import (
|
|
12
|
+
StringValueObject,
|
|
13
|
+
)
|
|
14
|
+
from test.{{ template_domain_import }}.value_objects.string_primitives_mother import (
|
|
15
|
+
StringPrimitivesMother,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@pytest.mark.unit
|
|
20
|
+
class TestStringValueObject:
|
|
21
|
+
{% if dependencies | has_dependency("expects") %}
|
|
22
|
+
def test_should_create_string_value_object(self) -> None:
|
|
23
|
+
value = StringPrimitivesMother.any()
|
|
24
|
+
|
|
25
|
+
string = StringValueObject(value)
|
|
26
|
+
|
|
27
|
+
expect(string.value).to(equal(value))
|
|
28
|
+
|
|
29
|
+
def test_should_raise_error_when_value_is_none(self) -> None:
|
|
30
|
+
expect(lambda: StringValueObject(None)).to(raise_error(RequiredValueError))
|
|
31
|
+
|
|
32
|
+
def test_should_raise_error_when_value_is_not_string(self) -> None:
|
|
33
|
+
expect(lambda: StringValueObject(123)).to(raise_error(IncorrectValueTypeError))
|
|
34
|
+
|
|
35
|
+
def test_should_compare_equal_with_same_value(self) -> None:
|
|
36
|
+
common_value = StringPrimitivesMother.any()
|
|
37
|
+
first_string = StringValueObject(common_value)
|
|
38
|
+
second_string = StringValueObject(common_value)
|
|
39
|
+
|
|
40
|
+
expect(first_string).to(equal(second_string))
|
|
41
|
+
|
|
42
|
+
def test_should_not_be_equal_with_different_values(self) -> None:
|
|
43
|
+
first_string = StringValueObject(StringPrimitivesMother.any())
|
|
44
|
+
second_string = StringValueObject(StringPrimitivesMother.any())
|
|
45
|
+
|
|
46
|
+
expect(first_string).to_not(equal(second_string))
|
|
47
|
+
{% else %}
|
|
48
|
+
def test_should_create_string_value_object(self) -> None:
|
|
49
|
+
value = StringPrimitivesMother.any()
|
|
50
|
+
|
|
51
|
+
string = StringValueObject(value)
|
|
52
|
+
|
|
53
|
+
assert string.value == value
|
|
54
|
+
|
|
55
|
+
def test_should_raise_error_when_value_is_none(self) -> None:
|
|
56
|
+
with pytest.raises(RequiredValueError):
|
|
57
|
+
StringValueObject(None)
|
|
58
|
+
|
|
59
|
+
def test_should_raise_error_when_value_is_not_string(self) -> None:
|
|
60
|
+
with pytest.raises(IncorrectValueTypeError):
|
|
61
|
+
StringValueObject(123)
|
|
62
|
+
|
|
63
|
+
def test_should_compare_equal_with_same_value(self) -> None:
|
|
64
|
+
common_value = StringPrimitivesMother.any()
|
|
65
|
+
first_string = StringValueObject(common_value)
|
|
66
|
+
second_string = StringValueObject(common_value)
|
|
67
|
+
|
|
68
|
+
assert first_string == second_string
|
|
69
|
+
|
|
70
|
+
def test_should_not_be_equal_with_different_values(self) -> None:
|
|
71
|
+
first_string = StringValueObject(StringPrimitivesMother.any())
|
|
72
|
+
second_string = StringValueObject(StringPrimitivesMother.any())
|
|
73
|
+
|
|
74
|
+
assert first_string != second_string
|
|
75
|
+
{% endif %}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{% set template_domain_import = "shared.domain"|compute_base_path(template.name) %}
|
|
2
|
+
import pytest
|
|
3
|
+
{% if dependencies | has_dependency("expects") %}
|
|
4
|
+
from expects import expect, equal, raise_error
|
|
5
|
+
{% endif %}
|
|
6
|
+
|
|
7
|
+
from {{ general.source_name }}.{{ template_domain_import }}.errors.incorrect_value_type_error import (
|
|
8
|
+
IncorrectValueTypeError,
|
|
9
|
+
)
|
|
10
|
+
from {{ general.source_name }}.{{ template_domain_import }}.errors.invalid_id_format_error import (
|
|
11
|
+
InvalidIdFormatError,
|
|
12
|
+
)
|
|
13
|
+
from {{ general.source_name }}.{{ template_domain_import }}.errors.required_value_error import RequiredValueError
|
|
14
|
+
from {{ general.source_name }}.{{ template_domain_import }}.value_objects.usables.uuid import (
|
|
15
|
+
Uuid,
|
|
16
|
+
)
|
|
17
|
+
from test.{{ template_domain_import }}.value_objects.uuid_primitives_mother import (
|
|
18
|
+
UuidPrimitivesMother,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pytest.mark.unit
|
|
23
|
+
class TestUuidValueObject:
|
|
24
|
+
{% if dependencies | has_dependency("expects") %}
|
|
25
|
+
def test_should_create_uuid_value_object(self) -> None:
|
|
26
|
+
value = UuidPrimitivesMother.any()
|
|
27
|
+
|
|
28
|
+
uuid = Uuid(value)
|
|
29
|
+
|
|
30
|
+
expect(uuid.value).to(equal(value))
|
|
31
|
+
|
|
32
|
+
def test_should_raise_error_when_value_is_none(self) -> None:
|
|
33
|
+
expect(lambda: Uuid(None)).to(raise_error(RequiredValueError))
|
|
34
|
+
|
|
35
|
+
def test_should_raise_error_when_value_is_not_string(self) -> None:
|
|
36
|
+
expect(lambda: Uuid(123)).to(raise_error(IncorrectValueTypeError))
|
|
37
|
+
|
|
38
|
+
def test_should_raise_error_when_value_is_not_valid_uuid(self) -> None:
|
|
39
|
+
invalid_uuid = UuidPrimitivesMother.invalid()
|
|
40
|
+
expect(lambda: Uuid(invalid_uuid)).to(raise_error(InvalidIdFormatError))
|
|
41
|
+
|
|
42
|
+
def test_should_compare_equal_with_same_value(self) -> None:
|
|
43
|
+
common_value = UuidPrimitivesMother.any()
|
|
44
|
+
first_uuid = Uuid(common_value)
|
|
45
|
+
second_uuid = Uuid(common_value)
|
|
46
|
+
|
|
47
|
+
expect(first_uuid).to(equal(second_uuid))
|
|
48
|
+
|
|
49
|
+
def test_should_not_be_equal_with_different_values(self) -> None:
|
|
50
|
+
first_uuid = Uuid(UuidPrimitivesMother.any())
|
|
51
|
+
second_uuid = Uuid(UuidPrimitivesMother.any())
|
|
52
|
+
|
|
53
|
+
expect(first_uuid).to_not(equal(second_uuid))
|
|
54
|
+
|
|
55
|
+
{% else %}
|
|
56
|
+
def test_should_create_uuid_value_object(self) -> None:
|
|
57
|
+
value = UuidPrimitivesMother.any()
|
|
58
|
+
|
|
59
|
+
uuid = Uuid(value)
|
|
60
|
+
|
|
61
|
+
assert uuid.value == value
|
|
62
|
+
|
|
63
|
+
def test_should_raise_error_when_value_is_none(self) -> None:
|
|
64
|
+
with pytest.raises(RequiredValueError):
|
|
65
|
+
Uuid(None)
|
|
66
|
+
|
|
67
|
+
def test_should_raise_error_when_value_is_not_string(self) -> None:
|
|
68
|
+
with pytest.raises(IncorrectValueTypeError):
|
|
69
|
+
Uuid(123)
|
|
70
|
+
|
|
71
|
+
def test_should_raise_error_when_value_is_not_valid_uuid(self) -> None:
|
|
72
|
+
invalid_uuid = UuidPrimitivesMother.invalid()
|
|
73
|
+
with pytest.raises(InvalidIdFormatError):
|
|
74
|
+
Uuid(invalid_uuid)
|
|
75
|
+
|
|
76
|
+
def test_should_compare_equal_with_same_value(self) -> None:
|
|
77
|
+
common_value = UuidPrimitivesMother.any()
|
|
78
|
+
first_uuid = Uuid(common_value)
|
|
79
|
+
second_uuid = Uuid(common_value)
|
|
80
|
+
|
|
81
|
+
assert first_uuid == second_uuid
|
|
82
|
+
|
|
83
|
+
def test_should_not_be_equal_with_different_values(self) -> None:
|
|
84
|
+
first_uuid = Uuid(UuidPrimitivesMother.any())
|
|
85
|
+
second_uuid = Uuid(UuidPrimitivesMother.any())
|
|
86
|
+
|
|
87
|
+
assert first_uuid != second_uuid
|
|
88
|
+
{% endif %}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{% set template_domain_import = "shared.domain"|compute_base_path(template.name) %}
|
|
2
|
+
from test.{{ template_domain_import }}.random_generator import RandomGenerator
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class UuidPrimitivesMother:
|
|
6
|
+
@staticmethod
|
|
7
|
+
def any() -> str:
|
|
8
|
+
return RandomGenerator.uuid()
|
|
9
|
+
|
|
10
|
+
@staticmethod
|
|
11
|
+
def invalid() -> str:
|
|
12
|
+
return "00000000-0000-0000-0000"
|
|
@@ -42,6 +42,10 @@ class ValueObject[T](ABC):
|
|
|
42
42
|
def __str__(self) -> str:
|
|
43
43
|
return str(self._value)
|
|
44
44
|
|
|
45
|
+
@override
|
|
46
|
+
def __hash__(self) -> int:
|
|
47
|
+
return hash(self._value)
|
|
48
|
+
|
|
45
49
|
@override
|
|
46
50
|
def __setattr__(self, name: str, value: T) -> None:
|
|
47
51
|
"""Prevents modification of the value after initialization."""
|
|
@@ -101,6 +105,10 @@ class ValueObject(Generic[T], ABC):
|
|
|
101
105
|
@override
|
|
102
106
|
def __str__(self) -> str:
|
|
103
107
|
return str(self._value)
|
|
108
|
+
|
|
109
|
+
@override
|
|
110
|
+
def __hash__(self) -> int:
|
|
111
|
+
return hash(self._value)
|
|
104
112
|
|
|
105
113
|
@override
|
|
106
114
|
def __setattr__(self, name: str, value: T) -> None:
|
|
@@ -3,19 +3,24 @@
|
|
|
3
3
|
type: directory
|
|
4
4
|
python: True
|
|
5
5
|
children:
|
|
6
|
-
- name:
|
|
6
|
+
- name: domain
|
|
7
7
|
type: directory
|
|
8
8
|
python: True
|
|
9
|
-
{% if "event_bus"
|
|
9
|
+
{% if ["value_objects", "event_bus"] | is_in(template.built_in_features) %}
|
|
10
10
|
children:
|
|
11
|
+
{% if "value_objects" in template.built_in_features %}
|
|
12
|
+
{{ macros.include_and_indent("project_structure/test_value_objects.yml.j2", 8) }}
|
|
13
|
+
{% endif %}
|
|
14
|
+
{% if "event_bus" in template.built_in_features %}
|
|
11
15
|
- name: event_bus/mock_event_bus
|
|
12
16
|
type: boilerplate_file
|
|
13
17
|
extension: .py
|
|
14
18
|
{% endif %}
|
|
15
|
-
|
|
19
|
+
{% endif %}
|
|
20
|
+
- name: infrastructure
|
|
16
21
|
type: directory
|
|
17
22
|
python: True
|
|
18
|
-
- name:
|
|
23
|
+
- name: delivery
|
|
19
24
|
type: directory
|
|
20
25
|
python: True
|
|
21
26
|
- name: random_generator
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
- name: random_generator
|
|
15
15
|
type: boilerplate_file
|
|
16
16
|
extension: .py
|
|
17
|
+
{% if "value_objects" in template.built_in_features %}
|
|
18
|
+
{{ macros.include_and_indent("project_structure/test_value_objects.yml.j2", 12) }}
|
|
19
|
+
{% endif %}
|
|
17
20
|
{% if "event_bus" in template.built_in_features %}
|
|
18
21
|
- name: infra
|
|
19
22
|
type: directory
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
- name: scripts/remove_dependency
|
|
11
11
|
type: boilerplate_file
|
|
12
12
|
extension: .py
|
|
13
|
+
{% if "precommit_hook" not in template.built_in_features %}
|
|
13
14
|
- name: scripts/local_setup
|
|
14
15
|
type: boilerplate_file
|
|
15
16
|
extension: .py
|
|
16
|
-
{% if "precommit_hook" not in template.built_in_features %}
|
|
17
17
|
- name: hooks
|
|
18
18
|
type: directory
|
|
19
19
|
children:
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
{% import "project_structure/macros.j2" as macros with context %}
|
|
1
2
|
- name: test
|
|
2
3
|
type: directory
|
|
3
4
|
python: True
|
|
@@ -5,6 +6,9 @@
|
|
|
5
6
|
- name: random_generator
|
|
6
7
|
type: boilerplate_file
|
|
7
8
|
extension: .py
|
|
9
|
+
{% if "value_objects" in template.built_in_features %}
|
|
10
|
+
{{ macros.include_and_indent("project_structure/test_value_objects.yml.j2", 4) }}
|
|
11
|
+
{% endif %}
|
|
8
12
|
{% if "event_bus" in template.built_in_features %}
|
|
9
13
|
- name: event
|
|
10
14
|
type: directory
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
- name: value_objects
|
|
2
|
+
type: directory
|
|
3
|
+
python: True
|
|
4
|
+
children:
|
|
5
|
+
- name: value_object/int_primitives_mother
|
|
6
|
+
type: boilerplate_file
|
|
7
|
+
extension: .py
|
|
8
|
+
- name: value_object/string_primitives_mother
|
|
9
|
+
type: boilerplate_file
|
|
10
|
+
extension: .py
|
|
11
|
+
- name: value_object/uuid_primitives_mother
|
|
12
|
+
type: boilerplate_file
|
|
13
|
+
extension: .py
|
|
14
|
+
- name: usables
|
|
15
|
+
type: directory
|
|
16
|
+
python: True
|
|
17
|
+
children:
|
|
18
|
+
- name: value_object/test_int_value_object
|
|
19
|
+
type: boilerplate_file
|
|
20
|
+
extension: .py
|
|
21
|
+
- name: value_object/test_string_value_object
|
|
22
|
+
type: boilerplate_file
|
|
23
|
+
extension: .py
|
|
24
|
+
- name: value_object/test_uuid_value_object
|
|
25
|
+
type: boilerplate_file
|
|
26
|
+
extension: .py
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: instant-python
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.2
|
|
4
4
|
Summary: Instant boilerplate generation for Python projects
|
|
5
5
|
Project-URL: documentation, https://dimanu-py.github.io/instant-python/
|
|
6
6
|
Project-URL: repository, https://github.com/dimanu-py/instant-python/
|
|
7
|
-
Author-email: dimanu-py <
|
|
7
|
+
Author-email: dimanu-py <dimanu.py@gmail.com>
|
|
8
8
|
License: Apache License
|
|
9
9
|
Version 2.0, January 2004
|
|
10
10
|
http://www.apache.org/licenses/
|
|
@@ -223,6 +223,8 @@ Requires-Dist: jinja2>=3.1.6
|
|
|
223
223
|
Requires-Dist: pyyaml>=6.0.2
|
|
224
224
|
Requires-Dist: questionary>=2.1.0
|
|
225
225
|
Requires-Dist: typer>=0.15.1
|
|
226
|
+
Provides-Extra: build
|
|
227
|
+
Requires-Dist: uv>=0.7.21; extra == 'build'
|
|
226
228
|
Description-Content-Type: text/markdown
|
|
227
229
|
|
|
228
230
|
<div align="center">
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
instant_python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
instant_python/cli.py,sha256=
|
|
3
|
-
instant_python/
|
|
2
|
+
instant_python/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
instant_python/cli/cli.py,sha256=g7-BiXJZBDX0p-_I1U0myiciu6DhwzyAp8X6BGE9bsQ,808
|
|
4
|
+
instant_python/cli/instant_python_typer.py,sha256=jVk2VV8O4WHbyVGGn56D8Id-oo03KriwfmxgPTQOdy4,1230
|
|
4
5
|
instant_python/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
6
|
instant_python/commands/config.py,sha256=m62zbX9A_dKaYdLmYaG89kZqRQmqtVQZyeHCyJOP9pU,1169
|
|
6
7
|
instant_python/commands/init.py,sha256=jdRQufnBG-29abOOkYeVJ8FwrRarQkRSMqsYZ2CGFNw,2356
|
|
@@ -85,9 +86,9 @@ instant_python/templates/boilerplate/LICENSE,sha256=wzw1JFV1qGbnRMfokpku4CO4ZKvt
|
|
|
85
86
|
instant_python/templates/boilerplate/README.md,sha256=qlaO6Tnd8k0A_ccRNVI8yt5Vn1dQP6AwxW_WH80P8Is,238
|
|
86
87
|
instant_python/templates/boilerplate/SECURITY.md,sha256=l2T8a7mcV3PUs1vloUDqFXlRXKseInsT_nR71wlLvGo,2024
|
|
87
88
|
instant_python/templates/boilerplate/mypy.ini,sha256=unPeeeN5XStcdwqobdxtHsPj-Ru1NWPyZ5WF4PbQqik,889
|
|
88
|
-
instant_python/templates/boilerplate/pyproject.toml,sha256=
|
|
89
|
-
instant_python/templates/boilerplate/pytest.ini,sha256=
|
|
90
|
-
instant_python/templates/boilerplate/random_generator.py,sha256=
|
|
89
|
+
instant_python/templates/boilerplate/pyproject.toml,sha256=8qDUpz1_BdFNrDUfQj0LPadKynwVy2pB2z2e_-x-hek,2874
|
|
90
|
+
instant_python/templates/boilerplate/pytest.ini,sha256=Ur7Nw3dUSUSeea9r_woiv0wEsZMQFVs9hfTXtn6Mt74,248
|
|
91
|
+
instant_python/templates/boilerplate/random_generator.py,sha256=Nx5oRA4n9wvv9p2fvqQb9ItSwQ8KF1Lk6Rq1ODmBNjQ,386
|
|
91
92
|
instant_python/templates/boilerplate/event_bus/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
92
93
|
instant_python/templates/boilerplate/event_bus/domain_event.py,sha256=aD4UGS4HWQwQvyfdKLpWN1emDfHUS6NQbYlGXRHVDas,312
|
|
93
94
|
instant_python/templates/boilerplate/event_bus/domain_event_json_deserializer.py,sha256=p7Pn2cVWqkqwm-Y0Cji0m4vHZs8hjtuytzU2gK3k0JU,1081
|
|
@@ -118,12 +119,12 @@ instant_python/templates/boilerplate/fastapi/error_handlers.py,sha256=q3hIbKXMDJ
|
|
|
118
119
|
instant_python/templates/boilerplate/fastapi/error_response.py,sha256=vUy6kC7RFohuDMHSvdZtZnRV2xZoG5fuKbgM1IXGei4,834
|
|
119
120
|
instant_python/templates/boilerplate/fastapi/fastapi_log_middleware.py,sha256=AgE1jacFx7Bqv9TpFbvVWQh19HwidgzEW_LRAn-DWvo,991
|
|
120
121
|
instant_python/templates/boilerplate/fastapi/lifespan.py,sha256=zbsmwtC_9PWJnGlO__5yOqLdEBklnl6f_FUOumy80oE,444
|
|
121
|
-
instant_python/templates/boilerplate/fastapi/success_response.py,sha256=
|
|
122
|
+
instant_python/templates/boilerplate/fastapi/success_response.py,sha256=3K-Xw-fRV0Z9S2p1Oi201pwvhDsA5JL35WwBTfwyFUA,259
|
|
122
123
|
instant_python/templates/boilerplate/github/action.yml,sha256=orPXW0IIasWJDe3KZelFoITILKDPqRTYFC3WWOXQGa8,1036
|
|
123
124
|
instant_python/templates/boilerplate/github/bug_report.yml,sha256=DQ1OkBkQa2YNxXg2d7uPW1FI2sA_QZQH2E7Ju9tyi_g,1613
|
|
124
|
-
instant_python/templates/boilerplate/github/ci.yml,sha256=
|
|
125
|
+
instant_python/templates/boilerplate/github/ci.yml,sha256=FwPxiFw8RMDXisQRjUnKCUQDpm89g8dll784KuKqenI,5269
|
|
125
126
|
instant_python/templates/boilerplate/github/feature_request.yml,sha256=Au116oHxO-julX2wJyNHbteTWKq68ulo2F45UakJppk,758
|
|
126
|
-
instant_python/templates/boilerplate/github/release.yml,sha256=
|
|
127
|
+
instant_python/templates/boilerplate/github/release.yml,sha256=0_P6wSzaAyPdOwL0MUJfMVXyJtp1Vfa0U8a3FtyHwTQ,3085
|
|
127
128
|
instant_python/templates/boilerplate/logger/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
128
129
|
instant_python/templates/boilerplate/logger/file_logger.py,sha256=lmvFY5O0QIfTeYIFJ1f8HCb2b9lLF9htiOBxZpYX_So,1382
|
|
129
130
|
instant_python/templates/boilerplate/logger/file_rotating_handler.py,sha256=oWT3_LXqAICs1cGJxCx2HWkKuhQh9ev2EE8lNOwWDKc,1250
|
|
@@ -156,11 +157,17 @@ instant_python/templates/boilerplate/scripts/remove_dependency.py,sha256=i4xoHta
|
|
|
156
157
|
instant_python/templates/boilerplate/scripts/unit.sh,sha256=HWne-jgso6Lcp6mRtvIsX84e3cKzmVUTQ1YFRPPA35M,1115
|
|
157
158
|
instant_python/templates/boilerplate/value_object/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
158
159
|
instant_python/templates/boilerplate/value_object/aggregate.py,sha256=IA9rEvYj4wz67JYvD_kZ3kq-0YlxgerwwVgWAGx8Dig,3331
|
|
160
|
+
instant_python/templates/boilerplate/value_object/int_primitives_mother.py,sha256=TcDLQrm3tFkbNfEfsDcpVXPg9WYaq1oNHbpFX1lfbvo,269
|
|
159
161
|
instant_python/templates/boilerplate/value_object/int_value_object.py,sha256=z2pG-vxqKFWSRbthJXV-SGmgTVGAufWhGFe8MMTDmzQ,1154
|
|
162
|
+
instant_python/templates/boilerplate/value_object/string_primitives_mother.py,sha256=XLUIMIhFTc5oC0TbSP8ZTYezAVr5RIGYfNNqxgiPOC0,260
|
|
160
163
|
instant_python/templates/boilerplate/value_object/string_value_object.py,sha256=UOl10hIE2bRqKZxnXPgANRjPK9AECxSCvy8fxia9R48,872
|
|
164
|
+
instant_python/templates/boilerplate/value_object/test_int_value_object.py,sha256=UEsCcRFnDB5AlCbfgrnBmLwm_x7vHIllfpCIng1OqK4,3099
|
|
165
|
+
instant_python/templates/boilerplate/value_object/test_string_value_object.py,sha256=qZg6f7YdvFJD0PF7uCnY4eVVuxT4njpXDXm_eg3IlgY,2733
|
|
166
|
+
instant_python/templates/boilerplate/value_object/test_uuid_value_object.py,sha256=bzoFzBWHoEMsdpEqIqfIlLKuT3tleils90sArkiOpms,2969
|
|
161
167
|
instant_python/templates/boilerplate/value_object/uuid.py,sha256=asIKkc7hkFhgKUnJXSTFNb4eD39hWX-aesSS5ZPp__A,1172
|
|
168
|
+
instant_python/templates/boilerplate/value_object/uuid_primitives_mother.py,sha256=wBuSsggCRaLN1O9VqPiYtxkjZKg3cUfY1Bf06axMhgw,332
|
|
162
169
|
instant_python/templates/boilerplate/value_object/validation.py,sha256=QQzinWCtIKEch24uFLmE8WdCP0tJJIcvRQRsDK3qepY,212
|
|
163
|
-
instant_python/templates/boilerplate/value_object/value_object.py,sha256=
|
|
170
|
+
instant_python/templates/boilerplate/value_object/value_object.py,sha256=JrfqdR4R5l0paSka4dmg7AFIRK9qUw84jVr6HsVBHfA,3436
|
|
164
171
|
instant_python/templates/project_structure/alembic_migrator.yml.j2,sha256=7xCrOaZMHXuCz2QAGnM8xB9mgzdR9IqEFWV6Iyc3DY4,78
|
|
165
172
|
instant_python/templates/project_structure/async_alembic.yml.j2,sha256=7OdjRGXHFHc56LqtC_NxsNX23kq3Pgsoh0u4QKopJjI,527
|
|
166
173
|
instant_python/templates/project_structure/async_sqlalchemy.yml.j2,sha256=XaOKwRBZOyR1JOtY53KB8WizzESF5VmaTPfk36vft1s,459
|
|
@@ -176,7 +183,7 @@ instant_python/templates/project_structure/gitignore.yml.j2,sha256=Ex3A7rvCvuIqx
|
|
|
176
183
|
instant_python/templates/project_structure/license.yml.j2,sha256=0h2OAyK4-HKWsM6Gllkh1wGRXmEl2mRJLlKgOPlyCY0,40
|
|
177
184
|
instant_python/templates/project_structure/logger.yml.j2,sha256=2oQqzCL1Z2S7k1ezAKcj7A6ehhzSYpe0FfMBOLewK6U,315
|
|
178
185
|
instant_python/templates/project_structure/macros.j2,sha256=oAvJhQDJsk6yLm1r6P_kUdKAuLpOmuqmMauJdhKYv0U,173
|
|
179
|
-
instant_python/templates/project_structure/makefile.yml.j2,sha256=
|
|
186
|
+
instant_python/templates/project_structure/makefile.yml.j2,sha256=uGFIaW9wBJasIMWpki5wP9BYR7-hoju9hEb-ZGln_XU,829
|
|
180
187
|
instant_python/templates/project_structure/mypy.yml.j2,sha256=Th3HkMdEu2xgORRhMV5QoqkilF90xfKb8JAEOXmEGUc,55
|
|
181
188
|
instant_python/templates/project_structure/precommit_hook.yml.j2,sha256=Yw-J9EoW1MzHLMCLJ6kBqQpEp2FsUiHa0OR6ubB7Hzg,69
|
|
182
189
|
instant_python/templates/project_structure/pyproject.yml.j2,sha256=QC_Q5Y1MfMen0fbVfllCDpX70idbNIR4gpL1gIgeQs0,61
|
|
@@ -185,19 +192,20 @@ instant_python/templates/project_structure/python_version.yml.j2,sha256=zlkshfPr
|
|
|
185
192
|
instant_python/templates/project_structure/readme.yml.j2,sha256=Km1zSVKfGwx7GHn0CMMAKQieCO089wKb8QoPVUnoDUU,56
|
|
186
193
|
instant_python/templates/project_structure/security.yml.j2,sha256=-AqFqcu1wdEAqugXEN1NaxKQVTvsCUxOBi5mXCEqBhY,58
|
|
187
194
|
instant_python/templates/project_structure/synchronous_sqlalchemy.yml.j2,sha256=mC7WBchO0bzHcGkTw0k4woDstUvoQaJKlrCW82A96o8,467
|
|
195
|
+
instant_python/templates/project_structure/test_value_objects.yml.j2,sha256=9MUoo5BwsUBjNjd-3aYbRnNJXB05iwHOPz3oO_VwjjY,769
|
|
188
196
|
instant_python/templates/project_structure/value_objects.yml.j2,sha256=kOG4F6nYdlaY9GxXZjIVBzkLJCDzTIyFEbwjpjBZEzk,1415
|
|
189
197
|
instant_python/templates/project_structure/clean_architecture/main_structure.yml.j2,sha256=h2G3EHJO8h_vWaIrF93zSQg55c4yRysjcmie_-RoY0U,2059
|
|
190
198
|
instant_python/templates/project_structure/clean_architecture/source.yml.j2,sha256=dwMKp9C5U_KIIoH6FeM3jsHBlscmIbijGRCbXG5yt_M,2459
|
|
191
|
-
instant_python/templates/project_structure/clean_architecture/test.yml.j2,sha256=
|
|
199
|
+
instant_python/templates/project_structure/clean_architecture/test.yml.j2,sha256=wCwT3Tm3bjhsTF6nqP30KdiUlYrvkIN3Xkxw7uNoJqw,852
|
|
192
200
|
instant_python/templates/project_structure/domain_driven_design/bounded_context.yml.j2,sha256=BTuT5fQBdw4o3Ev-iN8THAr2-bLlLG8mgLpbQOcL0x4,471
|
|
193
201
|
instant_python/templates/project_structure/domain_driven_design/main_structure.yml.j2,sha256=EGwEOY4jB0ligfa_cN93InbBzH9CAcfuD5LkuaW2jT8,2062
|
|
194
202
|
instant_python/templates/project_structure/domain_driven_design/source.yml.j2,sha256=YawrDcKYGcMIPsjEuCz2O2hXAOn_i1R4cxPXzvpC09o,2951
|
|
195
|
-
instant_python/templates/project_structure/domain_driven_design/test.yml.j2,sha256=
|
|
203
|
+
instant_python/templates/project_structure/domain_driven_design/test.yml.j2,sha256=GUsQEsSB9_yha54TyF5rmKwxezwRKPsPNBhH83YRbjQ,1027
|
|
196
204
|
instant_python/templates/project_structure/standard_project/main_structure.yml.j2,sha256=aPjYWo7iJdG5SDVIJEzPh1eBlMDE54WwPfMBmqOHHgI,2055
|
|
197
205
|
instant_python/templates/project_structure/standard_project/source.yml.j2,sha256=THNSxD_6mMd-oCzaGYkrHlTiRWzkN6X3X6cYi2cbyMk,1702
|
|
198
|
-
instant_python/templates/project_structure/standard_project/test.yml.j2,sha256=
|
|
199
|
-
instant_python-0.9.
|
|
200
|
-
instant_python-0.9.
|
|
201
|
-
instant_python-0.9.
|
|
202
|
-
instant_python-0.9.
|
|
203
|
-
instant_python-0.9.
|
|
206
|
+
instant_python/templates/project_structure/standard_project/test.yml.j2,sha256=MHeZF6k50M2ZSwhEocSrepsHtUEm9FQmLB0xSgS7GZM,608
|
|
207
|
+
instant_python-0.9.2.dist-info/METADATA,sha256=h3gtMkVkfkx5jcaM1zr1wIKRV5h1Cx4GiGBpSb8Dka4,17691
|
|
208
|
+
instant_python-0.9.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
209
|
+
instant_python-0.9.2.dist-info/entry_points.txt,sha256=M8YUHQaTszBM3np_x9j7wmc1ngrmpfrd4ajBv2EzQuk,51
|
|
210
|
+
instant_python-0.9.2.dist-info/licenses/LICENSE,sha256=kf7wA-1IsqXkzXjlsG95sdQJtsqUON_lNXombfPlklo,11353
|
|
211
|
+
instant_python-0.9.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|