click-docs 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. click_docs-0.2.0/.changelog-config.yaml +133 -0
  2. click_docs-0.2.0/.claude/agents/docstring-reviewer.md +24 -0
  3. click_docs-0.2.0/.claude/settings.json +26 -0
  4. click_docs-0.2.0/.claude/settings.local.json +27 -0
  5. click_docs-0.2.0/.claude/skills/release/SKILL.md +16 -0
  6. click_docs-0.2.0/.editorconfig +23 -0
  7. click_docs-0.2.0/.github/ISSUE_TEMPLATE/bug_report.yaml +33 -0
  8. click_docs-0.2.0/.github/ISSUE_TEMPLATE/feature_request.yaml +26 -0
  9. click_docs-0.2.0/.github/changelog_templates/commit.md.jinja +9 -0
  10. click_docs-0.2.0/.github/changelog_templates/version_heading.md.jinja +4 -0
  11. click_docs-0.2.0/.github/dependabot.yml +17 -0
  12. click_docs-0.2.0/.github/workflows/build-python.yaml +72 -0
  13. click_docs-0.2.0/.github/workflows/bump-version-preview.yaml +77 -0
  14. click_docs-0.2.0/.github/workflows/bump-version.yaml +77 -0
  15. click_docs-0.2.0/.github/workflows/codeql-analysis.yml +72 -0
  16. click_docs-0.2.0/.github/workflows/publish-docs-preview.yaml +50 -0
  17. click_docs-0.2.0/.github/workflows/publish-docs.yaml +51 -0
  18. click_docs-0.2.0/.github/workflows/release-container.yaml +81 -0
  19. click_docs-0.2.0/.github/workflows/release-github.yaml +43 -0
  20. click_docs-0.2.0/.github/workflows/test.yaml +34 -0
  21. click_docs-0.2.0/.gitignore +170 -0
  22. click_docs-0.2.0/.mcp.json +13 -0
  23. click_docs-0.2.0/.pre-commit-config.yaml +71 -0
  24. click_docs-0.2.0/CHANGELOG.md +122 -0
  25. click_docs-0.2.0/CLAUDE.md +76 -0
  26. click_docs-0.2.0/CODE_OF_CONDUCT.md +132 -0
  27. click_docs-0.2.0/CONTRIBUTING.md +150 -0
  28. click_docs-0.2.0/LICENSE +13 -0
  29. click_docs-0.2.0/PKG-INFO +140 -0
  30. click_docs-0.2.0/README.md +95 -0
  31. click_docs-0.2.0/click_docs/__init__.py +3 -0
  32. click_docs-0.2.0/click_docs/cli.py +190 -0
  33. click_docs-0.2.0/click_docs/config.py +56 -0
  34. click_docs-0.2.0/click_docs/generator.py +368 -0
  35. click_docs-0.2.0/click_docs/loader.py +83 -0
  36. click_docs-0.2.0/docs/assets/css/cards.css +200 -0
  37. click_docs-0.2.0/docs/assets/css/extra.css +54 -0
  38. click_docs-0.2.0/docs/assets/css/field-list.css +34 -0
  39. click_docs-0.2.0/docs/assets/css/mkdocstrings.css +39 -0
  40. click_docs-0.2.0/docs/assets/images/.gitkeep +0 -0
  41. click_docs-0.2.0/docs/development.md +58 -0
  42. click_docs-0.2.0/docs/index.md +53 -0
  43. click_docs-0.2.0/docs/reference/api/cli.md +1 -0
  44. click_docs-0.2.0/docs/reference/api/config.md +1 -0
  45. click_docs-0.2.0/docs/reference/api/generator.md +1 -0
  46. click_docs-0.2.0/docs/reference/api/index.md +4 -0
  47. click_docs-0.2.0/docs/reference/api/loader.md +1 -0
  48. click_docs-0.2.0/docs/reference/cli-reference.md +27 -0
  49. click_docs-0.2.0/docs/tutorials/first-cli-documentation.md +268 -0
  50. click_docs-0.2.0/docs/tutorials/index.md +21 -0
  51. click_docs-0.2.0/docs/tutorials/real-world-cli.md +588 -0
  52. click_docs-0.2.0/overrides/mkdocstrings/python/material/docstring/attributes.html +90 -0
  53. click_docs-0.2.0/overrides/mkdocstrings/python/material/docstring/parameters.html +98 -0
  54. click_docs-0.2.0/overrides/mkdocstrings/python/material/docstring/raises.html +72 -0
  55. click_docs-0.2.0/overrides/mkdocstrings/python/material/docstring/returns.html +94 -0
  56. click_docs-0.2.0/overrides/partials/comments.html +37 -0
  57. click_docs-0.2.0/plans/click-docs-v1-phase-1.md +36 -0
  58. click_docs-0.2.0/plans/click-docs-v1-phase-2.md +35 -0
  59. click_docs-0.2.0/plans/click-docs-v1-phase-3.md +37 -0
  60. click_docs-0.2.0/plans/click-docs-v1-phase-4.md +32 -0
  61. click_docs-0.2.0/plans/prd.md +137 -0
  62. click_docs-0.2.0/pyproject.toml +301 -0
  63. click_docs-0.2.0/tests/__init__.py +1 -0
  64. click_docs-0.2.0/tests/app/__init__.py +1 -0
  65. click_docs-0.2.0/tests/app/cli.py +86 -0
  66. click_docs-0.2.0/tests/app/expected_admin_show_hidden.md +65 -0
  67. click_docs-0.2.0/tests/app/expected_ascii_art_removed.md +15 -0
  68. click_docs-0.2.0/tests/app/expected_cli.md +33 -0
  69. click_docs-0.2.0/tests/app/expected_hello.md +17 -0
  70. click_docs-0.2.0/tests/app/expected_root_depth_0.md +15 -0
  71. click_docs-0.2.0/tests/app/expected_root_depth_1.md +48 -0
  72. click_docs-0.2.0/tests/app/expected_root_exclude_admin.md +32 -0
  73. click_docs-0.2.0/tests/app/expected_root_list_subcommands.md +86 -0
  74. click_docs-0.2.0/tests/app/expected_root_recursive.md +81 -0
  75. click_docs-0.2.0/tests/app/expected_special_types_plain.md +21 -0
  76. click_docs-0.2.0/tests/app/expected_special_types_table.md +20 -0
  77. click_docs-0.2.0/tests/app/relative_pkg/__init__.py +1 -0
  78. click_docs-0.2.0/tests/app/relative_pkg/cli.py +11 -0
  79. click_docs-0.2.0/tests/app/relative_pkg/helpers.py +3 -0
  80. click_docs-0.2.0/tests/test_cli.py +279 -0
  81. click_docs-0.2.0/tests/test_config.py +47 -0
  82. click_docs-0.2.0/tests/test_generator.py +410 -0
  83. click_docs-0.2.0/tests/test_loader.py +62 -0
  84. click_docs-0.2.0/tools/create-release.sh +28 -0
  85. click_docs-0.2.0/tools/gen_cli_docs.sh +3 -0
  86. click_docs-0.2.0/tools/gen_doc_stubs.py +29 -0
  87. click_docs-0.2.0/uv.lock +1401 -0
  88. click_docs-0.2.0/zensical.toml +353 -0
