From 0308157245701c28fb951ef25a8c91ee4a1f2b9c Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Mon, 8 Jul 2024 18:21:14 +0200 Subject: [PATCH 01/21] docs template generation made optional --- cookiecutter.json | 32 ++++++++++++-------------------- hooks/post_gen_project.py | 11 ++++++++++- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index 349add2..adcd6ee 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -1,21 +1,13 @@ { - "client_name": "ds", - "project_name": "default", - "__project_name_slug": "{{cookiecutter.project_name | slugify}}", - "__client_name_slug": "{{cookiecutter.client_name | slugify}}", - "repo_name": "{{cookiecutter.__client_name_slug}}-{{cookiecutter.__project_name_slug}}", - "ci": [ - "GitLab", - "Github", - "None" - ], - "jupytext": [ - "No", - "Yes" - ], - "python_package_name": "{{ cookiecutter.__project_name_slug.replace('-', '_') }}", - "__package_name": "{{ cookiecutter.python_package_name }}", - "_copy_without_render": [ - ".github/workflows/*.yml" - ] - } \ No newline at end of file + "client_name": "ds", + "project_name": "default", + "__project_name_slug": "{{cookiecutter.project_name | slugify}}", + "__client_name_slug": "{{cookiecutter.client_name | slugify}}", + "repo_name": "{{cookiecutter.__client_name_slug}}-{{cookiecutter.__project_name_slug}}", + "ci": ["GitLab", "Github", "None"], + "jupytext": ["No", "Yes"], + "docs": ["Sphinx", "No docs"], + "python_package_name": "{{ cookiecutter.__project_name_slug.replace('-', '_') }}", + "__package_name": "{{ cookiecutter.python_package_name }}", + "_copy_without_render": [".github/workflows/*.yml"] +} diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 37a1eda..533b0ae 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -17,6 +17,11 @@ ".github/", ] +docs_files = [ + "docs/", + "build_docs.sh" +] + {% if cookiecutter.ci != "GitLab" %} REMOVE_PATHS.extend(gitlab_files) {% endif %} @@ -29,6 +34,10 @@ REMOVE_PATHS.extend(["notebooks/example.py"]) {% endif %} +{% if cookiecutter.docs == "No docs" %} +REMOVE_PATHS.extend(docs_files) +{% endif %} + print("Cleaning files... 🌀") for path in REMOVE_PATHS: path = Path(path) @@ -44,4 +53,4 @@ for path in Path("").rglob("*.sh"): path.chmod(path.stat().st_mode | stat.S_IXUSR) -print("DONE 🎆") \ No newline at end of file +print("DONE 🎆") From 4d72023dee7bfbe78c5ccc67351198df53633f26 Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Mon, 8 Jul 2024 19:18:39 +0200 Subject: [PATCH 02/21] removed docs generation from CI/CD if disabled during project setup --- hooks/post_gen_project.py | 3 ++- {{ cookiecutter.repo_name }}/.gitlab-ci.yml | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 533b0ae..c6b001e 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -19,7 +19,8 @@ docs_files = [ "docs/", - "build_docs.sh" + "build_docs.sh", + ".github/workflows/documentation.yaml" ] {% if cookiecutter.ci != "GitLab" %} diff --git a/{{ cookiecutter.repo_name }}/.gitlab-ci.yml b/{{ cookiecutter.repo_name }}/.gitlab-ci.yml index d8ef467..c490874 100644 --- a/{{ cookiecutter.repo_name }}/.gitlab-ci.yml +++ b/{{ cookiecutter.repo_name }}/.gitlab-ci.yml @@ -7,12 +7,11 @@ variables: DOCKER_REGISTRY: $CI_REGISTRY/$CI_PROJECT_PATH PRECOMMIT_IMAGE: $DOCKER_REGISTRY/precommit - # run CI on default branch or MR only workflow: rules: - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - - if: '$CI_MERGE_REQUEST_IID' + - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" + - if: "$CI_MERGE_REQUEST_IID" stages: - preparation @@ -58,7 +57,7 @@ stages: stage: preparation image: docker:23 rules: - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" changes: - docker/precommit/Dockerfile - .pre-commit-config.yaml @@ -87,7 +86,6 @@ stages: # Consider to use stable commit SHA from main branch instead # and manual changes to reduce surprises. - # To overcome issue that latest might not be present # and assume that this either new project / done in # atomic merge request and is not main branch @@ -120,7 +118,7 @@ lint-precommit-changed: - docker/precommit/Dockerfile - .pre-commit-config.yaml when: always - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' + - if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH" when: never ############################################# @@ -236,6 +234,7 @@ tests: rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH +{% if cookiecutter.docs != "No docs" %} ############################################## # Job to build Sphinx docs and host it on GitLab Pages @@ -249,6 +248,7 @@ pages: - ./build_docs.sh artifacts: paths: - - public + - public rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH +{% endif %} From 72c434118848ac70ab7c6950733caa8b77ce9bdb Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Tue, 9 Jul 2024 10:23:35 +0200 Subject: [PATCH 03/21] refacotred post-gen hooks --- hooks/post_gen_project.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index c6b001e..1326458 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -4,43 +4,41 @@ print("Running post generation...") -ci = "{{ cookiecutter.ci }}" +remove_paths = [] -REMOVE_PATHS = [] - -gitlab_files = [ +GITLAB_FILES = [ ".gitlab-ci.yml", "docker/precommit" ] -github_files = [ +GITHUB_FILES = [ ".github/", ] -docs_files = [ +DOCS_FILES = [ "docs/", "build_docs.sh", ".github/workflows/documentation.yaml" ] {% if cookiecutter.ci != "GitLab" %} -REMOVE_PATHS.extend(gitlab_files) +remove_paths.extend(GITLAB_FILES) {% endif %} {% if cookiecutter.ci != "Github" %} -REMOVE_PATHS.extend(github_files) +remove_paths.extend(GITHUB_FILES) {% endif %} {% if cookiecutter.jupytext != "Yes" %} -REMOVE_PATHS.extend(["notebooks/example.py"]) +remove_paths.extend(["notebooks/example.py"]) {% endif %} {% if cookiecutter.docs == "No docs" %} -REMOVE_PATHS.extend(docs_files) +remove_paths.extend(DOCS_FILES) {% endif %} print("Cleaning files... 🌀") -for path in REMOVE_PATHS: +for path in remove_paths: path = Path(path) if path.exists() and path.is_file(): print(f"Clean up file: '{path}'") From 35f381fb34b98e663e554b882302f7b3f5cb2706 Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Tue, 9 Jul 2024 10:45:16 +0200 Subject: [PATCH 04/21] python-semantic-release partial support: pyproject.toml + GitHub CI --- cookiecutter.json | 1 + hooks/post_gen_project.py | 19 ++- .../workflows/check_future_version.yml | 22 +++ {{ cookiecutter.repo_name }}/pyproject.toml | 145 +++++++++++++----- 4 files changed, 148 insertions(+), 39 deletions(-) create mode 100644 {{ cookiecutter.repo_name }}/.github/workflows/check_future_version.yml diff --git a/cookiecutter.json b/cookiecutter.json index adcd6ee..ab99733 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -7,6 +7,7 @@ "ci": ["GitLab", "Github", "None"], "jupytext": ["No", "Yes"], "docs": ["Sphinx", "No docs"], + "versioning": ["Bumpversion", "Python Semantic Release", "None"], "python_package_name": "{{ cookiecutter.__project_name_slug.replace('-', '_') }}", "__package_name": "{{ cookiecutter.python_package_name }}", "_copy_without_render": [".github/workflows/*.yml"] diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 1326458..09fcbd1 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -21,6 +21,15 @@ ".github/workflows/documentation.yaml" ] +BUMPVERSION_FILES = [ + ".bumpversion.cfg", + "bump_version.sh" +] + +SEMANTIC_RELEASE_FILES = [ + ".github/workflows/check_future_version.yml", +] + {% if cookiecutter.ci != "GitLab" %} remove_paths.extend(GITLAB_FILES) {% endif %} @@ -30,13 +39,21 @@ {% endif %} {% if cookiecutter.jupytext != "Yes" %} -remove_paths.extend(["notebooks/example.py"]) +remove_paths.append("notebooks/example.py") {% endif %} {% if cookiecutter.docs == "No docs" %} remove_paths.extend(DOCS_FILES) {% endif %} +{% if cookiecutter.versioning != "Bumpversion" %} +remove_paths.extend(BUMPVERSION_FILES) +{% endif %} + +{% if cookiecutter.versioning != "Python Semantic Release" %} +remove_paths.extend(SEMANTIC_RELEASE_FILES) +{% endif %} + print("Cleaning files... 🌀") for path in remove_paths: path = Path(path) diff --git a/{{ cookiecutter.repo_name }}/.github/workflows/check_future_version.yml b/{{ cookiecutter.repo_name }}/.github/workflows/check_future_version.yml new file mode 100644 index 0000000..2bd2df2 --- /dev/null +++ b/{{ cookiecutter.repo_name }}/.github/workflows/check_future_version.yml @@ -0,0 +1,22 @@ +name: Check New Version + +on: workflow_dispatch + +jobs: + release: + runs-on: ubuntu-latest + concurrency: release + permissions: + id-token: write + contents: write + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Python Semantic Release + uses: python-semantic-release/python-semantic-release@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + root_options: "-v --noop" \ No newline at end of file diff --git a/{{ cookiecutter.repo_name }}/pyproject.toml b/{{ cookiecutter.repo_name }}/pyproject.toml index 10da5a8..0eadc73 100644 --- a/{{ cookiecutter.repo_name }}/pyproject.toml +++ b/{{ cookiecutter.repo_name }}/pyproject.toml @@ -1,18 +1,13 @@ [build-system] -requires = [ - "setuptools >= 40.9.0", - "wheel", -] +requires = ["setuptools >= 40.9.0", "wheel"] build-backend = "setuptools.build_meta" [tool.isort] -multi_line_output=3 -line_length=120 +multi_line_output = 3 +line_length = 120 include_trailing_comma = true -known_first_party=[ - '{{ cookiecutter.__package_name }}' -] -known_third_party=[ # Most popular libraries. Extend if necessary. +known_first_party = ['{{ cookiecutter.__package_name }}'] +known_third_party = [ # Most popular libraries. Extend if necessary. 'IPython', 'PIL', 'cv2', @@ -47,13 +42,13 @@ known_third_party=[ # Most popular libraries. Extend if necessary. 'tqdm', 'typer', ] -skip_gitignore=true +skip_gitignore = true [tool.black] -line_length=120 +line_length = 120 [tool.pytest] -norecursedirs=[ +norecursedirs = [ '.git', '.tox', '.env', @@ -88,7 +83,7 @@ warn_unused_ignores = false show_error_codes = true check_untyped_defs = true no_implicit_optional = true -mypy_path=['src'] +mypy_path = ['src'] [[tool.mypy.overrides]] module = "{{ cookiecutter.__package_name }}.*" @@ -96,34 +91,34 @@ ignore_missing_imports = false disallow_untyped_defs = true [tool.pylint.basic] -good-names="i,j,x,y,z,x1,y1,z1,x2,y2,z2,cv,df,dx,dy,dz,w,h,c,b,g,qa,q,a" -max-args=8 +good-names = "i,j,x,y,z,x1,y1,z1,x2,y2,z2,cv,df,dx,dy,dz,w,h,c,b,g,qa,q,a" +max-args = 8 [tool.pylint.main] -load-plugins=["pylint.extensions.docparams"] +load-plugins = ["pylint.extensions.docparams"] [tool.pylint.messages_control] -disable=[ - "suppressed-message", - # therefore we wouldn't have to install full dependency set in order to lint - "import-error", - # sometimes we create a dataclass or Pydantic module and just don't need public methods - "too-few-public-methods", - # below is handled by pycln - "unused-import", - # below is handled by isort - "wrong-import-order", - # too restrictive - "too-many-instance-attributes", - # not necessary nor useful in our projects - "missing-module-docstring" - ] +disable = [ + "suppressed-message", + # therefore we wouldn't have to install full dependency set in order to lint + "import-error", + # sometimes we create a dataclass or Pydantic module and just don't need public methods + "too-few-public-methods", + # below is handled by pycln + "unused-import", + # below is handled by isort + "wrong-import-order", + # too restrictive + "too-many-instance-attributes", + # not necessary nor useful in our projects + "missing-module-docstring", +] [tool.pylint.format] -max-line-length=120 +max-line-length = 120 [tool.pylint.miscellaneous] -notes=["XXX"] +notes = ["XXX"] [tool.pylint.parameter_documentation] accept-no-param-doc = false @@ -133,13 +128,87 @@ accept-no-yields-doc = false default-docstring-type = "google" [tool.pylint.design] -max-locals=20 +max-locals = 20 [tool.pylint.similarities] -min-similarity-lines=10 +min-similarity-lines = 10 [tool.bandit] -exclude_dirs = ["venv",] + + + + +{% if cookiecutter.versioning == "Python Semantic Release" %} +exclude_dirs = ["venv"] # B101 disables errors for asserts in the code # remember to not use asserts for security and control flows -skips = ["B101"] \ No newline at end of file +skips = ["B101"] +[tool.semantic_release] +assets = [] +commit_message = "{version}\n\nAutomatically generated by python-semantic-release" +commit_parser = "angular" +logging_use_named_masks = false +major_on_zero = false +allow_zero_version = true +tag_format = "v{version}" +version_variables = [ + "src/{{ cookiecutter.__package_name }}/__version__.py:__version__", +] +build_command = "pip install build && python -m build" + +[tool.semantic_release.branches.main] +match = "(main|master)" +prerelease_token = "rc" +prerelease = false + +[tool.semantic_release.changelog] +template_dir = "templates" +changelog_file = "CHANGELOG.md" +exclude_commit_patterns = [] + +[tool.semantic_release.changelog.environment] +block_start_string = "{%" +block_end_string = "%}" +variable_start_string = "{{" +variable_end_string = "}}" +comment_start_string = "{#" +comment_end_string = "#}" +trim_blocks = false +lstrip_blocks = false +newline_sequence = "\n" +keep_trailing_newline = false +extensions = [] +autoescape = true + +[tool.semantic_release.commit_author] +env = "GIT_COMMIT_AUTHOR" +default = "semantic-release " + +[tool.semantic_release.commit_parser_options] +allowed_tags = [ + "build", + "chore", + "ci", + "docs", + "feat", + "fix", + "perf", + "style", + "refactor", + "test", +] +minor_tags = ["feat"] +patch_tags = ["fix", "perf"] +default_bump_level = 0 + +[tool.semantic_release.remote] +name = "origin" +type = "github" +ignore_token_for_push = false +insecure = false + +[tool.semantic_release.publish] + +{% endif %} +dist_glob_patterns = ["dist/*"] +upload_to_vcs_release = true From 2972384deeef910f666bee6aa45a84d4559ec650 Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Tue, 23 Jul 2024 12:19:26 +0200 Subject: [PATCH 05/21] jinja2 typo fix --- {{ cookiecutter.repo_name }}/pyproject.toml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/{{ cookiecutter.repo_name }}/pyproject.toml b/{{ cookiecutter.repo_name }}/pyproject.toml index 0eadc73..b4fc979 100644 --- a/{{ cookiecutter.repo_name }}/pyproject.toml +++ b/{{ cookiecutter.repo_name }}/pyproject.toml @@ -134,15 +134,12 @@ max-locals = 20 min-similarity-lines = 10 [tool.bandit] - - - - -{% if cookiecutter.versioning == "Python Semantic Release" %} exclude_dirs = ["venv"] # B101 disables errors for asserts in the code # remember to not use asserts for security and control flows skips = ["B101"] + +{% if cookiecutter.versioning == "Python Semantic Release" %} [tool.semantic_release] assets = [] commit_message = "{version}\n\nAutomatically generated by python-semantic-release" @@ -208,7 +205,6 @@ ignore_token_for_push = false insecure = false [tool.semantic_release.publish] - -{% endif %} dist_glob_patterns = ["dist/*"] upload_to_vcs_release = true +{% endif %} From 1548f5ba1347aa0dcae05828ca97814d75135437 Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Tue, 23 Jul 2024 13:16:48 +0200 Subject: [PATCH 06/21] fix: escpaed semantic-relase controls including jinja2 reserved syntax --- {{ cookiecutter.repo_name }}/pyproject.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/{{ cookiecutter.repo_name }}/pyproject.toml b/{{ cookiecutter.repo_name }}/pyproject.toml index b4fc979..a03d007 100644 --- a/{{ cookiecutter.repo_name }}/pyproject.toml +++ b/{{ cookiecutter.repo_name }}/pyproject.toml @@ -139,7 +139,7 @@ exclude_dirs = ["venv"] # remember to not use asserts for security and control flows skips = ["B101"] -{% if cookiecutter.versioning == "Python Semantic Release" %} +{%- if cookiecutter.versioning == "Python Semantic Release" %} [tool.semantic_release] assets = [] commit_message = "{version}\n\nAutomatically generated by python-semantic-release" @@ -163,6 +163,7 @@ template_dir = "templates" changelog_file = "CHANGELOG.md" exclude_commit_patterns = [] +{%- raw %} [tool.semantic_release.changelog.environment] block_start_string = "{%" block_end_string = "%}" @@ -176,6 +177,7 @@ newline_sequence = "\n" keep_trailing_newline = false extensions = [] autoescape = true +{% endraw -%} [tool.semantic_release.commit_author] env = "GIT_COMMIT_AUTHOR" @@ -207,4 +209,4 @@ insecure = false [tool.semantic_release.publish] dist_glob_patterns = ["dist/*"] upload_to_vcs_release = true -{% endif %} +{% endif -%} From f7ba881a4fc4ae13598d178ae0564715c673a05b Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Tue, 23 Jul 2024 13:18:17 +0200 Subject: [PATCH 07/21] refactor: better var naming in hooks --- hooks/post_gen_project.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 09fcbd1..2e9c03e 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -4,7 +4,7 @@ print("Running post generation...") -remove_paths = [] +files_to_be_removed = [] GITLAB_FILES = [ ".gitlab-ci.yml", @@ -31,31 +31,31 @@ ] {% if cookiecutter.ci != "GitLab" %} -remove_paths.extend(GITLAB_FILES) +files_to_be_removed.extend(GITLAB_FILES) {% endif %} {% if cookiecutter.ci != "Github" %} -remove_paths.extend(GITHUB_FILES) +files_to_be_removed.extend(GITHUB_FILES) {% endif %} {% if cookiecutter.jupytext != "Yes" %} -remove_paths.append("notebooks/example.py") +files_to_be_removed.append("notebooks/example.py") {% endif %} {% if cookiecutter.docs == "No docs" %} -remove_paths.extend(DOCS_FILES) +files_to_be_removed.extend(DOCS_FILES) {% endif %} {% if cookiecutter.versioning != "Bumpversion" %} -remove_paths.extend(BUMPVERSION_FILES) +files_to_be_removed.extend(BUMPVERSION_FILES) {% endif %} {% if cookiecutter.versioning != "Python Semantic Release" %} -remove_paths.extend(SEMANTIC_RELEASE_FILES) +files_to_be_removed.extend(SEMANTIC_RELEASE_FILES) {% endif %} print("Cleaning files... 🌀") -for path in remove_paths: +for path in files_to_be_removed: path = Path(path) if path.exists() and path.is_file(): print(f"Clean up file: '{path}'") From cee6968d8dd634e422ff8495b665acb772f21428 Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Tue, 23 Jul 2024 18:12:01 +0200 Subject: [PATCH 08/21] skipping docs fix --- hooks/post_gen_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 2e9c03e..25d4dd8 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -18,7 +18,7 @@ DOCS_FILES = [ "docs/", "build_docs.sh", - ".github/workflows/documentation.yaml" + ".github/workflows/documentation.yml" ] BUMPVERSION_FILES = [ From 2daf1f3180aee3ae30c84cb232c1bcaca4f5de86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Hordy=C5=84ski?= <26008518+mhordynski@users.noreply.github.com> Date: Tue, 9 Jul 2024 07:29:46 +0200 Subject: [PATCH 09/21] fix: missing contents read permission in GH actions (#18) --- {{ cookiecutter.repo_name }}/.github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/{{ cookiecutter.repo_name }}/.github/workflows/ci.yml b/{{ cookiecutter.repo_name }}/.github/workflows/ci.yml index c7b5353..63e99f0 100644 --- a/{{ cookiecutter.repo_name }}/.github/workflows/ci.yml +++ b/{{ cookiecutter.repo_name }}/.github/workflows/ci.yml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 permissions: + contents: read checks: write pull-requests: write steps: From 9a3f742c22b67c85a8674939728544fa8804dae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Hordy=C5=84ski?= <26008518+mhordynski@users.noreply.github.com> Date: Tue, 23 Jul 2024 16:20:14 +0200 Subject: [PATCH 10/21] chore: add issue templates (#20) --- .github/ISSUE_TEMPLATE/01_feature_request.yml | 31 +++++++++++++++++++ .github/ISSUE_TEMPLATE/02_bug_report.yml | 31 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/01_feature_request.yml create mode 100644 .github/ISSUE_TEMPLATE/02_bug_report.yml diff --git a/.github/ISSUE_TEMPLATE/01_feature_request.yml b/.github/ISSUE_TEMPLATE/01_feature_request.yml new file mode 100644 index 0000000..84bd423 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/01_feature_request.yml @@ -0,0 +1,31 @@ +name: 🚀 Feature Request +description: Submit a proposal/request for a new ds-template feature. +title: "feat: " +labels: ["feature"] +body: + - type: markdown + attributes: + value: | + Thanks for contributing to ds-template! + - type: textarea + id: feature-description + attributes: + label: Feature description + description: A clear and concise description of the feature proposal + placeholder: Tell us what you want! + validations: + required: true + - type: textarea + id: feature-motivation + attributes: + label: Motivation + description: A clear and concise description of what the problem is, e.g., I'm always frustrated when [...] + placeholder: Why do you need this feature? + validations: + required: true + - type: textarea + id: feature-context + attributes: + label: Additional context + description: Add any other context or screenshots about the feature request here. + placeholder: Screenshots, code snippets, etc. diff --git a/.github/ISSUE_TEMPLATE/02_bug_report.yml b/.github/ISSUE_TEMPLATE/02_bug_report.yml new file mode 100644 index 0000000..94782e2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/02_bug_report.yml @@ -0,0 +1,31 @@ +name: 🐞 Bug Report +description: File a bug report +title: "bug: " +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Also tell us, what did you expect to happen? + placeholder: XYZ doesn't work as expected... + value: "A bug happened!" + validations: + required: true + - type: textarea + id : how-to-reproduce + attributes: + label: How can we reproduce it? + description: Please provide steps (commands) that led you to the bug. + placeholder: cookiecutter git@github.com:deepsense-ai/ds-template.git + render: bash + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + render: shell \ No newline at end of file From 838df60e8c9cc1ef7a17184d19b5e00c7a4af21c Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Wed, 24 Jul 2024 15:58:46 +0200 Subject: [PATCH 11/21] versioning fixes --- hooks/post_gen_project.py | 1 + {{ cookiecutter.repo_name }}/.bumpversion.cfg | 4 +- .../.github/workflows/release.yml | 49 +++++++++++++++++++ {{ cookiecutter.repo_name }}/setup.cfg | 2 +- .../{{ cookiecutter.__package_name }}/VERSION | 1 - .../__version__.py | 4 +- 6 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 {{ cookiecutter.repo_name }}/.github/workflows/release.yml delete mode 100644 {{ cookiecutter.repo_name }}/src/{{ cookiecutter.__package_name }}/VERSION diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 25d4dd8..fc537d4 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -28,6 +28,7 @@ SEMANTIC_RELEASE_FILES = [ ".github/workflows/check_future_version.yml", + ".github/workflows/release.yml", ] {% if cookiecutter.ci != "GitLab" %} diff --git a/{{ cookiecutter.repo_name }}/.bumpversion.cfg b/{{ cookiecutter.repo_name }}/.bumpversion.cfg index 2006ad1..a9aa167 100644 --- a/{{ cookiecutter.repo_name }}/.bumpversion.cfg +++ b/{{ cookiecutter.repo_name }}/.bumpversion.cfg @@ -14,4 +14,6 @@ values = dev prod -[bumpversion:file:./src/{{cookiecutter.__package_name}}/VERSION] +[bumpversion:file:./src/{{cookiecutter.__package_name}}/__version__.py] +search = __version__ = '{current_version}' +replace = __version__ = '{new_version}' diff --git a/{{ cookiecutter.repo_name }}/.github/workflows/release.yml b/{{ cookiecutter.repo_name }}/.github/workflows/release.yml new file mode 100644 index 0000000..0161976 --- /dev/null +++ b/{{ cookiecutter.repo_name }}/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Semantic Release + +on: + workflow_dispatch: + inputs: + releaseType: + description: "version update type" + required: true + type: choice + default: "automatic" + options: + - "automatic" + - "major" + - "minor" + - "patch" + +jobs: + release: + runs-on: ubuntu-latest + concurrency: release + permissions: + id-token: write + contents: write + + environment: + name: pypi + url: https://pypi.org/p/dbally + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Python Semantic Release Manual + id: release_manual + if: ${{ github.event.inputs.releaseType != 'automatic' }} + uses: python-semantic-release/python-semantic-release@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + force: ${{ github.event.inputs.releaseType }} + changelog: false + + - name: Python Semantic Release Automatic + id: release_automatic + if: ${{ github.event.inputs.releaseType == 'automatic' }} + uses: python-semantic-release/python-semantic-release@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + changelog: false diff --git a/{{ cookiecutter.repo_name }}/setup.cfg b/{{ cookiecutter.repo_name }}/setup.cfg index a78566e..84b5d3f 100644 --- a/{{ cookiecutter.repo_name }}/setup.cfg +++ b/{{ cookiecutter.repo_name }}/setup.cfg @@ -1,7 +1,7 @@ [metadata] name = {{ cookiecutter.__package_name }} # do not change version by hand: use bump_version.sh -version = file: src/{{ cookiecutter.__package_name }}/VERSION +version = attr: {{ cookiecutter.__package_name }}.__version__.__version__ description = "deepsense.ai project" author = deepsense.ai author_email = contact@deepsense.ai diff --git a/{{ cookiecutter.repo_name }}/src/{{ cookiecutter.__package_name }}/VERSION b/{{ cookiecutter.repo_name }}/src/{{ cookiecutter.__package_name }}/VERSION deleted file mode 100644 index 772a55e..0000000 --- a/{{ cookiecutter.repo_name }}/src/{{ cookiecutter.__package_name }}/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.0.1-dev \ No newline at end of file diff --git a/{{ cookiecutter.repo_name }}/src/{{ cookiecutter.__package_name }}/__version__.py b/{{ cookiecutter.repo_name }}/src/{{ cookiecutter.__package_name }}/__version__.py index 4d271e8..3742a1f 100644 --- a/{{ cookiecutter.repo_name }}/src/{{ cookiecutter.__package_name }}/__version__.py +++ b/{{ cookiecutter.repo_name }}/src/{{ cookiecutter.__package_name }}/__version__.py @@ -1,5 +1,3 @@ """Version information.""" -from pathlib import Path -version_file = Path(__file__).absolute().parents[0] / "VERSION" -__version__ = version_file.read_text(encoding="utf-8").strip() +__version__ = "0.0.1" From e5031acda7b303ca5b0bbb6ffbf2af10373596ea Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Wed, 24 Jul 2024 18:13:51 +0200 Subject: [PATCH 12/21] removed remaninings of PyPI publishing from GitHub CI/CD --- {{ cookiecutter.repo_name }}/.github/workflows/release.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/{{ cookiecutter.repo_name }}/.github/workflows/release.yml b/{{ cookiecutter.repo_name }}/.github/workflows/release.yml index 0161976..74d3682 100644 --- a/{{ cookiecutter.repo_name }}/.github/workflows/release.yml +++ b/{{ cookiecutter.repo_name }}/.github/workflows/release.yml @@ -22,10 +22,6 @@ jobs: id-token: write contents: write - environment: - name: pypi - url: https://pypi.org/p/dbally - steps: - uses: actions/checkout@v3 with: From 938d9602e9d4809719422c521a45ee7d060ec83e Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Wed, 24 Jul 2024 18:15:10 +0200 Subject: [PATCH 13/21] removed package building from pyproject.toml --- {{ cookiecutter.repo_name }}/pyproject.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/{{ cookiecutter.repo_name }}/pyproject.toml b/{{ cookiecutter.repo_name }}/pyproject.toml index a03d007..8dfe4d5 100644 --- a/{{ cookiecutter.repo_name }}/pyproject.toml +++ b/{{ cookiecutter.repo_name }}/pyproject.toml @@ -139,7 +139,7 @@ exclude_dirs = ["venv"] # remember to not use asserts for security and control flows skips = ["B101"] -{%- if cookiecutter.versioning == "Python Semantic Release" %} +{% if cookiecutter.versioning == "Python Semantic Release" %} [tool.semantic_release] assets = [] commit_message = "{version}\n\nAutomatically generated by python-semantic-release" @@ -151,7 +151,6 @@ tag_format = "v{version}" version_variables = [ "src/{{ cookiecutter.__package_name }}/__version__.py:__version__", ] -build_command = "pip install build && python -m build" [tool.semantic_release.branches.main] match = "(main|master)" From 516387b428eadd4ee5f4efaf7644ce9e0389e1e0 Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Wed, 24 Jul 2024 18:17:14 +0200 Subject: [PATCH 14/21] added Semantic Release part + made docs and bumpversion optional --- {{ cookiecutter.repo_name }}/README.md | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/{{ cookiecutter.repo_name }}/README.md b/{{ cookiecutter.repo_name }}/README.md index 2aaa1db..701cd9a 100644 --- a/{{ cookiecutter.repo_name }}/README.md +++ b/{{ cookiecutter.repo_name }}/README.md @@ -49,6 +49,7 @@ Read more about different modes in [documentation](https://ipython.org/ipython-d All code should be in `src/` to make reusability and review straightforward, keep notebooks simple for exploratory data analysis. See also [Cookiecutter Data Science opinion](https://drivendata.github.io/cookiecutter-data-science/#notebooks-are-for-exploration-and-communication). +{%- if cookiecutter.docs != "No docs" %} # Project documentation In `docs/` directory are Sphinx RST/Markdown files. @@ -62,6 +63,7 @@ $ ./build_docs.sh Then open `public/index.html` file. Please read the official [Sphinx documentation](https://www.sphinx-doc.org/en/master/) for more details. +{% endif -%} {% if cookiecutter.ci == "GitLab" %} @@ -104,6 +106,7 @@ Treat them as read-only files and edit only notebooks. {%- endif -%} +{%- if cookiecutter.versioning == "Bumpversion" %} # Semantic version bump To bump version of the library please use `bump2version` which will update all version strings. @@ -118,11 +121,28 @@ $ ./bump_version.sh minor $ ./bump_version.sh major $ ./bump_version.sh patch # to see what is going to change run: -$ ./bump_version.sh --dry-run major +$ ./bump_versemantic-release version --patch --printsion.sh --dry-run major ``` Script updates **VERSION** file and setup.cfg automatically uses that version. You can configure it to update version string in other files as well - please check out the bump2version configuration file. +{% endif -%} + +{%- if cookiecutter.versioning == "Python Semantic Release" %} +If using GitHub, you can manually trigger version check and release in GitHub Actions web GUI. It will also automatically trigger based on your commits. + +You can also trigger it manually using: +```bash +# dry-run to preview changes +$ semantic-release --noop version +# dry-run to preview only the new version +$ semantic-release version --print +# to apply new version and without pushing +$ semantic-release version --no-push +# to apply new version and push +$ semantic-release version +``` +{% endif -%} {% if cookiecutter.ci == "GitLab" %} From 859355233ae25565b3d598a6bdb895b5ded08670 Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Wed, 24 Jul 2024 18:22:51 +0200 Subject: [PATCH 15/21] added validation to ensure it's not possible to build project with GitLab and Python Semantic Release - this functionality is not implemented yet --- hooks/pre_gen_project.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index ddad31f..99de4ce 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -17,4 +17,11 @@ print(f"ERROR: '{package_name}' is not a valid Python module name.") sys.exit(1) +# TODO temporary, until GitLab CI support for Semantic Release will be added +ci_type = '{{ cookiecutter.ci }}' +versioning_approach = '{{ cookiecutter.versioning }}' +if ci_type == 'GitLab' and versioning_approach == "Python Semantic Release": + print(f"ERROR: 'Python Semantic Release' is currently not supported for projects with GitLab CI.") + sys.exit(1) + print("Template looks ok.") \ No newline at end of file From aa5030bd4298d940b1caca61a5818ba638f6829d Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Wed, 24 Jul 2024 18:24:42 +0200 Subject: [PATCH 16/21] added TODO to make installing bump2version optional in Gitlab CI --- {{ cookiecutter.repo_name }}/.gitlab-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/{{ cookiecutter.repo_name }}/.gitlab-ci.yml b/{{ cookiecutter.repo_name }}/.gitlab-ci.yml index c490874..9b473d4 100644 --- a/{{ cookiecutter.repo_name }}/.gitlab-ci.yml +++ b/{{ cookiecutter.repo_name }}/.gitlab-ci.yml @@ -138,6 +138,7 @@ lint-precommit-changed: ########################################### # Job to run pytest with code coverage + license check +# TODO make installing bump2version below conditional on cookiecutter parameter choice tests: image: $PYTHON_DOCKER_IMAGE stage: tests From 7def7e6e8020643d07094d81559b1d587ace6074 Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Thu, 25 Jul 2024 16:10:46 +0200 Subject: [PATCH 17/21] implemented code review suggestions regarding cookiecutter.json config --- cookiecutter.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index ab99733..7a09679 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -4,11 +4,11 @@ "__project_name_slug": "{{cookiecutter.project_name | slugify}}", "__client_name_slug": "{{cookiecutter.client_name | slugify}}", "repo_name": "{{cookiecutter.__client_name_slug}}-{{cookiecutter.__project_name_slug}}", - "ci": ["GitLab", "Github", "None"], + "ci": ["Github", "GitLab", "None"], "jupytext": ["No", "Yes"], "docs": ["Sphinx", "No docs"], - "versioning": ["Bumpversion", "Python Semantic Release", "None"], + "versioning": ["Python Semantic Release", "Bumpversion", "None"], "python_package_name": "{{ cookiecutter.__project_name_slug.replace('-', '_') }}", "__package_name": "{{ cookiecutter.python_package_name }}", - "_copy_without_render": [".github/workflows/*.yml"] + "_copy_without_render": [".github/workflows/*.yml", ".github/workflows/*.yaml"] } From 21ffd22e0ffb5e838a72b56c781b283fc9e5d432 Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Mon, 29 Jul 2024 10:55:08 +0200 Subject: [PATCH 18/21] code review fixes: made GitLab CI docs generation conditional using Gitlab CI stage rules rather than using Jinja to paste or not the entire .yml part --- {{ cookiecutter.repo_name }}/.gitlab-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/{{ cookiecutter.repo_name }}/.gitlab-ci.yml b/{{ cookiecutter.repo_name }}/.gitlab-ci.yml index 9b473d4..49fa4d5 100644 --- a/{{ cookiecutter.repo_name }}/.gitlab-ci.yml +++ b/{{ cookiecutter.repo_name }}/.gitlab-ci.yml @@ -235,7 +235,6 @@ tests: rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH -{% if cookiecutter.docs != "No docs" %} ############################################## # Job to build Sphinx docs and host it on GitLab Pages @@ -251,5 +250,5 @@ pages: paths: - public rules: + - if: {{ cookiecutter.docs }} != "No docs" - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH -{% endif %} From 00f362a23ab103d56e86c51515b734b0d5de70b9 Mon Sep 17 00:00:00 2001 From: Jakub Cierocki Date: Mon, 29 Jul 2024 18:09:50 +0200 Subject: [PATCH 19/21] code review fixes - removed Python Semantic Release (it will be provided in another PR) --- cookiecutter.json | 2 +- hooks/post_gen_project.py | 9 --- hooks/pre_gen_project.py | 7 -- .../workflows/check_future_version.yml | 22 ------ .../.github/workflows/release.yml | 45 ------------ {{ cookiecutter.repo_name }}/pyproject.toml | 71 ------------------- 6 files changed, 1 insertion(+), 155 deletions(-) delete mode 100644 {{ cookiecutter.repo_name }}/.github/workflows/check_future_version.yml delete mode 100644 {{ cookiecutter.repo_name }}/.github/workflows/release.yml diff --git a/cookiecutter.json b/cookiecutter.json index 7a09679..f47efea 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -7,7 +7,7 @@ "ci": ["Github", "GitLab", "None"], "jupytext": ["No", "Yes"], "docs": ["Sphinx", "No docs"], - "versioning": ["Python Semantic Release", "Bumpversion", "None"], + "versioning": ["Bumpversion", "None"], "python_package_name": "{{ cookiecutter.__project_name_slug.replace('-', '_') }}", "__package_name": "{{ cookiecutter.python_package_name }}", "_copy_without_render": [".github/workflows/*.yml", ".github/workflows/*.yaml"] diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index fc537d4..a806a90 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -26,11 +26,6 @@ "bump_version.sh" ] -SEMANTIC_RELEASE_FILES = [ - ".github/workflows/check_future_version.yml", - ".github/workflows/release.yml", -] - {% if cookiecutter.ci != "GitLab" %} files_to_be_removed.extend(GITLAB_FILES) {% endif %} @@ -51,10 +46,6 @@ files_to_be_removed.extend(BUMPVERSION_FILES) {% endif %} -{% if cookiecutter.versioning != "Python Semantic Release" %} -files_to_be_removed.extend(SEMANTIC_RELEASE_FILES) -{% endif %} - print("Cleaning files... 🌀") for path in files_to_be_removed: path = Path(path) diff --git a/hooks/pre_gen_project.py b/hooks/pre_gen_project.py index 99de4ce..ddad31f 100644 --- a/hooks/pre_gen_project.py +++ b/hooks/pre_gen_project.py @@ -17,11 +17,4 @@ print(f"ERROR: '{package_name}' is not a valid Python module name.") sys.exit(1) -# TODO temporary, until GitLab CI support for Semantic Release will be added -ci_type = '{{ cookiecutter.ci }}' -versioning_approach = '{{ cookiecutter.versioning }}' -if ci_type == 'GitLab' and versioning_approach == "Python Semantic Release": - print(f"ERROR: 'Python Semantic Release' is currently not supported for projects with GitLab CI.") - sys.exit(1) - print("Template looks ok.") \ No newline at end of file diff --git a/{{ cookiecutter.repo_name }}/.github/workflows/check_future_version.yml b/{{ cookiecutter.repo_name }}/.github/workflows/check_future_version.yml deleted file mode 100644 index 2bd2df2..0000000 --- a/{{ cookiecutter.repo_name }}/.github/workflows/check_future_version.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Check New Version - -on: workflow_dispatch - -jobs: - release: - runs-on: ubuntu-latest - concurrency: release - permissions: - id-token: write - contents: write - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Python Semantic Release - uses: python-semantic-release/python-semantic-release@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - root_options: "-v --noop" \ No newline at end of file diff --git a/{{ cookiecutter.repo_name }}/.github/workflows/release.yml b/{{ cookiecutter.repo_name }}/.github/workflows/release.yml deleted file mode 100644 index 74d3682..0000000 --- a/{{ cookiecutter.repo_name }}/.github/workflows/release.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Semantic Release - -on: - workflow_dispatch: - inputs: - releaseType: - description: "version update type" - required: true - type: choice - default: "automatic" - options: - - "automatic" - - "major" - - "minor" - - "patch" - -jobs: - release: - runs-on: ubuntu-latest - concurrency: release - permissions: - id-token: write - contents: write - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Python Semantic Release Manual - id: release_manual - if: ${{ github.event.inputs.releaseType != 'automatic' }} - uses: python-semantic-release/python-semantic-release@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - force: ${{ github.event.inputs.releaseType }} - changelog: false - - - name: Python Semantic Release Automatic - id: release_automatic - if: ${{ github.event.inputs.releaseType == 'automatic' }} - uses: python-semantic-release/python-semantic-release@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - changelog: false diff --git a/{{ cookiecutter.repo_name }}/pyproject.toml b/{{ cookiecutter.repo_name }}/pyproject.toml index 8dfe4d5..bff0d5f 100644 --- a/{{ cookiecutter.repo_name }}/pyproject.toml +++ b/{{ cookiecutter.repo_name }}/pyproject.toml @@ -138,74 +138,3 @@ exclude_dirs = ["venv"] # B101 disables errors for asserts in the code # remember to not use asserts for security and control flows skips = ["B101"] - -{% if cookiecutter.versioning == "Python Semantic Release" %} -[tool.semantic_release] -assets = [] -commit_message = "{version}\n\nAutomatically generated by python-semantic-release" -commit_parser = "angular" -logging_use_named_masks = false -major_on_zero = false -allow_zero_version = true -tag_format = "v{version}" -version_variables = [ - "src/{{ cookiecutter.__package_name }}/__version__.py:__version__", -] - -[tool.semantic_release.branches.main] -match = "(main|master)" -prerelease_token = "rc" -prerelease = false - -[tool.semantic_release.changelog] -template_dir = "templates" -changelog_file = "CHANGELOG.md" -exclude_commit_patterns = [] - -{%- raw %} -[tool.semantic_release.changelog.environment] -block_start_string = "{%" -block_end_string = "%}" -variable_start_string = "{{" -variable_end_string = "}}" -comment_start_string = "{#" -comment_end_string = "#}" -trim_blocks = false -lstrip_blocks = false -newline_sequence = "\n" -keep_trailing_newline = false -extensions = [] -autoescape = true -{% endraw -%} - -[tool.semantic_release.commit_author] -env = "GIT_COMMIT_AUTHOR" -default = "semantic-release " - -[tool.semantic_release.commit_parser_options] -allowed_tags = [ - "build", - "chore", - "ci", - "docs", - "feat", - "fix", - "perf", - "style", - "refactor", - "test", -] -minor_tags = ["feat"] -patch_tags = ["fix", "perf"] -default_bump_level = 0 - -[tool.semantic_release.remote] -name = "origin" -type = "github" -ignore_token_for_push = false -insecure = false - -[tool.semantic_release.publish] -dist_glob_patterns = ["dist/*"] -upload_to_vcs_release = true -{% endif -%} From a32665152d202435f084179b8363a07e8e31f4f4 Mon Sep 17 00:00:00 2001 From: Sahcim Date: Tue, 30 Jul 2024 12:49:17 +0200 Subject: [PATCH 20/21] Remove Python Semantic Versioning from readme --- {{ cookiecutter.repo_name }}/README.md | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/{{ cookiecutter.repo_name }}/README.md b/{{ cookiecutter.repo_name }}/README.md index 701cd9a..21a0945 100644 --- a/{{ cookiecutter.repo_name }}/README.md +++ b/{{ cookiecutter.repo_name }}/README.md @@ -121,29 +121,13 @@ $ ./bump_version.sh minor $ ./bump_version.sh major $ ./bump_version.sh patch # to see what is going to change run: -$ ./bump_versemantic-release version --patch --printsion.sh --dry-run major +$ ./bump_version.sh --dry-run major ``` Script updates **VERSION** file and setup.cfg automatically uses that version. You can configure it to update version string in other files as well - please check out the bump2version configuration file. {% endif -%} -{%- if cookiecutter.versioning == "Python Semantic Release" %} -If using GitHub, you can manually trigger version check and release in GitHub Actions web GUI. It will also automatically trigger based on your commits. - -You can also trigger it manually using: -```bash -# dry-run to preview changes -$ semantic-release --noop version -# dry-run to preview only the new version -$ semantic-release version --print -# to apply new version and without pushing -$ semantic-release version --no-push -# to apply new version and push -$ semantic-release version -``` -{% endif -%} - {% if cookiecutter.ci == "GitLab" %} On GitLab CI, you can build development, test package and upload it manually as minor.major.patch-dev{BUILD_NUMBER} to PIP registry. From b91a046a97e21d9cc5eed4c07b244176f244d7a1 Mon Sep 17 00:00:00 2001 From: Sahcim Date: Wed, 31 Jul 2024 10:57:11 +0200 Subject: [PATCH 21/21] Remove build docs step in gitlab ci when is set to True --- {{ cookiecutter.repo_name }}/.gitlab-ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/{{ cookiecutter.repo_name }}/.gitlab-ci.yml b/{{ cookiecutter.repo_name }}/.gitlab-ci.yml index 49fa4d5..a4eacf8 100644 --- a/{{ cookiecutter.repo_name }}/.gitlab-ci.yml +++ b/{{ cookiecutter.repo_name }}/.gitlab-ci.yml @@ -235,6 +235,8 @@ tests: rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + +{%- if cookiecutter.docs != "No docs" %} ############################################## # Job to build Sphinx docs and host it on GitLab Pages @@ -250,5 +252,6 @@ pages: paths: - public rules: - - if: {{ cookiecutter.docs }} != "No docs" - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + +{% endif -%} \ No newline at end of file