mirror of
https://github.com/copier-org/copier.git
synced 2025-05-23 16:11:17 +00:00
Allow CLI to display version with copier --version
This is a regression from #162 where `__version__` was removed due to conflicts with how black and poetry-dynamic-versioning work. Now those conflicts are fixed and `copier --version` works again. This was what it was returning before: ```bash ➤ copier --version copier (version not set) ``` BEWARE: In a development, it will always return `0.0.0`, but this is expected because poetry-dynamic-versioning autopatches this on release. In `.pre-commit-config.yaml`, `require_serial: true` is added to all local tasks that run under `poetry run`. This is because when entering `poetry run`, poetry-dynamic-versioning does its magic and patches the versions in `pyproject.toml` and `__init__.py`, and unpatches them when ending the execution. If running in parallel (default pre-commit behavior), some patches are reverted and some aren't, producing random failed lints. @Tecnativa TT20357
This commit is contained in:
parent
58f4fad64b
commit
c37b5ed39b
@ -16,18 +16,21 @@ repos:
|
|||||||
entry: poetry run black
|
entry: poetry run black
|
||||||
language: system
|
language: system
|
||||||
types: [python]
|
types: [python]
|
||||||
|
require_serial: true
|
||||||
- id: flake8
|
- id: flake8
|
||||||
name: flake8
|
name: flake8
|
||||||
entry: poetry run flake8
|
entry: poetry run flake8
|
||||||
language: system
|
language: system
|
||||||
types: [python]
|
types: [python]
|
||||||
args: ["--config", "pyproject.toml"]
|
args: ["--config", "pyproject.toml"]
|
||||||
|
require_serial: true
|
||||||
- id: poetry_check
|
- id: poetry_check
|
||||||
description: Check the integrity of pyproject.toml
|
description: Check the integrity of pyproject.toml
|
||||||
name: poetry_check
|
name: poetry_check
|
||||||
entry: poetry check
|
entry: poetry check
|
||||||
language: system
|
language: system
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
|
require_serial: true
|
||||||
|
|
||||||
# isorting our imports
|
# isorting our imports
|
||||||
- repo: https://github.com/timothycrosley/isort
|
- repo: https://github.com/timothycrosley/isort
|
||||||
|
@ -2,3 +2,6 @@
|
|||||||
"""
|
"""
|
||||||
from .main import * # noqa
|
from .main import * # noqa
|
||||||
from .tools import * # noqa
|
from .tools import * # noqa
|
||||||
|
|
||||||
|
# This version is a placeholder autoupdated by poetry-dynamic-versioning
|
||||||
|
__version__ = "0.0.0"
|
||||||
|
@ -4,6 +4,7 @@ from textwrap import dedent
|
|||||||
|
|
||||||
from plumbum import cli, colors
|
from plumbum import cli, colors
|
||||||
|
|
||||||
|
from . import __version__
|
||||||
from .config.objects import UserMessageError
|
from .config.objects import UserMessageError
|
||||||
from .main import copy
|
from .main import copy
|
||||||
from .types import AnyByStrDict, OptStr
|
from .types import AnyByStrDict, OptStr
|
||||||
@ -37,6 +38,7 @@ class CopierApp(cli.Application):
|
|||||||
copier [SWITCHES] [update] [destination_path]
|
copier [SWITCHES] [update] [destination_path]
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
VERSION = __version__
|
||||||
CALL_MAIN_IF_NESTED_COMMAND = False
|
CALL_MAIN_IF_NESTED_COMMAND = False
|
||||||
data: AnyByStrDict = {}
|
data: AnyByStrDict = {}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
[tool]
|
[tool]
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "copier"
|
name = "copier"
|
||||||
|
# This version is a placeholder autoupdated by poetry-dynamic-versioning
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
description = "A library for rendering project templates."
|
description = "A library for rendering project templates."
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user