From 2a127e6aa2e73af915b684f48ef2b8a3089b8d06 Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 13:21:04 +0400 Subject: [PATCH 01/18] Modernize project setup and setup cron action job --- .github/actions/test/action.yml | 33 +++++++++++++++++ .github/workflows/test_and_release.yml | 22 ++++-------- .github/workflows/test_every_week.yml | 21 +++++++++++ pyproject.toml | 49 ++++++++++++++++++++++++++ pytest.ini | 4 --- requirements.txt | 10 +++--- setup.py => setup.py.backup | 0 7 files changed, 115 insertions(+), 24 deletions(-) create mode 100644 .github/actions/test/action.yml create mode 100644 .github/workflows/test_every_week.yml create mode 100644 pyproject.toml delete mode 100644 pytest.ini rename setup.py => setup.py.backup (100%) diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml new file mode 100644 index 0000000..2912205 --- /dev/null +++ b/.github/actions/test/action.yml @@ -0,0 +1,33 @@ +name: 'Test' + +inputs: + python-version: + description: 'Python version to test with' + required: true + type: string + pytest-args: + description: 'pytest args to test with' + required: false + default: '' + type: string + +runs: + using: "composite" + steps: + - name: Set up Python ${{ inputs.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ inputs.python-version }} + - name: Install dependencies + shell: bash + run: | + python -m pip install --upgrade pip build + python -m build + python -m pip install '.[test]' + python -m pip install wheel pytest pytest-cov pytest-xdist requests coveralls codacy-coverage + pip install --ignore-installed pytest>=4.4.0 + pytest --version + - name: Test with pytest + shell: bash + run: | + pytest ${{ inputs.pytest-args }} -m "not no_expected" test/ diff --git a/.github/workflows/test_and_release.yml b/.github/workflows/test_and_release.yml index 2ee1142..ab4fb5e 100644 --- a/.github/workflows/test_and_release.yml +++ b/.github/workflows/test_and_release.yml @@ -1,6 +1,8 @@ name: Build 📦 -on: [ push, pull_request ] +on: + - push + - pull_request jobs: test: @@ -8,25 +10,15 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ] + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] steps: - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + - name: Test + uses: ./.github/actions/test with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python setup.py sdist - python setup.py install - python -m pip install wheel pytest pytest-cov pytest-xdist requests coveralls codacy-coverage - pip install --ignore-installed pytest>=4.4.0 - pytest --version - - name: Test with pytest - run: | - python setup.py test -a '--cov-config .coveragerc --cov=json_to_models -m "not no_expected" test/' + pytest-args: '--cov-config .coveragerc --cov=json_to_models' - name: Coverage env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test_every_week.yml b/.github/workflows/test_every_week.yml new file mode 100644 index 0000000..186639e --- /dev/null +++ b/.github/workflows/test_every_week.yml @@ -0,0 +1,21 @@ +name: Test every month + +on: + schedule: + - cron: "0 * * * *" +# - cron: "0 0 1 * *" + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] + + steps: + - uses: actions/checkout@v2 + - name: Test + uses: ./.github/actions/test + with: + python-version: ${{ matrix.python-version }} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..870de69 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,49 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "json2python-models" +description = "Python models (pydantic, attrs, dataclasses or custom) generator from JSON data with typing module support" +readme = "README.md" +license = { text = "MIT" } +requires-python = ">=3.8" +authors = [ + { name = "bogdandm (Bogdan Kalashnikov)", email = "bogdan.dm1995@yandex.ru" } +] +dynamic = ['version', 'dependencies'] + +[project.urls] +"Repository" = "https://github.com/bogdandm/json2python-models" + +[project.optional-dependencies] +test = [ + "pytest>=4.4.0", + "pytest-xdist", + "requests", + "attrs", + "pydantic>=1.3", + "ruamel.yaml" +] + +[project.scripts] +json2models = "json_to_models.cli:main" + +[tool.setuptools] +packages = { find = { exclude = ["test", "testing_tools"] } } + +[tool.setuptools.dynamic] +dependencies = { file = ["requirements.txt"] } +version = { attr = "json_to_models.__version__" } +readme = { file = ['README.md'] } + +[tool.setuptools.package-data] +"*" = ['*.txt.', '*.ini', ".coveragerc", "LICENSE", "*.md"] + +[tool.pytest.ini_options] +#addopts = "-n 4" +testpaths = ["tests"] +markers = [ + "no_expected: testing data has no expected value", + "slow_http: api that provides testing data is slow" +] \ No newline at end of file diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 31fac25..0000000 --- a/pytest.ini +++ /dev/null @@ -1,4 +0,0 @@ -[pytest] -markers = - no_expected: testing data has no expected value - slow_http: api that provides testing data is slow \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 48afdcf..df7c532 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ -python-dateutil>=2.7.* -inflection>=0.3.* -unidecode>=1.0.* -Jinja2>=2.10.* +python-dateutil>=2.7 +inflection>=0.3 +unidecode>=1.0 +Jinja2>=2.10 ordered-set==4.* -typing-extensions>=3.1.* +typing-extensions>=3.1 diff --git a/setup.py b/setup.py.backup similarity index 100% rename from setup.py rename to setup.py.backup From 1902310435268c68410e112805d995a8cf180441 Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 13:47:14 +0400 Subject: [PATCH 02/18] Fix yaml --- json_to_models/cli.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/json_to_models/cli.py b/json_to_models/cli.py index 4d367d7..6a4a6e1 100644 --- a/json_to_models/cli.py +++ b/json_to_models/cli.py @@ -15,9 +15,12 @@ try: import ruamel.yaml as yaml + + yaml_load = yaml.YAML(typ='safe', pure=True).load except ImportError: try: import yaml + yaml_load = yaml.safe_load except ImportError: yaml = None @@ -417,11 +420,11 @@ def json(path: Path) -> Union[dict, list]: @staticmethod def yaml(path: Path) -> Union[dict, list]: - if yaml is None: - print('Yaml parser is not installed. To parse yaml files PyYaml (or ruamel.yaml) is required.') + if yaml_load is None: + print('Yaml parser is not installed. To parse yaml files ruamel.yaml (or PyYaml) is required.') raise ImportError('yaml') with path.open() as fp: - return yaml.safe_load(fp) + return yaml_load(fp) @staticmethod def ini(path: Path) -> dict: From a54fa949bab0d444d3d0a582a16010daef706058 Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 13:49:30 +0400 Subject: [PATCH 03/18] Remove parse version --- json_to_models/__init__.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/json_to_models/__init__.py b/json_to_models/__init__.py index d239267..493f741 100644 --- a/json_to_models/__init__.py +++ b/json_to_models/__init__.py @@ -1,4 +1 @@ -from pkg_resources import parse_version - __version__ = "0.3.0" -VERSION = parse_version(__version__) From 2c653d687ea2edc0707ea61cf528e40e6388a86a Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 14:02:31 +0400 Subject: [PATCH 04/18] Fix code generation test --- test/test_cli/test_script.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/test_cli/test_script.py b/test/test_cli/test_script.py index 7e2ce3c..5468edc 100644 --- a/test/test_cli/test_script.py +++ b/test/test_cli/test_script.py @@ -1,12 +1,12 @@ -import imp import json import re import subprocess import sys import tempfile +import types +import uuid from pathlib import Path from time import time -from typing import Tuple import pytest @@ -95,6 +95,12 @@ def test_help(): ] +def load_model(code): + module = types.ModuleType(uuid.uuid4().hex) + exec(code, module.__dict__) + return module + + def execute_test(command, output_file: Path = None, output=None) -> str: proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = map(bytes.decode, proc.communicate()) @@ -107,11 +113,8 @@ def execute_test(command, output_file: Path = None, output=None) -> str: assert not stderr, stderr assert stdout, stdout assert proc.returncode == 0 - # Note: imp package is deprecated but I can't find a way to create dummy module using importlib - module = imp.new_module("test_model") - sys.modules["test_model"] = module try: - exec(compile(stdout, "test_model.py", "exec"), module.__dict__) + load_model(stdout) except Exception as e: assert not e, stdout From 9dde81e08ca58a9c5a22b3efa7aff624108c92ca Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 14:07:32 +0400 Subject: [PATCH 05/18] Fix code generation test --- test/test_cli/test_script.py | 6 ++++-- test/test_cli/test_self_validate_pydantic.py | 14 ++++---------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/test/test_cli/test_script.py b/test/test_cli/test_script.py index 5468edc..fe602ac 100644 --- a/test/test_cli/test_script.py +++ b/test/test_cli/test_script.py @@ -95,9 +95,11 @@ def test_help(): ] -def load_model(code): - module = types.ModuleType(uuid.uuid4().hex) +def load_model(code, module_name=''): + module_name = module_name or uuid.uuid4().hex + module = types.ModuleType(module_name) exec(code, module.__dict__) + sys.modules[module_name] = module return module diff --git a/test/test_cli/test_self_validate_pydantic.py b/test/test_cli/test_self_validate_pydantic.py index b1a5f35..db4db4e 100644 --- a/test/test_cli/test_self_validate_pydantic.py +++ b/test/test_cli/test_self_validate_pydantic.py @@ -1,4 +1,3 @@ -import imp import json import sys from inspect import isclass @@ -11,7 +10,7 @@ from json_to_models.models.pydantic import PydanticModelCodeGenerator from json_to_models.models.structure import compose_models_flat from json_to_models.registry import ModelRegistry -from .test_script import test_data_path +from .test_script import test_data_path, load_model test_self_validate_pydantic_data = [ pytest.param(test_data_path / "gists.json", list, id="gists.json"), @@ -39,14 +38,9 @@ def test_self_validate_pydantic(data, data_type): structure = compose_models_flat(reg.models_map) code = generate_code(structure, PydanticModelCodeGenerator) - module = imp.new_module("test_models") - sys.modules["test_models"] = module - try: - exec(compile(code, "test_models.py", "exec"), module.__dict__) - except Exception as e: - assert not e, code - - import test_models + + test_models = load_model(code, 'test_models') + for name in dir(test_models): cls = getattr(test_models, name) if isclass(cls) and issubclass(cls, pydantic.BaseModel): From df18a68ca3b5f9d05312bd8cfac35d6af5e7dedf Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 14:18:51 +0400 Subject: [PATCH 06/18] test --- test/test_cli/test_script.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/test_cli/test_script.py b/test/test_cli/test_script.py index fe602ac..6a361c6 100644 --- a/test/test_cli/test_script.py +++ b/test/test_cli/test_script.py @@ -115,10 +115,7 @@ def execute_test(command, output_file: Path = None, output=None) -> str: assert not stderr, stderr assert stdout, stdout assert proc.returncode == 0 - try: - load_model(stdout) - except Exception as e: - assert not e, stdout + load_model(stdout) print(stdout) return stdout From b048e8df706c567c0d3c526e8e38809ba38e9b3c Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 14:23:19 +0400 Subject: [PATCH 07/18] Fix module loading --- test/test_cli/test_script.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_cli/test_script.py b/test/test_cli/test_script.py index 6a361c6..6e77145 100644 --- a/test/test_cli/test_script.py +++ b/test/test_cli/test_script.py @@ -98,8 +98,8 @@ def test_help(): def load_model(code, module_name=''): module_name = module_name or uuid.uuid4().hex module = types.ModuleType(module_name) - exec(code, module.__dict__) sys.modules[module_name] = module + exec(code, module.__dict__) return module From 525e8d6b42bc60920b3a91b87971688c0e16cc7e Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 14:37:45 +0400 Subject: [PATCH 08/18] Fix pydantic generation --- json_to_models/models/pydantic.py | 2 +- test/test_cli/test_self_validate_pydantic.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/json_to_models/models/pydantic.py b/json_to_models/models/pydantic.py index fe47958..2937f42 100644 --- a/json_to_models/models/pydantic.py +++ b/json_to_models/models/pydantic.py @@ -46,7 +46,7 @@ def generate(self, nested_classes: List[str] = None, extra: str = "", **kwargs) nested_classes=nested_classes, extra=extra ) - imports.append(('pydantic', ['BaseModel', 'Field'])) + imports.append(('pydantic.v1', ['BaseModel', 'Field'])) return imports, body def _filter_fields(self, fields): diff --git a/test/test_cli/test_self_validate_pydantic.py b/test/test_cli/test_self_validate_pydantic.py index db4db4e..d163305 100644 --- a/test/test_cli/test_self_validate_pydantic.py +++ b/test/test_cli/test_self_validate_pydantic.py @@ -1,8 +1,7 @@ import json -import sys from inspect import isclass -import pydantic +import pydantic.v1 as pydantic import pytest from json_to_models.generator import MetadataGenerator From 86011a7c3bcc2a63b2f4abcd6e21ae05635790e8 Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 14:39:24 +0400 Subject: [PATCH 09/18] Fix pydantic generation --- test/test_code_generation/test_pydantic_generation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_code_generation/test_pydantic_generation.py b/test/test_code_generation/test_pydantic_generation.py index 95c058f..7ad8d0c 100644 --- a/test/test_code_generation/test_pydantic_generation.py +++ b/test/test_code_generation/test_pydantic_generation.py @@ -53,7 +53,7 @@ ] }, "generated": trim(f""" - from pydantic import BaseModel, Field + from pydantic.v1 import BaseModel, Field class Test(BaseModel): @@ -120,7 +120,7 @@ class Test(BaseModel): } }, "generated": trim(f""" - from pydantic import BaseModel, Field + from pydantic.v1 import BaseModel, Field from typing import Dict, List, Optional @@ -146,7 +146,7 @@ class Test(BaseModel): "u": DUnion(DDict(IntString), DList(DList(IntString))), }), "generated": trim(""" - from pydantic import BaseModel, Field + from pydantic.v1 import BaseModel, Field from typing import Dict, List, Optional, Union From 14fc2082a7645ccc404e7331e9045e2290392b20 Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 14:40:15 +0400 Subject: [PATCH 10/18] Enable pytest workers --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 870de69..8890bfa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ readme = { file = ['README.md'] } "*" = ['*.txt.', '*.ini', ".coveragerc", "LICENSE", "*.md"] [tool.pytest.ini_options] -#addopts = "-n 4" +addopts = "-n 4" testpaths = ["tests"] markers = [ "no_expected: testing data has no expected value", From 5e444031c579d61bc420ca84ea4b1c7b09b6e5d4 Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 14:58:40 +0400 Subject: [PATCH 11/18] Add coverage to CLI tests --- .github/actions/test/action.yml | 2 +- pyproject.toml | 4 ++-- test/test_cli/test_script.py | 8 ++------ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index 2912205..ad0eb9d 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -30,4 +30,4 @@ runs: - name: Test with pytest shell: bash run: | - pytest ${{ inputs.pytest-args }} -m "not no_expected" test/ + pytest ${{ inputs.pytest-args }} -m "not no_expected" -n 8 test/ diff --git a/pyproject.toml b/pyproject.toml index 8890bfa..b93933f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,8 @@ test = [ "requests", "attrs", "pydantic>=1.3", - "ruamel.yaml" + "ruamel.yaml", + "coverage" ] [project.scripts] @@ -41,7 +42,6 @@ readme = { file = ['README.md'] } "*" = ['*.txt.', '*.ini', ".coveragerc", "LICENSE", "*.md"] [tool.pytest.ini_options] -addopts = "-n 4" testpaths = ["tests"] markers = [ "no_expected: testing data has no expected value", diff --git a/test/test_cli/test_script.py b/test/test_cli/test_script.py index 6e77145..e6a88da 100644 --- a/test/test_cli/test_script.py +++ b/test/test_cli/test_script.py @@ -34,12 +34,8 @@ def tmp_dir_cleanup(): json.dump(item, f) # detect script path -setuptools_script = subprocess.call(["json2models"], shell=True) == 0 -if setuptools_script: - executable = "json2models" -else: - python_path = sys.executable.replace('\\', '/') - executable = f"{python_path} -m json_to_models" +python_path = sys.executable.replace('\\', '/') +executable = f"{python_path} -m coverage run -m json_to_models" def test_help(): From 0a15650a9b32ac6d2057f73313894d517d31bc79 Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 15:04:55 +0400 Subject: [PATCH 12/18] Install pytest-cov --- pyproject.toml | 1 + test/test_cli/test_script.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b93933f..3ed29a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,7 @@ dynamic = ['version', 'dependencies'] test = [ "pytest>=4.4.0", "pytest-xdist", + "pytest-cov", "requests", "attrs", "pydantic>=1.3", diff --git a/test/test_cli/test_script.py b/test/test_cli/test_script.py index e6a88da..6e77145 100644 --- a/test/test_cli/test_script.py +++ b/test/test_cli/test_script.py @@ -34,8 +34,12 @@ def tmp_dir_cleanup(): json.dump(item, f) # detect script path -python_path = sys.executable.replace('\\', '/') -executable = f"{python_path} -m coverage run -m json_to_models" +setuptools_script = subprocess.call(["json2models"], shell=True) == 0 +if setuptools_script: + executable = "json2models" +else: + python_path = sys.executable.replace('\\', '/') + executable = f"{python_path} -m json_to_models" def test_help(): From d1987787f00a7bd8078d29ff3810ecb43c9f6b7a Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 15:09:14 +0400 Subject: [PATCH 13/18] Downgrade coveralls --- .github/actions/test/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index ad0eb9d..389c0f0 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -24,7 +24,7 @@ runs: python -m pip install --upgrade pip build python -m build python -m pip install '.[test]' - python -m pip install wheel pytest pytest-cov pytest-xdist requests coveralls codacy-coverage + python -m pip install wheel pytest pytest-cov pytest-xdist requests coveralls<4 codacy-coverage pip install --ignore-installed pytest>=4.4.0 pytest --version - name: Test with pytest From 32a4b7842fb1d9610e7fe4de983f18fbabf3e7d0 Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 15:11:08 +0400 Subject: [PATCH 14/18] Downgrade coveralls --- .github/actions/test/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml index 389c0f0..18f4366 100644 --- a/.github/actions/test/action.yml +++ b/.github/actions/test/action.yml @@ -24,7 +24,7 @@ runs: python -m pip install --upgrade pip build python -m build python -m pip install '.[test]' - python -m pip install wheel pytest pytest-cov pytest-xdist requests coveralls<4 codacy-coverage + python -m pip install wheel pytest pytest-cov pytest-xdist requests "coveralls<4" codacy-coverage pip install --ignore-installed pytest>=4.4.0 pytest --version - name: Test with pytest From 2387ea51f5e66ddc74777ca03aa94b4b861e69b5 Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 15:13:51 +0400 Subject: [PATCH 15/18] Remove python3.8 --- .github/workflows/test_and_release.yml | 2 +- .github/workflows/test_every_week.yml | 2 +- README.md | 3 --- pyproject.toml | 2 +- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_and_release.yml b/.github/workflows/test_and_release.yml index ab4fb5e..86fed22 100644 --- a/.github/workflows/test_and_release.yml +++ b/.github/workflows/test_and_release.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] + python-version: [ '3.9', '3.10', '3.11', '3.12' ] steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/test_every_week.yml b/.github/workflows/test_every_week.yml index 186639e..c150293 100644 --- a/.github/workflows/test_every_week.yml +++ b/.github/workflows/test_every_week.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] + python-version: [ '3.9', '3.10', '3.11', '3.12' ] steps: - uses: actions/checkout@v2 diff --git a/README.md b/README.md index 53c2846..5f586fa 100644 --- a/README.md +++ b/README.md @@ -444,9 +444,6 @@ class Swagger(BaseModel): ## Installation -| **Beware**: this project supports only `python3.7` and higher. | -| --- | - To install it, use `pip`: `pip install json2python-models` diff --git a/pyproject.toml b/pyproject.toml index 3ed29a6..8030da8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "json2python-models" description = "Python models (pydantic, attrs, dataclasses or custom) generator from JSON data with typing module support" readme = "README.md" license = { text = "MIT" } -requires-python = ">=3.8" +requires-python = ">=3.9" authors = [ { name = "bogdandm (Bogdan Kalashnikov)", email = "bogdan.dm1995@yandex.ru" } ] From 0a0fb918b2b8f3bcf60ced556ec66abc364ceabf Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 15:18:35 +0400 Subject: [PATCH 16/18] Disable broken coveralls for now --- .github/workflows/test_and_release.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_and_release.yml b/.github/workflows/test_and_release.yml index 86fed22..1e535c0 100644 --- a/.github/workflows/test_and_release.yml +++ b/.github/workflows/test_and_release.yml @@ -19,12 +19,12 @@ jobs: with: python-version: ${{ matrix.python-version }} pytest-args: '--cov-config .coveragerc --cov=json_to_models' - - name: Coverage - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - coverage xml - coveralls --service=github +# - name: Coverage +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# run: | +# coverage xml +# coveralls --service=github # TODO: Fix codacy issue with token # python-codacy-coverage -r coverage.xml From 4e7677b1de66a832390531463529e37d7ca66f09 Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 15:21:31 +0400 Subject: [PATCH 17/18] Bump version --- json_to_models/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/json_to_models/__init__.py b/json_to_models/__init__.py index 493f741..260c070 100644 --- a/json_to_models/__init__.py +++ b/json_to_models/__init__.py @@ -1 +1 @@ -__version__ = "0.3.0" +__version__ = "0.3.1" From 370feed793d6b95ac510d01eafce8754c51208ba Mon Sep 17 00:00:00 2001 From: bkalashnikov Date: Thu, 24 Oct 2024 15:23:25 +0400 Subject: [PATCH 18/18] Update release script --- .github/workflows/test_and_release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_and_release.yml b/.github/workflows/test_and_release.yml index 1e535c0..2d80373 100644 --- a/.github/workflows/test_and_release.yml +++ b/.github/workflows/test_and_release.yml @@ -35,17 +35,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up Python 3.7 + - name: Set up Python 3.11 uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: 3.11 - name: Install deps run: | python -m pip install --upgrade pip pip install setuptools wheel twine - name: Build a binary wheel and a source tarball run: | - python setup.py sdist bdist_wheel + python -m build - name: Publish distribution 📦 to PyPI env: TWINE_USERNAME: __token__