From 6486b278c520ac78d1532c65402e3120116f89d5 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Sun, 15 Mar 2020 16:58:09 +0000 Subject: [PATCH 1/2] Remove isort seed It is not needed if we consider all unknown dependencies as third party by default. This will save an apparently unneeded diff and many possible git conflicts in the future. --- .pre-commit-config.yaml | 8 ++------ pyproject.toml | 3 ++- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f0d10a3a7..fe60bce0c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,12 +30,8 @@ repos: pass_filenames: false # isorting our imports - - repo: https://github.com/asottile/seed-isort-config - rev: v2.1.0 - hooks: - - id: seed-isort-config - - repo: https://github.com/pre-commit/mirrors-isort - rev: v4.3.21 + - repo: https://github.com/timothycrosley/isort + rev: 4.3.21 hooks: - id: isort additional_dependencies: diff --git a/pyproject.toml b/pyproject.toml index 8dc081018..86c73276a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,9 +58,10 @@ target-version = ['py36'] [tool.isort] combine_as_imports = true +default_section = "THIRDPARTY" force_grid_wrap = 0 include_trailing_comma = true -known_third_party = ["colorama", "jinja2", "packaging", "pathspec", "pkg_resources", "plumbum", "py", "pydantic", "pytest", "six", "yaml", "yamlinclude"] +known_first_party = ["copier"] line_length = 88 multi_line_output = 3 # black interop use_parentheses = true From a442fb72bc576402120297bf0414d0edb48bcb0e Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Sun, 15 Mar 2020 17:02:47 +0000 Subject: [PATCH 2/2] Implement dynamic versioning Fix #159. --- .github/workflows/ci.yml | 8 ++++---- .github/workflows/coverage.yml | 4 ++-- copier/__init__.py | 1 - copier/cli.py | 2 -- copier/version.py | 7 ------- pyproject.toml | 7 ++++++- 6 files changed, 12 insertions(+), 17 deletions(-) delete mode 100644 copier/version.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48290ad1a..cb881d5de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: generate cache key PY - run: echo "::set-env name=PY::$((python -VV; poetry -V) | sha256sum | cut -d' ' + run: echo "::set-env name=PY::$((python -VV; pip freeze) | sha256sum | cut -d' ' -f1)" - uses: actions/cache@v1 with: @@ -31,7 +31,7 @@ jobs: with: path: ~/.local key: local-${{ env.PY }}|${{ hashFiles('pyproject.toml') }}|${{ hashFiles('poetry.lock') }}|${{ hashFiles('.pre-commit-config.yaml') }} - - run: python -m pip install poetry + - run: python -m pip install poetry poetry-dynamic-versioning - run: poetry install - name: Run pre-commit run: | @@ -52,9 +52,9 @@ jobs: uses: actions/setup-python@v1 with: python-version: 3.8 - - run: python -m pip install poetry + - run: python -m pip install poetry poetry-dynamic-versioning - name: generate cache key PY - run: echo "::set-env name=PY::$((python -VV; poetry -V) | sha256sum | cut -d' ' + run: echo "::set-env name=PY::$((python -VV; pip freeze) | sha256sum | cut -d' ' -f1)" - uses: actions/cache@v1 with: diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index f753e2d77..f0f78226a 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -15,9 +15,9 @@ jobs: uses: actions/setup-python@v1 with: python-version: 3.8 - - run: python -m pip install poetry + - run: python -m pip install poetry poetry-dynamic-versioning - name: generate cache key PY - run: echo "::set-env name=PY::$((python -VV; poetry -V) | sha256sum | cut -d' ' + run: echo "::set-env name=PY::$((python -VV; pip freeze) | sha256sum | cut -d' ' -f1)" - uses: actions/cache@v1 with: diff --git a/copier/__init__.py b/copier/__init__.py index ccd82363a..7a3b6346b 100644 --- a/copier/__init__.py +++ b/copier/__init__.py @@ -2,4 +2,3 @@ """ from .main import * # noqa from .tools import * # noqa -from .version import __version__ # noqa diff --git a/copier/cli.py b/copier/cli.py index 08a45e02f..1f9fda091 100755 --- a/copier/cli.py +++ b/copier/cli.py @@ -7,7 +7,6 @@ from .config.objects import UserMessageError from .main import copy from .types import AnyByStrDict, OptStr -from .version import __version__ def handle_exceptions(method): @@ -38,7 +37,6 @@ class CopierApp(cli.Application): copier [SWITCHES] [update] [destination_path] """ ) - VERSION = __version__ CALL_MAIN_IF_NESTED_COMMAND = False data: AnyByStrDict = {} diff --git a/copier/version.py b/copier/version.py deleted file mode 100644 index 03f00bd90..000000000 --- a/copier/version.py +++ /dev/null @@ -1,7 +0,0 @@ -import pkg_resources - -try: - __version__: str = pkg_resources.require("copier")[0].version -except Exception: # pragma: no cover - # Run pytest without needing to install the library - __version__ = None # type: ignore diff --git a/pyproject.toml b/pyproject.toml index 86c73276a..80f1741b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool] [tool.poetry] name = "copier" -version = "3.0.0-alpha6" +version = "0.0.0" description = "A library for rendering project templates." license = "MIT" classifiers = [ @@ -52,6 +52,11 @@ pre-commit = "*" pytest = "^5.3" pytest-cov = "*" +[tool.poetry-dynamic-versioning] +enable = true +style = "semver" +vcs = "git" + [tool.black] line-length = 88 target-version = ['py36']