parent
df5295258f
commit
b90cf8c38f
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -160,3 +160,5 @@ cython_debug/
|
||||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
|
joj3_config_generator/_version.py
|
||||||
|
|
|
@ -1,61 +1,70 @@
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.4.0
|
rev: v4.4.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-yaml
|
- id: check-yaml
|
||||||
- id: check-toml
|
- id: check-toml
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
||||||
rev: v1.5.5
|
rev: v1.5.5
|
||||||
hooks:
|
hooks:
|
||||||
- id: remove-crlf
|
- id: remove-crlf
|
||||||
- id: remove-tabs
|
- id: remove-tabs
|
||||||
- repo: https://github.com/google/yamlfmt
|
- repo: https://github.com/google/yamlfmt
|
||||||
rev: v0.13.0
|
rev: v0.13.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: yamlfmt
|
- id: yamlfmt
|
||||||
exclude: '^tests/'
|
exclude: '^tests/'
|
||||||
- repo: https://github.com/pdm-project/pdm
|
- repo: https://github.com/pdm-project/pdm
|
||||||
rev: 2.19.2
|
rev: 2.19.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: pdm-lock-check
|
- id: pdm-lock-check
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
rev: v1.11.2
|
rev: v1.11.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: mypy
|
- id: mypy
|
||||||
additional_dependencies:
|
additional_dependencies:
|
||||||
- pydantic
|
- pydantic
|
||||||
- types-PyYAML
|
- types-PyYAML
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
rev: v3.17.0
|
rev: v3.17.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
- repo: https://github.com/hadialqattan/pycln
|
- repo: https://github.com/hadialqattan/pycln
|
||||||
rev: v2.5.0
|
rev: v2.5.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: pycln
|
- id: pycln
|
||||||
args: [-a, --config=pyproject.toml]
|
args: [-a, --config=pyproject.toml]
|
||||||
- repo: https://github.com/PyCQA/bandit
|
- repo: https://github.com/PyCQA/bandit
|
||||||
rev: 1.7.10
|
rev: 1.7.10
|
||||||
hooks:
|
hooks:
|
||||||
- id: bandit
|
- id: bandit
|
||||||
args: [-c, pyproject.toml]
|
args: [-c, pyproject.toml]
|
||||||
additional_dependencies: ["bandit[toml]"]
|
additional_dependencies: ["bandit[toml]"]
|
||||||
- repo: https://github.com/PyCQA/isort
|
- repo: https://github.com/PyCQA/isort
|
||||||
rev: 5.13.2
|
rev: 5.13.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: isort
|
- id: isort
|
||||||
args: [--profile, black, --filter-files]
|
args: [--profile, black, --filter-files]
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 24.8.0
|
rev: 24.8.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
# - repo: local
|
- repo: local
|
||||||
# hooks:
|
hooks:
|
||||||
# - id: pytest-check
|
- id: generate-version-file
|
||||||
# name: pytest-check
|
name: generate _version.py
|
||||||
# entry: pdm run test
|
entry: pdm build --no-wheel
|
||||||
# language: system
|
language: system
|
||||||
# pass_filenames: false
|
pass_filenames: false
|
||||||
# always_run: true
|
always_run: true
|
||||||
|
|
||||||
|
# - repo: local
|
||||||
|
# hooks:
|
||||||
|
# - id: pytest-check
|
||||||
|
# name: pytest-check
|
||||||
|
# entry: pdm run test
|
||||||
|
# language: system
|
||||||
|
# pass_filenames: false
|
||||||
|
# always_run: true
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
try:
|
||||||
|
from ._version import version as __version__
|
||||||
|
except ImportError:
|
||||||
|
__version__ = "0.0.0+development-untracked"
|
||||||
|
|
||||||
|
|
||||||
|
def get_version() -> str:
|
||||||
|
return __version__
|
|
@ -6,6 +6,7 @@ import tomlkit
|
||||||
import typer
|
import typer
|
||||||
from typing_extensions import Annotated
|
from typing_extensions import Annotated
|
||||||
|
|
||||||
|
from joj3_config_generator import get_version
|
||||||
from joj3_config_generator.generator import (
|
from joj3_config_generator.generator import (
|
||||||
convert_joj1_conf,
|
convert_joj1_conf,
|
||||||
convert_joj3_conf,
|
convert_joj3_conf,
|
||||||
|
@ -19,7 +20,31 @@ from joj3_config_generator.loader import (
|
||||||
from joj3_config_generator.models.const import JOJ3_CONFIG_ROOT
|
from joj3_config_generator.models.const import JOJ3_CONFIG_ROOT
|
||||||
from joj3_config_generator.utils.logger import logger
|
from joj3_config_generator.utils.logger import logger
|
||||||
|
|
||||||
app = typer.Typer(add_completion=False)
|
app = typer.Typer(add_completion=False, name="joj3-forge")
|
||||||
|
|
||||||
|
|
||||||
|
def version_callback(value: bool) -> None:
|
||||||
|
if value:
|
||||||
|
print(f"{app.info.name} Version: {get_version()}")
|
||||||
|
raise typer.Exit()
|
||||||
|
|
||||||
|
|
||||||
|
@app.callback()
|
||||||
|
def common(
|
||||||
|
ctx: typer.Context,
|
||||||
|
version: Annotated[
|
||||||
|
Optional[bool],
|
||||||
|
typer.Option(
|
||||||
|
"--version",
|
||||||
|
help="Show the application version and exit.",
|
||||||
|
callback=version_callback,
|
||||||
|
is_eager=True,
|
||||||
|
),
|
||||||
|
] = None,
|
||||||
|
) -> None:
|
||||||
|
if ctx.resilient_parsing:
|
||||||
|
return
|
||||||
|
logger.info(f"Running '{ctx.invoked_subcommand}' command. Version: {get_version()}")
|
||||||
|
|
||||||
|
|
||||||
@app.command(hidden=True)
|
@app.command(hidden=True)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["pdm-backend"]
|
requires = ["pdm-backend", "setuptools>=64", "setuptools-scm>=8"]
|
||||||
build-backend = "pdm.backend"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "JOJ3-config-generator"
|
name = "JOJ3-config-generator"
|
||||||
|
@ -71,3 +71,7 @@ init_forbid_extra = true
|
||||||
init_typed = true
|
init_typed = true
|
||||||
warn_required_dynamic_aliases = true
|
warn_required_dynamic_aliases = true
|
||||||
warn_untyped_fields = true
|
warn_untyped_fields = true
|
||||||
|
|
||||||
|
[tool.setuptools_scm]
|
||||||
|
write_to = "joj3_config_generator/_version.py"
|
||||||
|
fallback_version = "0.0.0+unknown"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user