ionelmc / cookiecutter-pylibrary

Enhanced cookiecutter template for Python libraries.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error with bumpversion if not github hosting

Querela opened this issue · comments

I'm working on a repo on a private gitlab and I found that bumpversion throws an error because it can't find a version in the README.rst.

The only occurence with cookiecutter.version is when the user chooses GitHub as host.

{%- if cookiecutter.repo_hosting_domain == "github.com" %}
.. |commits-since| image:: https://img.shields.io/github/commits-since/{{ cookiecutter.repo_username }}/{{ cookiecutter.repo_name }}/v{{ cookiecutter.version }}.svg
    :alt: Commits since latest release
    :target: https://{{ cookiecutter.repo_hosting_domain }}/{{ cookiecutter.repo_username }}/{{ cookiecutter.repo_name }}/compare/v{{ cookiecutter.version }}...master
{% endif %}

But cookiecutter allows GitLab or freeform for codehosting. If the badge is only possible for GitHub then we might need to add a Jinja condition to bumpversion.cfg to skip the README.rst.

Shouldn't have the CI test caught that? (I saw it run bumpversion when I tested my own pull request.)
https://github.com/ionelmc/cookiecutter-pylibrary/blob/master/ci/envs/pure-private.cookiecutterrc

But there is such a condition.

{%- if cookiecutter.repo_hosting_domain != "no" %}

[bumpversion:file:README.rst]
search = v{current_version}.
replace = v{new_version}.
{%- endif %}

Paste your .cookiecutterrc?

Sorry, I might have overlooked it.

# 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 python-curl-webapp
#
# See:
#    https://pypi.org/project/cookiepatcher
#
# Alternatively, you can run:
#
#    cookiecutter --overwrite-if-exists --config-file=python-curl-webapp/.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:        '_curl_webapp'
    c_extension_optional:      'no'
    c_extension_support:       'no'
    c_extension_test_pypi:     'no'
    c_extension_test_pypi_username: 'koerner'
    codacy:                    'no'
    codacy_projectid:          '[Get ID from https://app.codacy.com/app/koerner/python-curl-webapp/settings]'
    codeclimate:               'no'
    codecov:                   'no'
    command_line_interface:    'click'
    command_line_interface_bin_name: 'curl-webapp'
    coveralls:                 'no'
    coveralls_token:           '[Required for Appveyor, take it from https://coveralls.io/github/koerner/python-curl-webapp]'
    distribution_name:         'curl-webapp'
    email:                     'koerner@informatik.uni-leipzig.de'
    full_name:                 'Erik Körner'
    legacy_python:             'no'
    license:                   'MIT license'
    linter:                    'flake8'
    package_name:              'curl_webapp'
    pre_commit:                'yes'
    project_name:              'CURL-WebApp'
    project_short_description: 'CURL WebApp.'
    pypi_badge:                'no'
    pypi_disable_upload:       'yes'
    release_date:              'today'
    repo_hosting:              'other domain not listed'
    repo_hosting_domain:       'git.informatik.uni-leipzig.de'
    repo_name:                 'python-curl-webapp'
    repo_username:             'koerner'
    requiresio:                'no'
    scrutinizer:               'no'
    setup_py_uses_setuptools_scm: 'no'
    setup_py_uses_test_runner: 'no'
    sphinx_docs:               'yes'
    sphinx_docs_hosting:       'https://python-curl-webapp.readthedocs.io/'
    sphinx_doctest:            'no'
    sphinx_theme:              'sphinx-rtd-theme'
    test_matrix_configurator:  'no'
    test_matrix_separate_coverage: 'no'
    test_runner:               'pytest'
    travis:                    'no'
    travis_osx:                'no'
    version:                   '0.0.0'
    website:                   'asv.informatik.uni-leipzig.de/staff/Erik_K%C3%B6rner'
    year_from:                 '2021'
    year_to:                   '2021'

It might have included it in bumpversion.cfg because I did not keep "no" but provided my own URL. Maybe the check for domain has to be just != "github.com"? It should match with the check in README.rst.