Skip to content

Commit

Permalink
Revert "Pyproject merge script update (#193)"
Browse files Browse the repository at this point in the history
This reverts commit b93af0b.
  • Loading branch information
KerstenBreuer authored Dec 22, 2023
1 parent b93af0b commit 5c5a54a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 45 deletions.
19 changes: 0 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,6 @@ requires = [
build-backend = "setuptools.build_meta"

[project]
readme = "README.md"
authors = [
{ name = "German Human Genome Phenome Archive (GHGA)", email = "[email protected]" },
]
requires-python = ">=3.9"
classifiers = [
"Development Status :: 1 - Planning",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: Apache Software License",
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
"Topic :: Software Development :: Libraries",
"Intended Audience :: Developers",
]
name = "my_microservice"
version = "0.1.0"
description = "My-Microservice - a short description"
Expand All @@ -31,9 +15,6 @@ dependencies = [
"hexkit[akafka,s3,mongodb] >= 1.1.0",
]

[project.license]
text = "Apache 2.0"

[project.urls]
Repository = "https://github.com/ghga-de/my-microservice"

Expand Down
27 changes: 1 addition & 26 deletions scripts/update_pyproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,37 +58,12 @@ def write_pyproject(pyproject: dict[str, object]) -> None:
tomli_w.dump(pyproject, file)


def merge_fields(*, source: dict[str, object], dest: dict[str, object]):
"""Merge fields existing in both custom and template pyproject definitions.
If a given field is a dictionary, merge or assign depending on if it's found in dest.
If the field is anything else either assign the value or exit with a message if a
conflict exists.
"""
for field, value in source.items():
if isinstance(value, dict):
if field in dest:
merge_fields(source=source[field], dest=dest[field]) # type: ignore
else:
dest[field] = value
else:
if field in dest and value != dest[field]:
cli.echo_failure(f"Conflicting values for '{field}'")
exit(1)
elif field not in dest:
dest[field] = value


def merge_pyprojects(inputs: list[dict[str, object]]) -> dict[str, object]:
"""Compile a pyproject dict from the provided input dicts."""
pyproject = inputs[0]

for input in inputs[1:]:
for field, value in input.items():
if field not in pyproject:
pyproject[field] = value
else:
merge_fields(source=value, dest=pyproject[field]) # type: ignore
pyproject.update(input)

return pyproject

Expand Down

0 comments on commit 5c5a54a

Please sign in to comment.