generated from Hochfrequenz/python_template_repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
195 changed files
with
14,726 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
[project] | ||
name = "your-favourite-package-name" | ||
description = "Description of your package" | ||
name = "BO4E-Python-Generator" | ||
description = "This tool auto generates (customizable) pydantic v2 Code to implement the BO4E-Schemas." | ||
license = { text = "MIT" } | ||
requires-python = ">=3.11" | ||
authors = [{ name = "your name", email = "[email protected]" }] | ||
keywords = ["your", "important", "keywords"] | ||
authors = [{ name = "Hochfrequenz Unternehmensberatung GmbH", email = "[email protected]" }] | ||
keywords = ["bo4e", "code-generator"] | ||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Environment :: Console", | ||
|
@@ -16,20 +16,31 @@ classifiers = [ | |
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
] | ||
dependencies = [] # add all the dependencies from requirements.in here, too | ||
dependencies = [ | ||
"datamodel-code-generator", | ||
"click", | ||
] # add all the dependencies from requirements.in here, too | ||
dynamic = ["readme", "version"] | ||
|
||
[project.urls] | ||
Changelog = "https://github.com/Hochfrequenz/python_template_repository/releases" | ||
Homepage = "https://github.com/Hochfrequenz/python_template_repository" | ||
|
||
[project.scripts] | ||
bo4e-generator = "bo4e_generator.__main__:main" | ||
|
||
[tool.black] | ||
line-length = 120 | ||
|
||
[tool.isort] | ||
line_length = 120 | ||
profile = "black" | ||
|
||
[tool.pylint] | ||
disable = [ | ||
"R0903", # disable too-few-public-methods | ||
] | ||
|
||
[tool.pylint."MESSAGES CONTROL"] | ||
max-line-length = 120 | ||
|
||
|
@@ -47,7 +58,7 @@ fragments = [{ path = "README.md" }] | |
source = "vcs" | ||
|
||
[tool.hatch.build.hooks.vcs] | ||
version-file = "src/_your_package_version.py" | ||
version-file = "src/_bo4e_generator_version.py" | ||
template = ''' | ||
version = "{version}" | ||
''' | ||
|
@@ -57,4 +68,4 @@ exclude = ["/unittests"] | |
|
||
[tool.hatch.build.targets.wheel] | ||
only-include = ["src"] | ||
sources = ["src"] | ||
sources = ["src"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
datamodel-code-generator | ||
click |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,108 @@ | ||
# | ||
# This file is autogenerated by pip-compile with python 3.10 | ||
# To update, run: | ||
# This file is autogenerated by pip-compile with Python 3.11 | ||
# by the following command: | ||
# | ||
# pip-compile requirements.in | ||
# pip-compile '.\requirements.in' | ||
# | ||
annotated-types==0.6.0 | ||
# via pydantic | ||
argcomplete==3.1.2 | ||
# via datamodel-code-generator | ||
attrs==23.1.0 | ||
# via jsonschema | ||
black==23.9.1 | ||
# via datamodel-code-generator | ||
certifi==2023.7.22 | ||
# via requests | ||
chardet==5.2.0 | ||
# via prance | ||
charset-normalizer==3.3.0 | ||
# via requests | ||
click==8.1.7 | ||
# via | ||
# -r .\requirements.in | ||
# black | ||
colorama==0.4.6 | ||
# via click | ||
datamodel-code-generator==0.22.1 | ||
# via -r .\requirements.in | ||
dnspython==2.4.2 | ||
# via email-validator | ||
email-validator==2.0.0.post2 | ||
# via pydantic | ||
genson==1.2.2 | ||
# via datamodel-code-generator | ||
idna==3.4 | ||
# via | ||
# email-validator | ||
# requests | ||
inflect==5.6.2 | ||
# via datamodel-code-generator | ||
isort==5.12.0 | ||
# via datamodel-code-generator | ||
jinja2==3.1.2 | ||
# via datamodel-code-generator | ||
jsonschema==4.17.3 | ||
# via | ||
# jsonschema-spec | ||
# openapi-schema-validator | ||
# openapi-spec-validator | ||
jsonschema-spec==0.1.6 | ||
# via openapi-spec-validator | ||
lazy-object-proxy==1.9.0 | ||
# via openapi-spec-validator | ||
markupsafe==2.1.3 | ||
# via jinja2 | ||
mypy-extensions==1.0.0 | ||
# via black | ||
openapi-schema-validator==0.4.4 | ||
# via openapi-spec-validator | ||
openapi-spec-validator==0.5.7 | ||
# via datamodel-code-generator | ||
packaging==23.2 | ||
# via | ||
# black | ||
# datamodel-code-generator | ||
# prance | ||
pathable==0.4.3 | ||
# via jsonschema-spec | ||
pathspec==0.11.2 | ||
# via black | ||
platformdirs==3.11.0 | ||
# via black | ||
prance==23.6.21.0 | ||
# via datamodel-code-generator | ||
pydantic[email]==2.4.2 | ||
# via | ||
# datamodel-code-generator | ||
# pydantic | ||
pydantic-core==2.10.1 | ||
# via pydantic | ||
pyrsistent==0.19.3 | ||
# via jsonschema | ||
pysnooper==1.2.0 | ||
# via datamodel-code-generator | ||
pyyaml==6.0.1 | ||
# via jsonschema-spec | ||
requests==2.31.0 | ||
# via | ||
# jsonschema-spec | ||
# prance | ||
rfc3339-validator==0.1.4 | ||
# via openapi-schema-validator | ||
ruamel-yaml==0.17.35 | ||
# via prance | ||
ruamel-yaml-clib==0.2.8 | ||
# via ruamel-yaml | ||
six==1.16.0 | ||
# via | ||
# prance | ||
# rfc3339-validator | ||
toml==0.10.2 | ||
# via datamodel-code-generator | ||
typing-extensions==4.8.0 | ||
# via | ||
# pydantic | ||
# pydantic-core | ||
urllib3==2.0.6 | ||
# via requests |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
This module is the entry point for the CLI bo4e-generator. | ||
""" | ||
from pathlib import Path | ||
|
||
import click | ||
|
||
from bo4e_generator.parser import create_init_files, generate_bo4e_schema | ||
from bo4e_generator.schema import get_namespace | ||
|
||
|
||
def generate_bo4e_schemas(input_directory: Path, output_directory: Path): | ||
""" | ||
Generate all BO4E schemas from the given input directory and save them in the given output directory. | ||
""" | ||
namespace = get_namespace(input_directory, output_directory) | ||
for schema_metadata in namespace.values(): | ||
result = generate_bo4e_schema(schema_metadata, namespace) | ||
schema_metadata.save(result) | ||
print(f"Generated {schema_metadata}") | ||
create_init_files(output_directory) | ||
print(f"Generated __init__.py files in {output_directory}") | ||
|
||
|
||
@click.command() | ||
@click.option( | ||
"--input-dir", | ||
"-i", | ||
type=click.Path(exists=True, file_okay=False, path_type=Path), | ||
help="Input directory which contains the JSON schemas.", | ||
required=True, | ||
) | ||
@click.option( | ||
"--output-dir", | ||
"-o", | ||
type=click.Path(exists=False, file_okay=False, path_type=Path), | ||
help="Output directory for the generated python files.", | ||
required=True, | ||
) | ||
@click.help_option() | ||
@click.version_option(package_name="BO4E-Python-Generator") | ||
def main(input_dir: Path, output_dir: Path): | ||
""" | ||
CLI entry point for the bo4e-generator. | ||
""" | ||
generate_bo4e_schemas(input_dir, output_dir) | ||
|
||
|
||
if __name__ == "__main__": | ||
# pylint: disable=no-value-for-parameter | ||
main() |
Oops, something went wrong.