@@ -0,0 +1,133 @@
1
+ # For more configuration information, please see https://coordt.github.io/generate-changelog/
2
+
3
+ # User variables for reference in other parts of the configuration.
4
+ variables:
5
+ repo_url: https://github.com/callowayproject/click-docs
6
+ changelog_filename: CHANGELOG.md
7
+
8
+ # Pipeline to find the most recent tag for incremental changelog generation.
9
+ # Leave empty to always start at first commit.
10
+ starting_tag_pipeline:
11
+ - action: ReadFile
12
+ kwargs:
13
+ filename: "{{ changelog_filename }}"
14
+ - action: FirstRegExMatch
15
+ kwargs:
16
+ pattern: (?im)^## (?P<rev>\d+\.\d+(?:\.\d+)?)\s+\(\d+-\d{2}-\d{2}\)$
17
+ named_subgroup: rev
18
+
19
+ # Used as the version title of the changes since the last valid tag.
20
+ unreleased_label: Unreleased
21
+
22
+ # Process the commit's first line for use in the changelog.
23
+ summary_pipeline:
24
+ - action: strip_spaces
25
+ - action: Strip
26
+ comment: Get rid of any periods so we don't get double periods
27
+ kwargs:
28
+ chars: .
29
+ - action: SetDefault
30
+ args:
31
+ - no commit message
32
+ - action: capitalize
33
+ - action: append_dot
34
+
35
+ # Process the commit's body for use in the changelog.
36
+ body_pipeline:
37
+ - action: ParseTrailers
38
+ comment: Parse the trailers into metadata.
39
+ kwargs:
40
+ commit_metadata: save_commit_metadata
41
+
42
+ # Process and store the full or partial changelog.
43
+ output_pipeline:
44
+ - action: IncrementalFileInsert
45
+ kwargs:
46
+ filename: "{{ changelog_filename }}"
47
+ last_heading_pattern: (?im)^## \d+\.\d+(?:\.\d+)?\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)$
48
+ - action: MDFormat
49
+ kwargs:
50
+ filename: CHANGELOG.md
51
+
52
+ # Full or relative paths to look for output generation templates.
53
+ template_dirs:
54
+ - ".github/changelog_templates/"
55
+
56
+ # Group the commits within a version by these commit attributes.
57
+ group_by:
58
+ - metadata.category
59
+
60
+ # Only tags matching this regular expression are used for the changelog.
61
+ tag_pattern: ^[0-9]+\.[0-9]+(?:\.[0-9]+)?$
62
+
63
+ # Tells ``git-log`` whether to include merge commits in the log.
64
+ include_merges: false
65
+
66
+ # Ignore commits whose summary line matches any of these regular expression patterns.
67
+ ignore_patterns:
68
+ - '[@!]minor'
69
+ - '[@!]cosmetic'
70
+ - '[@!]refactor'
71
+ - '[@!]wip'
72
+ - ^$
73
+ - ^Merge branch
74
+ - ^Merge pull
75
+ - ^Version updated
76
+
77
+ # Set the commit's category metadata to the first classifier that returns ``True``.
78
+ commit_classifiers:
79
+ - action: SummaryRegexMatch
80
+ category: New
81
+ kwargs:
82
+ pattern: (?i)^(?:new|add)[^\n]*$
83
+ - action: SummaryRegexMatch
84
+ category: Updates
85
+ kwargs:
86
+ pattern: (?i)^(?:update|change|rename|remove|delete|improve|refactor|chg|modif)[^\n]*$
87
+ - action: SummaryRegexMatch
88
+ category: Fixes
89
+ kwargs:
90
+ pattern: (?i)^(?:fix)[^\n]*$
91
+ - action:
92
+ category: Other
93
+
94
+ # Tokens in git commit trailers that indicate authorship.
95
+ valid_author_tokens:
96
+ - author
97
+ - based-on-a-patch-by
98
+ - based-on-patch-by
99
+ - co-authored-by
100
+ - co-committed-by
101
+ - contributions-by
102
+ - from
103
+ - helped-by
104
+ - improved-by
105
+ - original-patch-by
106
+
107
+ # Rules applied to commits to determine the type of release to suggest.
108
+ release_hint_rules:
109
+ - match_result: dev
110
+ branch: ^((?!master|main).)*$
111
+ - match_result: patch
112
+ path: pyproject.toml
113
+ branch: master|main
114
+ - match_result: patch
115
+ grouping: Other
116
+ path: click_docs/*
117
+ branch: master|main
118
+ - match_result: patch
119
+ grouping: Fixes
120
+ path: click_docs/*
121
+ branch: master|main
122
+ - match_result: minor
123
+ grouping: Updates
124
+ path: click_docs/*
125
+ branch: master|main
126
+ - match_result: minor
127
+ grouping: New
128
+ path: click_docs/*
129
+ branch: master|main
130
+ - match_result: major
131
+ grouping: Breaking Changes
132
+ path: click_docs/*
133
+ branch: master|main
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: docstring-reviewer
3
+ description: Review Python files for docstring quality, Google-style compliance, and interrogate coverage
4
+ ---
5
+
6
+ You are a Python docstring specialist for the click-docs project, which enforces:
7
+ - Google-style docstrings (pydoclint)
8
+ - 90% docstring coverage (interrogate)
9
+ - Type annotation consistency (ruff ANN rules)
10
+
11
+ When given Python files to review:
12
+
13
+ 1. Check every public function, class, and method has a Google-style docstring with appropriate sections (Args, Returns, Raises)
14
+ 2. Flag any missing docstrings that would cause interrogate coverage to fall below 90%
15
+ 3. Verify arg descriptions match the function signature (pydoclint compliance)
16
+ 4. Check that Returns section is present when the function returns a non-None value
17
+ 5. Check that Raises section is present for any explicitly raised exceptions
18
+
19
+ Output a structured list of violations with:
20
+ - File path and line number
21
+ - Violation type (missing docstring / missing Args / missing Returns / missing Raises / style error)
22
+ - Suggested fix (provide the corrected docstring)
23
+
24
+ Focus only on docstring issues. Do not report other code quality issues.
@@ -0,0 +1,26 @@
1
+ {
2
+ "hooks": {
3
+ "PostToolUse": [
4
+ {
5
+ "matcher": "Edit|Write",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "file=\"$CLAUDE_TOOL_INPUT_FILE_PATH\"; if echo \"$file\" | grep -q '\\.py$'; then uv run ruff format \"$file\" 2>/dev/null; uv run ruff check --fix \"$file\" 2>/dev/null; true; fi"
10
+ }
11
+ ]
12
+ }
13
+ ],
14
+ "PreToolUse": [
15
+ {
16
+ "matcher": "Edit|Write",
17
+ "hooks": [
18
+ {
19
+ "type": "command",
20
+ "command": "if echo \"$CLAUDE_TOOL_INPUT_FILE_PATH\" | grep -q 'uv\\.lock'; then echo 'Blocked: uv.lock must not be edited directly. Use uv add/remove instead.' >&2; exit 2; fi"
21
+ }
22
+ ]
23
+ }
24
+ ]
25
+ }
26
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(git config:*)",
5
+ "Bash(wc:*)",
6
+ "Bash(grep -r \"TODO\\\\|FIXME\\\\|XXX\\\\|HACK\\\\|BUG\" /Users/coordt/code/click-docs --include=*.py --include=*.md)",
7
+ "Bash(gh repo:*)",
8
+ "Bash(git:*)",
9
+ "Bash(uv run:*)",
10
+ "Bash(claude mcp:*)",
11
+ "Bash(.venv/bin/python -m pytest tests/test_generator.py::TestHeaderDepth tests/test_generator.py::TestStyleTable tests/test_cli.py::TestCliFormattingOptions -x --no-header -q)",
12
+ "Bash(.venv/bin/python -m pytest tests/test_generator.py::TestHeaderDepth tests/test_generator.py::TestStyleTable tests/test_cli.py::TestCliFormattingOptions --no-header -q)",
13
+ "Bash(.venv/bin/python -c \"\nimport sys; sys.path.insert\\(0, '.'\\)\nfrom tests.test_generator import special_types_cmd\nfrom click_docs.generator import generate_docs\n\ntable = generate_docs\\(special_types_cmd, program_name='special-types', style='table'\\)\nplain = generate_docs\\(special_types_cmd, program_name='special-types', style='plain'\\)\nprint\\('=== TABLE ==='\\)\nprint\\(repr\\(table\\)\\)\nprint\\('=== PLAIN ==='\\)\nprint\\(repr\\(plain\\)\\)\n\")",
14
+ "Bash(.venv/bin/python -m pytest tests/ --no-header -q)",
15
+ "Bash(find /Users/coordt/code/click-docs -type d -not -path */.* -not -path */__pycache__* -not -path *.egg-info*)",
16
+ "Bash(python -m pytest tests/test_generator.py::TestGenerateDocs tests/test_generator.py::TestHeaderDepth tests/test_generator.py::TestStyleTable tests/test_cli.py -x -q)",
17
+ "Bash(xxd tests/app/expected_special_types_table.md)",
18
+ "Bash(xxd tests/app/expected_special_types_plain.md)",
19
+ "Bash(xxd tests/app/expected_hello.md)",
20
+ "Bash(xxd tests/app/expected_cli.md)",
21
+ "Bash(python3:*)"
22
+ ]
23
+ },
24
+ "disabledMcpjsonServers": [
25
+ "github"
26
+ ]
27
+ }
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: release
3
+ description: Cut a release by bumping version, generating changelog, committing, and tagging
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ Run the release process for click-docs:
8
+
9
+ 1. Ask the user what version bump type they want: `patch`, `minor`, or `major` (if not provided as args)
10
+ 2. Run `uv run bump-my-version bump {{args}}` to bump the version
11
+ 3. Run `uv run generate-changelog` to update CHANGELOG.md
12
+ 4. Show the user the resulting diff with `git diff`
13
+ 5. Ask the user to confirm before proceeding
14
+ 6. Stage and commit: `git add CHANGELOG.md click_docs/__init__.py && git commit -m "Version updated from ... to ..."`
15
+ 7. Push with tags: `git push && git push --tags`
16
+ 8. Remind the user the GitHub Actions release workflow will now trigger
@@ -0,0 +1,23 @@
1
+ # http://editorconfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ charset = utf-8
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.{py,rst,ini}]
12
+ indent_style = space
13
+ indent_size = 4
14
+
15
+ [*.{html,css,scss,json,yml}]
16
+ indent_style = space
17
+ indent_size = 2
18
+
19
+ [*.md]
20
+ trim_trailing_whitespace = true
21
+
22
+ [Makefile]
23
+ indent_style = tab
@@ -0,0 +1,33 @@
1
+ name: Bug Report
2
+ description: File a bug report.
3
+ title: "[Bug]: "
4
+ labels: ["bug"]
5
+ body:
6
+ - type: markdown
7
+ attributes:
8
+ value: |
9
+ Thanks for taking the time to fill out this bug report!
10
+ - type: textarea
11
+ id: what-happened
12
+ attributes:
13
+ label: What happened?
14
+ description: What did you do, what happened, and what did you expect?
15
+ placeholder: Tell us what you see!
16
+ validations:
17
+ required: true
18
+ - type: input
19
+ id: version
20
+ attributes:
21
+ label: Version
22
+ description: What version of our software are you running?
23
+ validations:
24
+ required: true
25
+ - type: dropdown
26
+ id: os
27
+ attributes:
28
+ label: Operating system
29
+ description: What operating system are you using?
30
+ options:
31
+ - Linux
32
+ - MacOS
33
+ - Windows
@@ -0,0 +1,26 @@
1
+ name: Feature Request
2
+ description: Suggest an idea for this project
3
+ labels: ["enhancement"]
4
+ body:
5
+ - type: textarea
6
+ id: problem
7
+ attributes:
8
+ label: Is your feature request related to a problem? Please describe.
9
+ description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
10
+ - type: textarea
11
+ id: request
12
+ attributes:
13
+ label: Describe the solution you'd like.
14
+ description: A clear and concise description of what you want to happen.
15
+ validations:
16
+ required: true
17
+ - type: textarea
18
+ id: considered-alternatives
19
+ attributes:
20
+ label: Describe alternatives you've considered
21
+ description: A clear and concise description of any alternative solutions or features you've considered.
22
+ - type: textarea
23
+ id: additional-context
24
+ attributes:
25
+ label: Additional context
26
+ description: Add any other context or screenshots about the feature request here.
@@ -0,0 +1,9 @@
1
+ - {{ commit.summary }} [{{ commit.short_sha }}]({{ repo_url }}/commit/{{ commit.sha }})
2
+ {{ commit.body|indent(2, first=True) }}
3
+ {% for key, val in commit.metadata["trailers"].items() %}
4
+ {% if key not in VALID_AUTHOR_TOKENS %}
5
+ **{{ key }}:** {{ val|join(", ") }}
6
+
7
+ {% endif %}
8
+
9
+ {% endfor %}
@@ -0,0 +1,4 @@
1
+ ## {{ version.label }} ({{ version.date_time.strftime("%Y-%m-%d") }})
2
+ {% if version.previous_tag %}
3
+ [Compare the full difference.]({{ repo_url }}/compare/{{ version.previous_tag }}...{{ version.tag }})
4
+ {% endif %}
@@ -0,0 +1,17 @@
1
+ # Keep GitHub Actions up to date with GitHub's Dependabot...
2
+ # https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
3
+ # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#package-ecosystem
4
+ version: 2
5
+ updates:
6
+ - package-ecosystem: github-actions
7
+ directory: /
8
+ groups:
9
+ github-actions:
10
+ patterns:
11
+ - "*" # Group all Actions updates into a single larger pull request
12
+ schedule:
13
+ interval: weekly
14
+ - package-ecosystem: "pip"
15
+ directory: "/"
16
+ schedule:
17
+ interval: "weekly"
@@ -0,0 +1,72 @@
1
+ name: Build Python Package
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ ref:
7
+ description: The branch, tag or SHA to checkout. Otherwise, uses the default branch.
8
+ required: false
9
+ type: string
10
+ default: ""
11
+ workflow_dispatch:
12
+ inputs:
13
+ ref:
14
+ description: The branch, tag or SHA to checkout. Otherwise, uses the default branch.
15
+ required: false
16
+ type: string
17
+ default: ""
18
+
19
+ jobs:
20
+ build-package:
21
+ runs-on: ubuntu-latest
22
+ permissions:
23
+ contents: read
24
+ id-token: write
25
+ attestations: write
26
+ steps:
27
+ - name: Checkout
28
+ uses: actions/checkout@v6
29
+ with:
30
+ fetch-depth: 0
31
+ ref: ${{ inputs.ref }}
32
+ - name: Package
33
+ uses: hynek/build-and-inspect-python-package@v2
34
+
35
+ call-release-github:
36
+ needs: build-package
37
+ permissions:
38
+ contents: write
39
+ packages: write
40
+ id-token: write
41
+ uses: ./.github/workflows/release-github.yaml
42
+ with:
43
+ ref: ${{ inputs.ref }}
44
+
45
+ # call-release-container:
46
+ # needs: build-package
47
+ # permissions:
48
+ # contents: write
49
+ # packages: write
50
+ # id-token: write
51
+ # uses: ./.github/workflows/release-container.yaml
52
+ # with:
53
+ # ref: ${{ inputs.ref }}
54
+
55
+
56
+ release-pypi:
57
+ needs: build-package
58
+ permissions:
59
+ contents: read
60
+ id-token: write
61
+ name: Publish released package to pypi.org
62
+ runs-on: ubuntu-latest
63
+ steps:
64
+ - name: Download packages built by build-and-inspect-python-package
65
+ uses: actions/download-artifact@v8
66
+ with:
67
+ name: Packages
68
+ path: dist
69
+
70
+ - name: Upload package to PyPI
71
+ uses: pypa/gh-action-pypi-publish@release/v1
72
+
@@ -0,0 +1,77 @@
1
+ name: Display version hint
2
+
3
+ on:
4
+ pull_request:
5
+ types: [synchronize, opened, reopened, ready_for_review]
6
+ branches: [master, main]
7
+
8
+ permissions:
9
+ contents: read
10
+ pull-requests: write
11
+ id-token: write
12
+
13
+ concurrency: version-preview-${{ github.ref }}
14
+
15
+ jobs:
16
+ preview-version:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: Checkout the repository
20
+ uses: actions/checkout@v6
21
+ with:
22
+ fetch-depth: 0
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v6
26
+ with:
27
+ python-version: "3.12"
28
+
29
+ - name: Setup Git
30
+ uses: fregante/setup-git-user@v2
31
+ env:
32
+ GH_TOKEN: ${{ github.token }}
33
+
34
+ - name: Install requirements
35
+ run: |
36
+ python -m pip install bump-my-version
37
+
38
+ - name: Get the release hint
39
+ id: changelog
40
+ uses: docker://ghcr.io/callowayproject/generate-changelog:v0
41
+ with:
42
+ branch_override: ${{ github.event.pull_request.base.ref }}
43
+
44
+ - name: Get Metadata
45
+ id: get-metadata
46
+ run: |
47
+ PR_NUMBER=$(gh pr view --json number -q .number || echo "${{ github.event.number }}")
48
+ REVISION=$(git describe --tags --long | awk -F- '{print $2}')
49
+ echo "RELEASE_KIND=${{ steps.changelog.outputs.release_hint }}" >> $GITHUB_ENV
50
+ echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
51
+ echo "REVISION=$REVISION" >> $GITHUB_ENV
52
+
53
+ - name: Bump version dry run
54
+ if: ${{ env.RELEASE_KIND != 'no-release' }}
55
+ shell: bash
56
+ run: |
57
+ # This will display a full log of what would happen if we were to bump the version.
58
+ bump-my-version bump --dry-run --verbose "$RELEASE_KIND"
59
+
60
+ # This retrieves the current and new version numbers as a JSON-formatted string.
61
+ VERSION_INFO=$(bump-my-version show --format json --increment "$RELEASE_KIND" current_version new_version)
62
+ echo "CURRENT_VERSION=$(echo $VERSION_INFO | jq -r .current_version)" >> $GITHUB_ENV
63
+ echo "NEW_VERSION=$(echo $VERSION_INFO | jq -r .new_version)" >> $GITHUB_ENV
64
+
65
+ - name: Set no-release information
66
+ if: ${{ env.RELEASE_KIND == 'no-release' }}
67
+ run: |
68
+ echo "CURRENT_VERSION=$(bump-my-version show current_version)" >> $GITHUB_ENV
69
+ echo "NEW_VERSION=$(bump-my-version show current_version)" >> $GITHUB_ENV
70
+
71
+ - name: Display the version hint
72
+ uses: s-gehring/singleton-comment@v1
73
+ with:
74
+ comment-body: |
75
+ **Version hint:** ${{ env.RELEASE_KIND }}
76
+ **Current version:** ${{ env.CURRENT_VERSION }}
77
+ **New version (when merged):** ${{ env.NEW_VERSION }}
@@ -0,0 +1,77 @@
1
+ name: Bump the version on merge
2
+ on:
3
+ pull_request:
4
+ types: [closed]
5
+ branches: [master, main]
6
+
7
+ jobs:
8
+ bump-version:
9
+ runs-on: ubuntu-latest
10
+ if: github.event.pull_request.merged == true
11
+ permissions:
12
+ contents: write
13
+ id-token: write
14
+ outputs:
15
+ build_package: ${{ steps.bump-version.outputs.build_package }}
16
+ tag_name: ${{ steps.bump-version.outputs.tag_name }}
17
+ steps:
18
+ - name: Checkout the repository
19
+ uses: actions/checkout@v6
20
+ with:
21
+ fetch-depth: 0
22
+
23
+ - name: Install uv
24
+ uses: astral-sh/setup-uv@v7
25
+ with:
26
+ enable-cache: true
27
+
28
+ - name: Set up Python
29
+ uses: actions/setup-python@v6
30
+ with:
31
+ python-version: "3.12"
32
+
33
+ - name: Setup Git
34
+ uses: fregante/setup-git-user@v2
35
+
36
+ - name: Install requirements
37
+ run: |
38
+ python -m pip install bump-my-version
39
+
40
+ - name: Generate changelog and release hint
41
+ id: changelog
42
+ uses: docker://ghcr.io/callowayproject/generate-changelog:v0
43
+
44
+ - name: Bump version
45
+ id: bump-version
46
+ shell: bash
47
+ run: |
48
+ PR_NUMBER=$(gh pr view --json number -q .number || echo "")
49
+ REVISION=$(git describe --tags --long | awk -F- '{print $2}')
50
+ RELEASE_KIND=${{ steps.changelog.outputs.release_hint }}
51
+ export PR_NUMBER REVISION RELEASE_KIND
52
+ case "$RELEASE_KIND" in
53
+ major|minor|patch)
54
+ bump-my-version bump --allow-dirty --verbose "$RELEASE_KIND"
55
+ git push
56
+ git push --tags
57
+ echo "tag_name=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT
58
+ echo "build_package=true" >> $GITHUB_OUTPUT
59
+ ;;
60
+ *)
61
+ echo "build_package=false" >> $GITHUB_OUTPUT
62
+ ;;
63
+ esac
64
+ env:
65
+ GH_TOKEN: ${{ github.token }}
66
+
67
+ call-build-python:
68
+ needs: bump-version
69
+ if: ${{ needs.bump-version.outputs.build_package == 'true' }}
70
+ permissions:
71
+ contents: write
72
+ attestations: write
73
+ id-token: write
74
+ packages: write
75
+ uses: ./.github/workflows/build-python.yaml
76
+ with:
77
+ ref: ${{ needs.bump-version.outputs.tag_name }}
@@ -0,0 +1,72 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ master, main ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ master, main ]
20
+ schedule:
21
+ - cron: '37 21 * * 5'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'python' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38
+
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v6
42
+
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@v4
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
51
+
52
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53
+ # queries: security-extended,security-and-quality
54
+
55
+
56
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
57
+ # If this step fails, then you should remove it and run the build manually (see below)
58
+ - name: Autobuild
59
+ uses: github/codeql-action/autobuild@v4
60
+
61
+ # ℹ️ Command-line programs to run using the OS shell.
62
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
63
+
64
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
65
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
66
+
67
+ # - run: |
68
+ # echo "Run, Build Application using script"
69
+ # ./location_of_script_within_repo/buildscript.sh
70
+
71
+ - name: Perform CodeQL Analysis
72
+ uses: github/codeql-action/analyze@v4