From def2e0846ae01a1415e9acc9f5104963386834eb Mon Sep 17 00:00:00 2001 From: natsuoto <279971144+natsuoto@users.noreply.github.com> Date: Tue, 28 Apr 2026 17:15:32 +0530 Subject: chore: remove dead cookiecutter regeneration infrastructure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The repo was bootstrapped from `cookiecutter-pylibrary`. The regeneration scaffolding has been sitting around since then — unused, out of date, and in some cases pointing at infrastructure (AppVeyor) that hasn't been part of CI for years. Knock it all down in one sweep so there's nothing dead-by-design in the tree after this PR. Removed - `.cookiecutterrc` — cookiecutter regen metadata. - `ci/bootstrap.py` — entry point for regenerating workflow files from the templates. - `ci/templates/` (whole directory): - `.appveyor.yml` template (AppVeyor isn't wired up). - `.github/workflows/github-actions.yml` Jinja template (the live workflow has evolved past it via #32, #35, #37). Coupled updates - `tox.ini`: dropped the `[testenv:bootstrap]` env (calls deleted `bootstrap.py`) and the `bootstrap` reference in the basepython selector. - `MANIFEST.in`: removed `include .cookiecutterrc`. - `setup.cfg`: removed `ci/templates` from the flake8 `exclude` and isort `skip` lists (dead exclusion paths). - `.pre-commit-config.yaml`: removed `ci/templates` from the top-level `exclude` regex. - `tests.local.sh`: replaced the per-version `if/elif` chain (which still listed Python 3.7 and missed 3.12-3.14) with a single programmatic `tox -e py$VERSION` lookup against `tox --listenvs-all`. Self-maintaining when the matrix changes. - `CHANGELOG.rst`: added a Housekeeping bullet for this PR. Live and untouched - `ci/requirements.txt` is still installed by every CI workflow (`pip install -r ci/requirements.txt`). Not regen-related. Closes #46 --- .cookiecutterrc | 74 ------------------ .pre-commit-config.yaml | 2 +- CHANGELOG.rst | 1 + MANIFEST.in | 1 - ci/bootstrap.py | 93 ----------------------- ci/templates/.appveyor.yml | 46 ----------- ci/templates/.github/workflows/github-actions.yml | 65 ---------------- setup.cfg | 4 +- tests.local.sh | 30 ++------ tox.ini | 11 +-- 10 files changed, 13 insertions(+), 314 deletions(-) delete mode 100644 .cookiecutterrc delete mode 100755 ci/bootstrap.py delete mode 100644 ci/templates/.appveyor.yml delete mode 100644 ci/templates/.github/workflows/github-actions.yml diff --git a/.cookiecutterrc b/.cookiecutterrc deleted file mode 100644 index b00b677..0000000 --- a/.cookiecutterrc +++ /dev/null @@ -1,74 +0,0 @@ -# This file exists so you can easily regenerate your project. -# -# `cookiepatcher` is a convenient shim around `cookiecutter` -# for regenerating projects (it will generate a .cookiecutterrc -# automatically for any template). To use it: -# -# pip install cookiepatcher -# cookiepatcher gh:ionelmc/cookiecutter-pylibrary edify -# -# See: -# https://pypi.org/project/cookiepatcher -# -# Alternatively, you can run: -# -# cookiecutter --overwrite-if-exists --config-file=edify/.cookiecutterrc gh:ionelmc/cookiecutter-pylibrary - -default_context: - - _extensions: ['jinja2_time.TimeExtension'] - _template: 'gh:ionelmc/cookiecutter-pylibrary' - allow_tests_inside_package: 'no' - appveyor: 'no' - c_extension_function: 'longest' - c_extension_module: '_edify' - c_extension_optional: 'no' - c_extension_support: 'no' - c_extension_test_pypi: 'no' - c_extension_test_pypi_username: 'luciferreeves' - codacy: 'no' - codacy_projectid: '[Get ID from https://app.codacy.com/gh/luciferreeves/edify/settings]' - codeclimate: 'no' - codecov: 'yes' - command_line_interface: 'no' - command_line_interface_bin_name: 'edify' - coveralls: 'no' - distribution_name: 'edify' - email: 'bobbyskhs@gmail.com' - full_name: 'Bobby' - github_actions: 'yes' - github_actions_osx: 'yes' - github_actions_windows: 'yes' - legacy_python: 'no' - license: 'Apache Software License 2.0' - linter: 'flake8' - package_name: 'edify' - pre_commit: 'yes' - pre_commit_formatter: 'black' - project_name: 'Edify' - project_short_description: 'Regular Expressions Made Simple' - pypi_badge: 'yes' - pypi_disable_upload: 'no' - release_date: 'today' - repo_hosting: 'github.com' - repo_hosting_domain: 'github.com' - repo_main_branch: 'main' - repo_name: 'edify' - repo_username: 'luciferreeves' - requiresio: 'yes' - scrutinizer: 'no' - setup_py_uses_pytest_runner: 'no' - setup_py_uses_setuptools_scm: 'no' - sphinx_docs: 'yes' - sphinx_docs_hosting: 'https://edify.readthedocs.io/' - sphinx_doctest: 'no' - sphinx_theme: 'sphinx-rtd-theme' - test_matrix_configurator: 'no' - test_matrix_separate_coverage: 'no' - travis: 'no' - travis_osx: 'no' - version: '0.1.0' - version_manager: 'bump2version' - website: 'https://shi.foo' - year_from: '2022' - year_to: '2022' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 17ac56d..d3b54e8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # pre-commit install # To update the pre-commit hooks run: # pre-commit install-hooks -exclude: '^(\.tox|ci/templates|\.bumpversion\.cfg)(/|$)' +exclude: '^(\.tox|\.bumpversion\.cfg)(/|$)' repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 7ec9df0..47486fe 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -40,6 +40,7 @@ Housekeeping * Dropped a dead ``py37``/``pypy37`` exclusion from the cookiecutter Jinja template and refreshed the docs copyright year (:pr:`43`). * Updated author website URL in ``AUTHORS.rst`` and ``.cookiecutterrc`` (:pr:`41`). +* Removed all cookiecutter regeneration scaffolding — ``.cookiecutterrc``, ``ci/bootstrap.py``, and ``ci/templates/`` (containing dead AppVeyor config and a workflow template that lagged the live one) — along with the ``[testenv:bootstrap]`` env, related ``MANIFEST.in`` / ``setup.cfg`` / ``.pre-commit-config.yaml`` exclusions, and the dead Python 3.7 branch in ``tests.local.sh``. The local-test script's per-version ``if/elif`` chain is now a single programmatic ``tox -e py$VERSION`` lookup, which adapts automatically when Python versions are added or removed from the matrix (:pr:`47`). 0.2.2 (2022-12-22) ------------------ diff --git a/MANIFEST.in b/MANIFEST.in index a7518d1..bd328f6 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,7 +4,6 @@ graft ci graft tests include .bumpversion.cfg -include .cookiecutterrc include .coveragerc include .editorconfig include .github/workflows/github-actions.yml diff --git a/ci/bootstrap.py b/ci/bootstrap.py deleted file mode 100755 index 3ca06b7..0000000 --- a/ci/bootstrap.py +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -from __future__ import absolute_import -from __future__ import print_function -from __future__ import unicode_literals - -import os -import subprocess -import sys -from os.path import abspath -from os.path import dirname -from os.path import exists -from os.path import join -from os.path import relpath - -base_path = dirname(dirname(abspath(__file__))) -templates_path = join(base_path, "ci", "templates") - - -def check_call(args): - print("+", *args) - subprocess.check_call(args) - - -def exec_in_env(): - env_path = join(base_path, ".tox", "bootstrap") - if sys.platform == "win32": - bin_path = join(env_path, "Scripts") - else: - bin_path = join(env_path, "bin") - if not exists(env_path): - import subprocess - - print("Making bootstrap env in: {0} ...".format(env_path)) - try: - check_call([sys.executable, "-m", "venv", env_path]) - except subprocess.CalledProcessError: - try: - check_call([sys.executable, "-m", "virtualenv", env_path]) - except subprocess.CalledProcessError: - check_call(["virtualenv", env_path]) - print("Installing `jinja2` into bootstrap environment...") - check_call([join(bin_path, "pip"), "install", "jinja2", "tox"]) - python_executable = join(bin_path, "python") - if not os.path.exists(python_executable): - python_executable += '.exe' - - print("Re-executing with: {0}".format(python_executable)) - print("+ exec", python_executable, __file__, "--no-env") - os.execv(python_executable, [python_executable, __file__, "--no-env"]) - - -def main(): - import jinja2 - - print("Project path: {0}".format(base_path)) - - jinja = jinja2.Environment( - loader=jinja2.FileSystemLoader(templates_path), - trim_blocks=True, - lstrip_blocks=True, - keep_trailing_newline=True, - ) - - tox_environments = [ - line.strip() - # 'tox' need not be installed globally, but must be importable - # by the Python that is running this script. - # This uses sys.executable the same way that the call in - # cookiecutter-pylibrary/hooks/post_gen_project.py - # invokes this bootstrap.py itself. - for line in subprocess.check_output([sys.executable, '-m', 'tox', '--listenvs'], universal_newlines=True).splitlines() - ] - tox_environments = [line for line in tox_environments if line.startswith('py')] - - for root, _, files in os.walk(templates_path): - for name in files: - relative = relpath(root, templates_path) - with open(join(base_path, relative, name), "w") as fh: - fh.write(jinja.get_template(join(relative, name)).render(tox_environments=tox_environments)) - print("Wrote {}".format(name)) - print("DONE.") - - -if __name__ == "__main__": - args = sys.argv[1:] - if args == ["--no-env"]: - main() - elif not args: - exec_in_env() - else: - print("Unexpected arguments {0}".format(args), file=sys.stderr) - sys.exit(1) diff --git a/ci/templates/.appveyor.yml b/ci/templates/.appveyor.yml deleted file mode 100644 index 956e594..0000000 --- a/ci/templates/.appveyor.yml +++ /dev/null @@ -1,46 +0,0 @@ -version: '{branch}-{build}' -build: off -image: Visual Studio 2019 -environment: - matrix: - - TOXENV: check - TOXPYTHON: C:\Python38\python.exe - PYTHON_HOME: C:\Python38 - PYTHON_VERSION: '3.8' - PYTHON_ARCH: '32' -{% for env in tox_environments %} -{% if env.startswith(('py2', 'py3')) %} - - TOXENV: {{ env }},codecov{{ "" }} - TOXPYTHON: C:\Python{{ env[2:4] }}\python.exe - PYTHON_HOME: C:\Python{{ env[2:4] }} - PYTHON_VERSION: '{{ env[2] }}.{{ env[3] }}' - PYTHON_ARCH: '32' -{% if 'nocov' in env %} - WHEEL_PATH: .tox/dist -{% endif %} - - TOXENV: {{ env }},codecov{{ "" }} - TOXPYTHON: C:\Python{{ env[2:4] }}-x64\python.exe - PYTHON_HOME: C:\Python{{ env[2:4] }}-x64 - PYTHON_VERSION: '{{ env[2] }}.{{ env[3] }}' - PYTHON_ARCH: '64' -{% if 'nocov' in env %} - WHEEL_PATH: .tox/dist -{% endif %} -{% endif %}{% endfor %} -init: - - ps: echo $env:TOXENV - - ps: ls C:\Python* -install: - - '%PYTHON_HOME%\python -mpip install --progress-bar=off tox -rci/requirements.txt' - - '%PYTHON_HOME%\Scripts\virtualenv --version' - - '%PYTHON_HOME%\Scripts\pip --version' - - '%PYTHON_HOME%\Scripts\tox --version' -test_script: - - %PYTHON_HOME%\Scripts\tox -on_failure: - - ps: dir "env:" - - ps: get-content .tox\*\log\* - -### To enable remote debugging uncomment this (also, see: http://www.appveyor.com/docs/how-to/rdp-to-build-worker): -# on_finish: -# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/ci/templates/.github/workflows/github-actions.yml b/ci/templates/.github/workflows/github-actions.yml deleted file mode 100644 index eb42d88..0000000 --- a/ci/templates/.github/workflows/github-actions.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: build -on: [push, pull_request] -jobs: - test: - name: {{ '${{ matrix.name }}' }} - runs-on: {{ '${{ matrix.os }}' }} - timeout-minutes: 30 - strategy: - fail-fast: false - matrix: - include: - - name: 'check' - python: '3.9' - toxpython: 'python3.9' - tox_env: 'check' - os: 'ubuntu-latest' - - name: 'docs' - python: '3.9' - toxpython: 'python3.9' - tox_env: 'docs' - os: 'ubuntu-latest' -{% for env in tox_environments %} -{% set prefix = env.split('-')[0] -%} -{% if prefix.startswith('pypy') %} -{% set python %}pypy-{{ prefix[4] }}.{{ prefix[5] }}{% endset %} -{% set cpython %}pp{{ prefix[4:5] }}{% endset %} -{% set toxpython %}pypy{{ prefix[4] }}.{{ prefix[5] }}{% endset %} -{% else %} -{% set python %}{{ prefix[2] }}.{{ prefix[3:] }}{% endset %} -{% set cpython %}cp{{ prefix[2:] }}{% endset %} -{% set toxpython %}python{{ prefix[2] }}.{{ prefix[3:] }}{% endset %} -{% endif %} -{% for os, python_arch in [ - ['ubuntu', 'x64'], - ['windows', 'x64'], - ['macos', ''], -] %} - - name: '{{ env }} ({{ os }})' - python: '{{ python }}' - toxpython: '{{ toxpython }}' - {% if python_arch %}python_arch: '{{ python_arch }}' - {% endif %}tox_env: '{{ env }}{% if 'cover' in env %},codecov{% endif %}' - os: '{{ os }}-latest' -{% endfor %} -{% endfor %} - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - uses: actions/setup-python@v2 - with: - python-version: {{ '${{ matrix.python }}' }} - architecture: {{ '${{ matrix.python_arch }}' }} - - name: install dependencies - run: | - python -mpip install --progress-bar=off -r ci/requirements.txt - virtualenv --version - pip --version - tox --version - pip list --format=freeze - - name: test - env: - TOXPYTHON: '{{ '${{ matrix.toxpython }}' }}' - run: > - tox -e {{ '${{ matrix.tox_env }}' }} -v diff --git a/setup.cfg b/setup.cfg index cc23bcc..3e11bf3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [flake8] max-line-length = 140 -exclude = .tox,.eggs,ci/templates,build,dist +exclude = .tox,.eggs,build,dist [tool:isort] force_single_line = True @@ -8,4 +8,4 @@ line_length = 120 known_first_party = edify default_section = THIRDPARTY forced_separate = test_edify -skip = .tox,.eggs,ci/templates,build,dist +skip = .tox,.eggs,build,dist diff --git a/tests.local.sh b/tests.local.sh index 730aeee..773e279 100755 --- a/tests.local.sh +++ b/tests.local.sh @@ -10,30 +10,16 @@ tox -e check -v # Run Docs tox -e docs -v -# Get the current installed python version -PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:3])))') +# Run the tox env matching the current Python version +PY_NODOT=$(python3 -c 'import sys; print("{0.major}{0.minor}".format(sys.version_info))') +TOX_ENV="py${PY_NODOT}" -# Subset the python version to the major.minor version -PYTHON_VERSION=$(echo $PYTHON_VERSION | cut -d. -f1,2) - -if [ "$PYTHON_VERSION" = "3.7" ]; then - # Build using python 3.7 - tox -e py37 -v -elif [ "$PYTHON_VERSION" = "3.8" ]; then - # Build using python 3.8 - tox -e py38 -v -elif [ "$PYTHON_VERSION" = "3.9" ]; then - # Build using python 3.9 - tox -e py39 -v -elif [ "$PYTHON_VERSION" = "3.10" ]; then - # Build using python 3.10 - tox -e py310 -v -elif [ "$PYTHON_VERSION" = "3.11" ]; then - # Build using python 3.11 - tox -e py311 -v +if tox --listenvs-all | grep -qE "^${TOX_ENV}$"; then + tox -e "${TOX_ENV}" -v else - # Show error message - echo "Python version $PYTHON_VERSION is not supported" + PY_DOTTED=$(python3 -c 'import sys; print("{0.major}.{0.minor}".format(sys.version_info))') + echo "Python ${PY_DOTTED} (tox env ${TOX_ENV}) is not in tox envlist" + exit 1 fi # Run Coverage diff --git a/tox.ini b/tox.ini index c87143a..f8a362e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,3 @@ -[testenv:bootstrap] -deps = - jinja2 - tox -skip_install = true -commands = - python ci/bootstrap.py --no-env -passenv = - * ; a generative tox configuration, see: https://tox.readthedocs.io/en/latest/config.html#generative-envlist [tox] @@ -29,7 +20,7 @@ basepython = py312: {env:TOXPYTHON:python3.12} py313: {env:TOXPYTHON:python3.13} py314: {env:TOXPYTHON:python3.14} - {bootstrap,clean,check,report,docs,codecov}: {env:TOXPYTHON:python3} + {clean,check,report,docs,codecov}: {env:TOXPYTHON:python3} setenv = PYTHONPATH={toxinidir}/tests PYTHONUNBUFFERED=yes -- cgit v1.2.3