Skip to content

Commit 85f3e7b

Browse files
committed
initial commit, needs cleanup
Signed-off-by: Stephen L Arnold <[email protected]>
0 parents  commit 85f3e7b

25 files changed

+2281
-0
lines changed

.flake8

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[flake8]
2+
exclude =
3+
.git,
4+
__pycache__,
5+
tests,
6+
build,
7+
dist,
8+
.tox
9+
10+
max-line-length = 90
11+
addons = file,open,basestring,xrange,unicode,long,cmp

.gitchangelog.rc

Lines changed: 296 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
1+
# -*- coding: utf-8; mode: python -*-
2+
##
3+
## Message Format
4+
##
5+
## ACTION: [AUDIENCE:] COMMIT_MSG [!TAG ...]
6+
##
7+
## Description
8+
##
9+
## ACTION is one of 'chg', 'fix', 'new'
10+
##
11+
## Is WHAT the change is about.
12+
##
13+
## 'chg' is for refactor, small improvement, cosmetic changes...
14+
## 'fix' is for bug fixes
15+
## 'new' is for new features, big improvement
16+
##
17+
## AUDIENCE is optional and one of 'dev', 'usr', 'pkg', 'test', 'doc'
18+
##
19+
## Is WHO is concerned by the change.
20+
##
21+
## 'dev' is for developpers (API changes, refactors...)
22+
## 'usr' is for final users (UI changes)
23+
## 'pkg' is for packagers (packaging changes)
24+
## 'test' is for testers (test only related changes)
25+
## 'doc' is for doc guys (doc only changes)
26+
##
27+
## COMMIT_MSG is ... well ... the commit message itself.
28+
##
29+
## TAGs are additionnal adjective as 'refactor' 'minor' 'cosmetic'
30+
##
31+
## They are preceded with a '!' or a '@' (prefer the former, as the
32+
## latter is wrongly interpreted in github.) Commonly used tags are:
33+
##
34+
## 'refactor' is obviously for refactoring code only
35+
## 'minor' is for a very meaningless change (a typo, adding a comment)
36+
## 'cosmetic' is for cosmetic driven change (re-indentation, 80-col...)
37+
## 'wip' is for partial functionality but complete subfunctionality.
38+
##
39+
## Example:
40+
##
41+
## new: usr: support of bazaar implemented
42+
## chg: re-indentend some lines !cosmetic
43+
## new: dev: updated code to be compatible with last version of killer lib.
44+
## fix: pkg: updated year of licence coverage.
45+
## new: test: added a bunch of test around user usability of feature X.
46+
## fix: typo in spelling my name in comment. !minor
47+
##
48+
## Please note that multi-line commit message are supported, and only the
49+
## first line will be considered as the "summary" of the commit message. So
50+
## tags, and other rules only applies to the summary. The body of the commit
51+
## message will be displayed in the changelog without reformatting.
52+
53+
54+
##
55+
## ``ignore_regexps`` is a line of regexps
56+
##
57+
## Any commit having its full commit message matching any regexp listed here
58+
## will be ignored and won't be reported in the changelog.
59+
##
60+
ignore_regexps = [
61+
r'@minor', r'!minor',
62+
r'@cosmetic', r'!cosmetic',
63+
r'@refactor', r'!refactor',
64+
r'@wip', r'!wip',
65+
r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[p|P]kg:',
66+
r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*[d|D]ev:',
67+
r'^([cC]i)\s*:',
68+
r'^(.{3,3}\s*:)?\s*[fF]irst commit.?\s*$',
69+
r'^$', ## ignore commits with empty messages
70+
]
71+
72+
73+
## ``section_regexps`` is a list of 2-tuples associating a string label and a
74+
## list of regexp
75+
##
76+
## Commit messages will be classified in sections thanks to this. Section
77+
## titles are the label, and a commit is classified under this section if any
78+
## of the regexps associated is matching.
79+
##
80+
## Please note that ``section_regexps`` will only classify commits and won't
81+
## make any changes to the contents. So you'll probably want to go check
82+
## ``subject_process`` (or ``body_process``) to do some changes to the subject,
83+
## whenever you are tweaking this variable.
84+
##
85+
section_regexps = [
86+
('New', [
87+
r'^[nN]ew\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
88+
]),
89+
('Features', [
90+
r'^([nN]ew|[fF]eat)\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
91+
]),
92+
('Changes', [
93+
r'^[cC]hg\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
94+
]),
95+
('Fixes', [
96+
r'^[fF]ix\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n]*)$',
97+
]),
98+
99+
('Other', None ## Match all lines
100+
),
101+
]
102+
103+
104+
## ``body_process`` is a callable
105+
##
106+
## This callable will be given the original body and result will
107+
## be used in the changelog.
108+
##
109+
## Available constructs are:
110+
##
111+
## - any python callable that take one txt argument and return txt argument.
112+
##
113+
## - ReSub(pattern, replacement): will apply regexp substitution.
114+
##
115+
## - Indent(chars=" "): will indent the text with the prefix
116+
## Please remember that template engines gets also to modify the text and
117+
## will usually indent themselves the text if needed.
118+
##
119+
## - Wrap(regexp=r"\n\n"): re-wrap text in separate paragraph to fill 80-Columns
120+
##
121+
## - noop: do nothing
122+
##
123+
## - ucfirst: ensure the first letter is uppercase.
124+
## (usually used in the ``subject_process`` pipeline)
125+
##
126+
## - final_dot: ensure text finishes with a dot
127+
## (usually used in the ``subject_process`` pipeline)
128+
##
129+
## - strip: remove any spaces before or after the content of the string
130+
##
131+
## - SetIfEmpty(msg="No commit message."): will set the text to
132+
## whatever given ``msg`` if the current text is empty.
133+
##
134+
## Additionally, you can `pipe` the provided filters, for instance:
135+
#body_process = Wrap(regexp=r'\n(?=\w+\s*:)') | Indent(chars=" ")
136+
#body_process = Wrap(regexp=r'\n(?=\w+\s*:)')
137+
#body_process = noop
138+
body_process = ReSub(r'((^|\n)[A-Z]\w+(-\w+)*: .*(\n\s+.*)*)+$', r'') | strip
139+
140+
141+
## ``subject_process`` is a callable
142+
##
143+
## This callable will be given the original subject and result will
144+
## be used in the changelog.
145+
##
146+
## Available constructs are those listed in ``body_process`` doc.
147+
subject_process = (strip |
148+
ReSub(r'^([cC]hg|[fF]ix|[nN]ew)\s*:\s*((dev|use?r|pkg|test|doc)\s*:\s*)?([^\n@]*)(@[a-z]+\s+)*$', r'\4') |
149+
SetIfEmpty("No commit message.") | ucfirst | final_dot)
150+
151+
152+
## ``tag_filter_regexp`` is a regexp
153+
##
154+
## Tags that will be used for the changelog must match this regexp.
155+
##
156+
tag_filter_regexp = r'^v?[0-9]+\.[0-9]+(\.[0-9]+)?$'
157+
#tag_filter_regexp = r"^.*$"
158+
159+
## ``unreleased_version_label`` is a string or a callable that outputs a string
160+
##
161+
## This label will be used as the changelog Title of the last set of changes
162+
## between last valid tag and HEAD if any.
163+
#unreleased_version_label = lambda: swrap(
164+
# ["git", "describe", "--tags"],
165+
# shell=False,
166+
#)
167+
unreleased_version_label = "(unreleased)"
168+
169+
170+
## ``output_engine`` is a callable
171+
##
172+
## This will change the output format of the generated changelog file
173+
##
174+
## Available choices are:
175+
##
176+
## - rest_py
177+
##
178+
## Legacy pure python engine, outputs ReSTructured text.
179+
## This is the default.
180+
##
181+
## - mustache(<template_name>)
182+
##
183+
## Template name could be any of the available templates in
184+
## ``templates/mustache/*.tpl``.
185+
## Requires python package ``pystache``.
186+
## Examples:
187+
## - mustache("markdown")
188+
## - mustache("restructuredtext")
189+
##
190+
## - makotemplate(<template_name>)
191+
##
192+
## Template name could be any of the available templates in
193+
## ``templates/mako/*.tpl``.
194+
## Requires python package ``mako``.
195+
## Examples:
196+
## - makotemplate("restructuredtext")
197+
##
198+
output_engine = rest_py
199+
#output_engine = mustache("restructuredtext")
200+
#output_engine = mustache("markdown")
201+
#output_engine = makotemplate("restructuredtext")
202+
203+
204+
## ``include_merge`` is a boolean
205+
##
206+
## This option tells git-log whether to include merge commits in the log.
207+
## The default is to include them.
208+
include_merge = True
209+
210+
211+
## ``log_encoding`` is a string identifier
212+
##
213+
## This option tells gitchangelog what encoding is outputed by ``git log``.
214+
## The default is to be clever about it: it checks ``git config`` for
215+
## ``i18n.logOutputEncoding``, and if not found will default to git's own
216+
## default: ``utf-8``.
217+
#log_encoding = 'utf-8'
218+
219+
220+
## ``publish`` is a callable
221+
##
222+
## Sets what ``gitchangelog`` should do with the output generated by
223+
## the output engine. ``publish`` is a callable taking one argument
224+
## that is an interator on lines from the output engine.
225+
##
226+
## Some helper callable are provided:
227+
##
228+
## Available choices are:
229+
##
230+
## - stdout
231+
##
232+
## Outputs directly to standard output
233+
## (This is the default)
234+
##
235+
## - FileInsertAtFirstRegexMatch(file, pattern, idx=lamda m: m.start(), flags)
236+
##
237+
## Creates a callable that will parse given file for the given
238+
## regex pattern and will insert the output in the file.
239+
## ``idx`` is a callable that receive the matching object and
240+
## must return a integer index point where to insert the
241+
## the output in the file. Default is to return the position of
242+
## the start of the matched string.
243+
##
244+
## - FileRegexSubst(file, pattern, replace, flags)
245+
##
246+
## Apply a replace inplace in the given file. Your regex pattern must
247+
## take care of everything and might be more complex. Check the README
248+
## for a complete copy-pastable example.
249+
##
250+
# publish = FileInsertIntoFirstRegexMatch(
251+
# "CHANGELOG.rst",
252+
# r'/(?P<rev>[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n/',
253+
# idx=lambda m: m.start(1)
254+
# )
255+
#publish = stdout
256+
257+
258+
## ``revs`` is a list of callable or a list of string
259+
##
260+
## callable will be called to resolve as strings and allow dynamical
261+
## computation of these. The result will be used as revisions for
262+
## gitchangelog (as if directly stated on the command line). This allows
263+
## to filter exaclty which commits will be read by gitchangelog.
264+
##
265+
## To get a full documentation on the format of these strings, please
266+
## refer to the ``git rev-list`` arguments. There are many examples.
267+
##
268+
## Using callables is especially useful, for instance, if you
269+
## are using gitchangelog to generate incrementally your changelog.
270+
##
271+
## Some helpers are provided, you can use them::
272+
##
273+
## - FileFirstRegexMatch(file, pattern): will return a callable that will
274+
## return the first string match for the given pattern in the given file.
275+
## If you use named sub-patterns in your regex pattern, it'll output only
276+
## the string matching the regex pattern named "rev".
277+
##
278+
## - Caret(rev): will return the rev prefixed by a "^", which is a
279+
## way to remove the given revision and all its ancestor.
280+
##
281+
## Please note that if you provide a rev-list on the command line, it'll
282+
## replace this value (which will then be ignored).
283+
##
284+
## If empty, then ``gitchangelog`` will act as it had to generate a full
285+
## changelog.
286+
##
287+
## The default is to use all commits to make the changelog.
288+
#revs = ["^1.0.3", ]
289+
#revs = [
290+
# Caret(
291+
# FileFirstRegexMatch(
292+
# "CHANGELOG.rst",
293+
# r"(?P<rev>[0-9]+\.[0-9]+(\.[0-9]+)?)\s+\([0-9]+-[0-9]{2}-[0-9]{2}\)\n--+\n")),
294+
# "HEAD"
295+
#]
296+
revs = []

.github/workflows/check.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Check
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
pre-commit:
12+
name: pre-commit
13+
runs-on: ubuntu-20.04
14+
steps:
15+
- uses: actions/checkout@v3
16+
17+
- uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.9'
20+
21+
- uses: pre-commit/[email protected]
22+
id: precommit
23+
24+
- name: Upload pre-commit changes
25+
if: failure() && steps.precommit.outcome == 'failure'
26+
uses: rhaschke/upload-git-patch-action@main
27+
with:
28+
name: pre-commit

0 commit comments

Comments
 (0)