-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update naming convention and version number when submodules ha…
…ve been updated
- Loading branch information
1 parent
49e3f14
commit 95c315b
Showing
5 changed files
with
131 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
__app_name__ = "compose_viz" | ||
__version__ = "0.3.2" | ||
__app_name__ = "compose_viz" | ||
__version__ = "0.3.2" |
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,36 +1,36 @@ | ||
[tool.poetry] | ||
name = "compose-viz" | ||
version = "0.3.2" | ||
description = "A compose file visualization tool that supports compose-spec and allows you to gernerate graph in several formats." | ||
authors = ["Xyphuz Wu <xyphuzwu@gmail.com>"] | ||
readme = "README.md" | ||
license = "MIT" | ||
homepage = "https://github.com/compose-viz/compose-viz" | ||
repository = "https://github.com/compose-viz/compose-viz" | ||
include = [ | ||
"LICENSE", | ||
] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.9" | ||
typer = "^0.4.1" | ||
graphviz = "^0.20" | ||
pydantic-yaml = "^1.3.0" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
pytest = "^8.1.2" | ||
pre-commit = "^3.7.0" | ||
coverage = "^7.5.0" | ||
pytest-cov = "^5.0.0" | ||
datamodel-code-generator = "^0.25.6" | ||
|
||
[build-system] | ||
requires = ["poetry-core>=1.0.0"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.poetry.scripts] | ||
cpv = "compose_viz.cli:start_cli" | ||
|
||
[tool.coverage.run] | ||
source = ["compose_viz"] | ||
omit = ["compose_viz/spec/*"] | ||
[tool.poetry] | ||
name = "compose-viz" | ||
version = "0.3.2" | ||
description = "A compose file visualization tool that supports compose-spec and allows you to gernerate graph in several formats." | ||
authors = ["Xyphuz Wu <xyphuzwu@gmail.com>"] | ||
readme = "README.md" | ||
license = "MIT" | ||
homepage = "https://github.com/compose-viz/compose-viz" | ||
repository = "https://github.com/compose-viz/compose-viz" | ||
include = [ | ||
"LICENSE", | ||
] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.9" | ||
typer = "^0.4.1" | ||
graphviz = "^0.20" | ||
pydantic-yaml = "^1.3.0" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
pytest = "^8.1.2" | ||
pre-commit = "^3.7.0" | ||
coverage = "^7.5.0" | ||
pytest-cov = "^5.0.0" | ||
datamodel-code-generator = "^0.25.6" | ||
|
||
[build-system] | ||
requires = ["poetry-core>=1.0.0"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.poetry.scripts] | ||
cpv = "compose_viz.cli:start_cli" | ||
|
||
[tool.coverage.run] | ||
source = ["compose_viz"] | ||
omit = ["compose_viz/spec/*"] |
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,54 @@ | ||
import re | ||
|
||
|
||
def revise_naming_convention(): | ||
name_mapping = { | ||
"EnvFile1": "EnvFilePath", | ||
"Volume1": "AdditionalVolumeOption", | ||
"External": "ExternalVolumeNetwork", | ||
"External2": "ExternalConfig", | ||
} | ||
|
||
spec_content: str | ||
with open("./compose_viz/spec/compose_spec.py", "r+") as spec_file: | ||
spec_content: str = spec_file.read() | ||
|
||
for origin_name, new_name in name_mapping.items(): | ||
spec_content = re.sub(rf"\b{origin_name}\b", new_name, spec_content) | ||
|
||
spec_file.seek(0) | ||
spec_file.write(spec_content) | ||
|
||
print("Revised naming convention successfully!") | ||
|
||
|
||
def update_version_number(): | ||
new_version_number: str | ||
with open("./compose_viz/__init__.py", "r+") as init_file: | ||
init_content: str = init_file.read() | ||
|
||
version_number = init_content.split(" ")[-1].replace('"', "").strip() | ||
major, minor, patch = version_number.split(".") | ||
new_version_number = f"{major}.{minor}.{int(patch) + 1}" | ||
|
||
init_file.seek(0) | ||
init_file.write( | ||
f"""__app_name__ = "compose_viz" | ||
__version__ = "{new_version_number}" | ||
""" | ||
) | ||
|
||
with open("./pyproject.toml", "r+") as pyproject_file: | ||
pyproject_content: str = pyproject_file.read() | ||
|
||
pyproject_content = pyproject_content.replace(version_number, new_version_number) | ||
|
||
pyproject_file.seek(0) | ||
pyproject_file.write(pyproject_content) | ||
|
||
print(f"Version number updated to {new_version_number} successfully!") | ||
|
||
|
||
if __name__ == "__main__": | ||
revise_naming_convention() | ||
update_version_number() |