Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
853 commits
Select commit Hold shift + click to select a range
4f615ba
Try to clarify the SPLIT_ALL_COMMA_SEPARATED_VALUES knob (#926)
jamesderlin Jul 13, 2021
418df8d
support ignore config in pyproject.toml (#937)
hirosassa Jul 13, 2021
f890396
Merge isinstance calls (#938)
monosans Jul 13, 2021
2ca3517
Replace if statement with if expression (#939)
monosans Jul 13, 2021
836890d
Replace while with for (#940)
monosans Jul 13, 2021
7cd934a
Replace multiple comparisons with in operator (#941)
monosans Jul 13, 2021
27de2d8
Merge else clause's nested if statement into elif (#942)
monosans Jul 13, 2021
66106da
Improve comprehensions (#943)
monosans Jul 13, 2021
e4663fd
change ignore config format for pyproject.toml (#946)
hirosassa Jul 19, 2021
5485509
Follow PEP8: Method definitions inside a class are surrounded by a si…
bouweandela Aug 23, 2021
4f41968
Added yapf_api.FormatTree (#952)
superbobry Sep 2, 2021
23573d0
``pytree_utils.ParseCodeToTree`` now adds a trailing EOL if needed (#…
superbobry Sep 16, 2021
00c95bc
Fix typos discovered by codespell (#950)
cclauss Sep 16, 2021
98c8146
Enforce a space between a colon and the ... token
bwendling Nov 3, 2021
c2ce67f
Use '[style]' in the example, as that's the most common style section
bwendling Nov 4, 2021
f1ee238
Reformatting the source code.
bwendling Nov 4, 2021
99ace8e
Correct testcases for Python 2.7 and PEP8 changes.
bwendling Nov 4, 2021
8fa5d82
Change tests to support "pytest".
bwendling Nov 4, 2021
d3d6982
Reformat so that flake8 is happy.
bwendling Nov 4, 2021
101dbb8
Reformat
bwendling Nov 4, 2021
63f0e43
Add CI via GitHub Actions.
bwendling Nov 4, 2021
f04dbf5
Add GitHub Actions badge.
bwendling Nov 4, 2021
3499b2e
Update URL and ignore yapftests
bwendling Nov 4, 2021
470a099
Turn off hash randomization in test.
bwendling Nov 4, 2021
a4d72cd
Don't run on Windows
bwendling Nov 4, 2021
60d5c84
We're no longer using Travis CI.
bwendling Nov 4, 2021
0221e0d
Add more files to flake8 run.
bwendling Nov 4, 2021
3747f06
Cleanup of the FormatToken interface
bwendling Nov 8, 2021
3e4286c
Combine the "must_break_before" and "must_split" properties.
bwendling Nov 8, 2021
59a62db
Move the "newlines" attribute from pytree node to format token.
bwendling Nov 8, 2021
34963b3
Unify the YAPF exceptions
isanbard Dec 23, 2021
82f5f34
Use Python's argument parser's "version" action
isanbard Dec 23, 2021
7d9f50e
Compare the node's type instead of its name
isanbard Dec 24, 2021
c1c786d
Remove unused import
isanbard Dec 24, 2021
cfeca1c
Fix up the "name" and "is_docstring" bits of a format_token
isanbard Dec 24, 2021
d658e35
Remove useless a_expr and m_expr subtypes
isanbard Dec 25, 2021
4f9bd31
Move subtypes into their own module.
isanbard Dec 25, 2021
4da4f9c
Add "splitpenalty" to the format_token repr
isanbard Dec 25, 2021
daae87d
Fixup YapfError messages
isanbard Dec 25, 2021
5be7077
Use a set for subtypes.
isanbard Dec 25, 2021
76e7743
Add "start" and "end" properties
isanbard Dec 25, 2021
cd5a459
Use "logical line" instead of "unwrapped line"
isanbard Dec 26, 2021
714e362
Reformatting.
isanbard Dec 26, 2021
1aa86c3
Bump version to 0.32.0
isanbard Dec 26, 2021
7974bd2
Fix RST formatting.
isanbard Dec 26, 2021
bfdbf80
[file_resources] use "tokenize.detect_encoding" for Python3+
isanbard Dec 27, 2021
17c3e69
[imports] remove unused imports
isanbard Dec 27, 2021
c477857
[pytree] moved 'pytree' parsing tools into its own subdirectory
isanbard Dec 27, 2021
ec86bc2
Move pytree-specific visitors to appropriate subdirectory
isanbard Jan 2, 2022
c426272
Remove "AppendNode", which wasn't that useful
isanbard Jan 2, 2022
4abc694
Use OpensScope/ClosesScope instead of testing token's text
isanbard Jan 2, 2022
732e5b9
Add support for Python 3.10 (#986)
hugovk Jan 2, 2022
b8db953
Reformat
isanbard Jan 4, 2022
577d43f
Split line before all comparison operators (#988)
jnooree Jan 11, 2022
480339e
Add the beginnings of a simple Python parser.
isanbard Dec 25, 2021
4574823
Mark test target as "noqa"
isanbard Jan 11, 2022
eb6c0d2
Use correct variable
isanbard Jan 11, 2022
ec16864
Remove unused variable
isanbard Jan 11, 2022
4a8507a
Added pyproject extra to install toml package as an optional dependen…
arareko Feb 8, 2022
20f0ca6
Fix tests
bwendling Feb 11, 2022
322e5bf
Fixup missing locations
isanbard Feb 26, 2022
44b1bd3
Comment the method and move "import ast" into the debugging code
isanbard Feb 26, 2022
b04a4ef
Reformat
isanbard Feb 26, 2022
f94ecb1
Don't try to reformat formatted values
isanbard Feb 26, 2022
c6069b8
Make sure the things we're formatted exist
isanbard Feb 26, 2022
32c2c67
Fix some minor wording and capitalization.
isanbard Feb 26, 2022
2a08bd8
Explain the "decorator" code a bit better
isanbard Feb 26, 2022
4c7f3de
Use "for ... enumerate(...)" instead of the awkward "for" loop
isanbard Feb 26, 2022
5317bee
Clean up API so that we don't have to pass in start and end tuples
isanbard Feb 26, 2022
8cae3db
Clean up how multiline lambdas are handled
isanbard Feb 26, 2022
fbe6305
Handle argument annotations.
isanbard Feb 26, 2022
d55e289
Decorators aren't in the same range as the function def node
isanbard Feb 27, 2022
1adc1ce
Pass in the node's name
isanbard Feb 27, 2022
33e7699
Don't use pytree 'node' to access values
isanbard Feb 27, 2022
957b61c
Remove bad comment markers
bwendling Feb 27, 2022
c733e76
add GitHub URL for PyPi (#997)
andriyor Mar 1, 2022
0953195
Fix multiple # in comment warning.
bwendling Mar 1, 2022
84df63c
Add missing commit
bwendling Mar 1, 2022
b8ef920
docs: Fix a few typos
timgates42 Jul 14, 2022
c3975df
features to align assignment operators and dictionary colons
lizawang Aug 18, 2022
ddc0257
update the changelog and readme
lizawang Aug 30, 2022
9ea41f8
small fixes
lizawang Aug 30, 2022
8926920
Update README.rst
lizawang Aug 30, 2022
1528de9
fix readme
lizawang Aug 30, 2022
1816dab
fix readme
lizawang Aug 30, 2022
7eb1c34
fix align_dict_colon
lizawang Sep 13, 2022
a75196d
add test for the case when the dict starts with a comment
lizawang Sep 15, 2022
69fb7e1
Also support Black's `# fmt: off/on` pragma. (#1026)
yilei Sep 23, 2022
030c268
Change indentation
bwendling Sep 23, 2022
7c0c8d4
branch for assignment alignment
lizawang Oct 3, 2022
d374b7d
run the assignment align over the yapf codes
lizawang Oct 3, 2022
6531180
Prevent crashes against valid 'pyproject.toml'. (#1040)
emcd Nov 30, 2022
c285730
change the format back to yapf-based
lizawang Jan 3, 2023
f756c12
change the format back to yapf-based 2
lizawang Jan 3, 2023
10c5b0c
Generated dicts also have keys and values for rules to apply (#1044)
alexey-pelykh Jan 4, 2023
fea4e9a
Update README.rst
cerob Jan 25, 2023
caebeab
bugfix for the missing homepage url in the package metadata (#1051)
raj-kapil Jan 30, 2023
00c250e
Fix parsing of comments.
bwendling Feb 4, 2023
75ca557
Small fixes and optimizations
eltoder Feb 7, 2023
3511500
Remove --disable-noqa from .flake8 config
Feb 9, 2023
b471a1b
Merge pull request #1056 from thiagowfx/thiagowfx/lint
Feb 10, 2023
ed21d06
Merge pull request #1016 from timgates42/bugfix_typos
Feb 10, 2023
2c1472c
Merge pull request #1055 from eltoder/feature/small-fixes
Feb 13, 2023
29acb5d
Minor fix + suggestion
zakgreant Feb 18, 2023
8623a99
Merge pull request #1052 from cerob/patch-1
Feb 23, 2023
d77ee00
ci: run on every PR and on main branch
Feb 24, 2023
38ffc6e
Merge pull request #1061 from google/thiagowfx-patch-1
Feb 24, 2023
dea0469
Generalized the ending comma heuristic to subscripts
superbobry Feb 21, 2022
86fda22
Merge pull request #1062 from google/trailing-comma-in-subscript
Feb 24, 2023
94a7fac
Drop official support for all versions of Python not actively support…
Spitfire1900 Apr 12, 2023
f603b4e
Support pyproject.toml by default (#1069)
Spitfire1900 Apr 12, 2023
3f14d3b
Remove references from README.rst (#1071)
Spitfire1900 Apr 17, 2023
47c4605
Bump version to 0.33.0
bwendling Apr 18, 2023
5b122fc
ci.yml: Stop limiting push-CI to main branch
hartwork Apr 18, 2023
c4f6fab
Add windows-latest to build matrix
Spitfire1900 Apr 19, 2023
ca26c62
ignore .venv dirs
Spitfire1900 Apr 19, 2023
d71adf6
Remove Python 3.6 tests
Spitfire1900 Apr 19, 2023
1c4d067
missing newline
Spitfire1900 Apr 19, 2023
9b6428f
format
Spitfire1900 Apr 19, 2023
e80c748
Merge pull request #1059 from zakgreant/patch-1
Apr 20, 2023
fe6ac47
Merge pull request #1076 from Spitfire1900/feature/windows-latest
Apr 20, 2023
66b0fcd
Merge pull request #1075 from hartwork/stop-limiting-push-ci-to-main-…
Apr 20, 2023
fba1afb
Start supporting Python 3.11 officially
hartwork Apr 18, 2023
1a3bb9d
setup.py: Add Python-3-only classifier
hartwork Apr 18, 2023
72d5a8f
ci.yml: Save CI resources on in-between Python 3.9 and 3.10
hartwork Apr 18, 2023
7e96021
Merge pull request #1072 from hartwork/python-3-11
Apr 20, 2023
5efa946
setup.py: Formalize requirement for Python >=3.7
hartwork Apr 18, 2023
54d5af7
Drop Python <3.7 leftovers
hartwork Apr 18, 2023
9fe7309
Merge pull request #1074 from hartwork/drop-pre-python-3-7-leftovers
Apr 20, 2023
750285f
Pin GitHub Actions to specific commits for security (#1073)
hartwork Apr 25, 2023
31995e7
Make GitHub Dependabot keep the GitHub Actions up to date (#1082)
hartwork May 2, 2023
b98c776
tomli should be installed by yapf, toml no longer required (#1086)
Spitfire1900 May 2, 2023
e98e567
pre-commit: Mass-apply end-of-file-fixer (#1078)
hartwork May 2, 2023
cbe0a40
pre-commit: Mass-apply double-quote-string-fixer (#1079)
hartwork May 2, 2023
62419c6
pre-commit: Mass-apply trailing-whitespace (#1080)
hartwork May 2, 2023
dd81d9b
Actions(deps): Bump actions/setup-python from 4.5.0 to 4.6.0 (#1087)
dependabot[bot] May 2, 2023
4480b11
Document Python support (i.e. get existing docs back in sync) (#1083)
hartwork May 2, 2023
04decc4
Remove more Python 2 leftovers (tool 2to3) (#1084)
hartwork May 2, 2023
ee4a5af
Resolve py3compat.py (#1088)
hartwork May 2, 2023
727d2df
Remove duplicate .pre-commit-*.yml files (#1089)
hartwork May 2, 2023
6c4b34c
Resolve py2 grammar (alternative to #776) (#1090)
hartwork May 2, 2023
afdee78
Fix test check for raised exception
bwendling May 5, 2023
a1d888c
Move third party code to the top-level directory
bwendling May 5, 2023
4abb0cb
Remove tabs
bwendling May 5, 2023
6982ebb
Add isort pre-commit and lint with isort and yapf in CI (#1093)
Spitfire1900 May 19, 2023
318391a
Add --print-modified to print modified files (#1054)
eltoder May 23, 2023
f7d42c4
ignore VSCode settings, worktree dir (#1095)
Spitfire1900 May 25, 2023
46d9c89
Make CI enforce pre-commit clean code (#1096)
hartwork May 27, 2023
e16ad58
Build wheel against py3 only (#1098)
Spitfire1900 May 27, 2023
cf7b690
Flake8 fails unnecessarily if run before yapf (#1099)
Spitfire1900 Jun 7, 2023
1631220
Actions(deps): Bump actions/setup-python from 4.5.0 to 4.6.1 (#1100)
dependabot[bot] Jun 7, 2023
b677197
ylib2to3 -- Fork lib2to3 with some blib2to3 backports; add structured…
Spitfire1900 Jun 9, 2023
0eedb16
Add ylib2to3 fork comment
bwendling Jun 10, 2023
de026a5
Add tests from resolved issues
bwendling Jun 13, 2023
d44294c
Bump version to 0.44.0
bwendling Jun 13, 2023
43ee73d
pre-commit: Make CI keep pre-commit actions up to date (#1097)
hartwork Jun 13, 2023
94318bb
Convert README file to MarkDown
bwendling Jun 13, 2023
31dd8ac
Fix code block indentations
bwendling Jun 13, 2023
60d23f8
Fix code block indentations--second attempt
bwendling Jun 13, 2023
27f8a90
Change README filename
bwendling Jun 13, 2023
9898e30
Fix links to CI images
bwendling Jun 13, 2023
4fecfd5
Fix trailing spaces
bwendling Jun 13, 2023
3875a6d
Move us to 'beta' stage now
bwendling Jun 13, 2023
8053a77
Convert to MarkDown
bwendling Jun 13, 2023
6189363
Reformat the knob docs
bwendling Jun 14, 2023
b98504f
Convert to Markdown
bwendling Jun 14, 2023
bbdd27b
Change to correct filename
bwendling Jun 14, 2023
ef55c2b
Actions(deps): Bump actions/checkout from 3.5.2 to 3.5.3 (#1105)
dependabot[bot] Jun 14, 2023
2837603
Fix for bad v0.40.0 packaging
bwendling Jun 20, 2023
8f9ea1b
pre-commit: Autoupdate (#1109)
github-actions[bot] Jun 21, 2023
723406b
setup.py: Require setuptools >=58.5.0 (#1115)
hartwork Jun 22, 2023
bc681bc
Remove pep8ify as a "current" Python formatter (#1114)
cclauss Jun 22, 2023
7c17b36
Actions(deps): Bump actions/setup-python from 4.5.0 to 4.6.1 (#1113)
dependabot[bot] Jun 22, 2023
3d174ea
Actions(deps): Bump peter-evans/create-pull-request from 5.0.0 to 5.0…
dependabot[bot] Jun 22, 2023
c0877c6
Convert to Markdown file
bwendling Jun 22, 2023
8339246
Use correct filename
bwendling Jun 22, 2023
8b88737
Alphabetize style list
bwendling Jun 23, 2023
e5e239d
Normalize test formats
bwendling Jun 23, 2023
1cfdc16
Remove the "verifier" module
bwendling Jun 23, 2023
4cf2bab
Add fixer_base and do some minor reformatting
bwendling Jun 26, 2023
e44d5fe
Fix some precommit failures due to formatting
bwendling Jul 26, 2023
93848de
SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES and FORCE_MULTILINE_DICT i…
ManiacDC Jul 26, 2023
b4821f8
Fix 'line-too-long' warnings
bwendling Jul 26, 2023
fa6ecd4
Fix invalid style line syntax.
bwendling Jul 26, 2023
9e090dd
Fix formatting
bwendling Jul 26, 2023
2a539ea
Actions(deps): Bump actions/setup-python from 4.6.1 to 4.7.0 (#1122)
dependabot[bot] Jul 28, 2023
beb5877
Actions(deps): Bump actions/checkout from 3.5.3 to 3.6.0 (#1128)
dependabot[bot] Aug 28, 2023
16a1c36
Migrate to pyproject.toml (#1131)
Spitfire1900 Aug 31, 2023
3b1d3dc
Add default workspace recommendations for vscode (#1130)
Spitfire1900 Aug 31, 2023
6a7ba5a
Call unittest directly from tox.ini (#1133)
Spitfire1900 Sep 1, 2023
61be4e8
Do not match keywords named 'match' (#1111)
Spitfire1900 Sep 4, 2023
7c72e0b
Add `Editor support.md` (#1135)
Spitfire1900 Sep 18, 2023
1323865
Fix SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED for one-item argument lists…
alexey-pelykh Sep 19, 2023
bc6772d
pyproject.toml updates to HACKING.md (#1134)
Spitfire1900 Sep 21, 2023
1c714b9
pre-commit: Autoupdate (#1123)
github-actions[bot] Sep 21, 2023
1e2171a
Actions(deps): Bump actions/checkout from 3.6.0 to 4.0.0 (#1141)
dependabot[bot] Sep 22, 2023
4eb9e1a
Use 'isinstance' to avoid PEP error
bwendling Sep 22, 2023
250e4eb
fix trailing backslash stripped cause windows linesep (#1140)
EeyoreLee Sep 22, 2023
5428012
Update CHANGELOG.md
bwendling Sep 22, 2023
5fc2b7a
Bump version to 0.40.2
bwendling Sep 22, 2023
e6b5916
Add additional project URLs (#1147)
Spitfire1900 Sep 22, 2023
107bd1a
Update CONTRIBUTING.md -- add Getting started section (#1148)
Spitfire1900 Sep 22, 2023
7ef32ce
copy globals() (#1150)
Spitfire1900 Sep 25, 2023
ce7f970
Move “use within your favorite editor” to an earlier section in READM…
Spitfire1900 Sep 26, 2023
3490693
Update CHANGELOG.md - mark YANKED versions (#1157)
Spitfire1900 Sep 29, 2023
90ffbbd
Actions(deps): Bump actions/checkout from 4.0.0 to 4.1.0 (#1156)
dependabot[bot] Sep 29, 2023
b31a4b5
#1131 fix for #1121 did not fix vscode behavior on ubuntu (#1149)
Spitfire1900 Oct 10, 2023
4632ddf
Feature/no import third party provided by stdlib (#1158)
Spitfire1900 Oct 10, 2023
ce36a8e
using ylib2to3 means we can test <=py311 on any python version suppor…
Spitfire1900 Oct 10, 2023
31b3e5f
Fix SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED for one-item named argument…
alexey-pelykh Oct 10, 2023
db2d731
Use python 3.12 for CI (#1132)
Spitfire1900 Oct 10, 2023
e2d55ed
Actions(deps): Bump actions/setup-python from 4.7.0 to 4.7.1 (#1163)
dependabot[bot] Oct 10, 2023
56f7a54
Update README.md - cleanup for #1162 (#1171)
Spitfire1900 Oct 13, 2023
9afa48e
Update README.md - remark unsupported Python features (#1161)
Spitfire1900 Oct 13, 2023
a7ff83a
Fix SPLIT_ALL_COMMA_SEPARATED_VALUES and SPLIT_ALL_TOP_LEVEL_COMMA_SE…
alexey-pelykh Oct 17, 2023
1f0f6ca
Actions(deps): Bump actions/checkout from 4.1.0 to 4.1.1 (#1175)
dependabot[bot] Oct 25, 2023
4e6ce49
pre-commit: Autoupdate (#1172)
github-actions[bot] Nov 6, 2023
755afdf
Format '.pyi' type stub files.
bwendling Nov 6, 2023
63c13eb
Add new DISABLE_SPLIT_LIST_WITH_COMMENT flag. (#1177)
jlebar Nov 8, 2023
ade5aef
Update README.md (#1178)
bwendling Nov 8, 2023
afd7271
Update README.md - remark PEP 695 as unsupported feature (#1179)
Spitfire1900 Nov 8, 2023
e6d8685
Clarify Python features will be supported (#1196)
Garrett-R Jan 22, 2024
0e36326
Actions(deps): Bump peter-evans/create-pull-request from 5.0.2 to 6.0…
dependabot[bot] Feb 5, 2024
3af688e
Actions(deps): Bump pre-commit/action from 3.0.0 to 3.0.1 (#1202)
dependabot[bot] Feb 12, 2024
be6db55
Add instruction for installing with pip from GitHub directly. (#1186)
carissableker Feb 17, 2024
43bf1e4
Actions(deps): Bump actions/setup-python from 4.7.1 to 5.0.0 (#1188)
dependabot[bot] Feb 17, 2024
22b8f62
pre-commit: Autoupdate (#1191)
github-actions[bot] Feb 17, 2024
63ac90a
Grammer correction (#1206)
AkashKumarSingh11032001 Mar 19, 2024
12de16e
Actions(deps): Bump actions/checkout from 4.1.1 to 4.1.2 (#1212)
dependabot[bot] Mar 19, 2024
f501adf
Actions(deps): Bump peter-evans/create-pull-request from 6.0.0 to 6.0…
dependabot[bot] Mar 19, 2024
9e873dc
Actions(deps): Bump actions/setup-python from 5.0.0 to 5.1.0 (#1218)
dependabot[bot] Apr 1, 2024
bfab2e8
Fix CI (#1242)
hartwork Oct 3, 2024
9b5e9a5
Actions(deps): Bump actions/checkout from 4.1.2 to 4.2.0 (#1241)
dependabot[bot] Oct 4, 2024
9ab5d76
pre-commit: Add hook for yapf-diff (#1246)
avalanche-pwn Oct 5, 2024
32966de
ylib2to3/pgen2/grammar: Fix Grammar.dump for parallel use with Gramma…
hartwork Oct 7, 2024
a7a81b6
Actions(deps): Bump peter-evans/create-pull-request from 6.0.2 to 7.0…
dependabot[bot] Oct 7, 2024
e3f83ea
Actions(deps): Bump actions/checkout from 4.2.0 to 4.2.1 (#1249)
dependabot[bot] Oct 14, 2024
fb3ed08
Bump version to v0.43.0
bwendling Nov 13, 2024
aa7e3d1
pre-commit: Autoupdate (#1220)
github-actions[bot] Dec 9, 2024
55be1fb
pre-commit: Autoupdate (#1259)
github-actions[bot] Feb 10, 2025
c180ca3
Started addressing PR #1030. Easy format fixes applied.
Aug 12, 2025
d4696fc
Added new tests for alignment edge cases
Aug 12, 2025
7cf3228
Refactored _AlignTrailingComments to reuse logic in _AlignAssignment
Andrea-Oliveri Aug 12, 2025
4d903aa
Updated name of knob in style
Andrea-Oliveri Aug 13, 2025
0de5b58
Removed unused imports
Andrea-Oliveri Aug 13, 2025
51eeab6
Refactored _AlignAssignment
Andrea-Oliveri Aug 13, 2025
cd8a0c9
Added more tests for assignement alignment
Andrea-Oliveri Aug 13, 2025
82ca12b
Ran yapf on codebase
Andrea-Oliveri Aug 13, 2025
82eefc8
Solved merge conflicts with yapf/main
Andrea-Oliveri Aug 13, 2025
53f2f5f
Added lru_cache decorator to FormatToken.is_augassign for consistency…
Andrea-Oliveri Aug 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[report]
# Verifier is used for testing only.
omit =
*/__main__.py
*/verifier.py
17 changes: 13 additions & 4 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
[flake8]
ignore =
# indentation is not a multiple of four,
E111,E114,
# 'toml' imported but unused
F401,
# closing bracket does not match visual indentation
E124,
# continuation line over-indented for hanging indent
E126,
# visually indented line with same indent as next logical line,
E129
E129,
# line break before binary operator
W503,
# line break after binary operator
W504

max-line-length=80
indent-size = 2
max-line-length = 80
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.python-version eol=lf
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:

- package-ecosystem: "github-actions"
commit-message:
include: "scope"
prefix: "Actions"
directory: "/"
labels:
- "enhancement"
schedule:
interval: "weekly"
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Test with pytest

on:
pull_request:
push:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.11", "3.12"] # no particular need for 3.9 or 3.10
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v4.6.0
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: >-
python -m pip install
--upgrade
--disable-pip-version-check
pip
- name: Perform package installs
run: >-
pip install
.
pytest
pytest-cov
- name: Test with pytest
run: pytest
63 changes: 63 additions & 0 deletions .github/workflows/pre-commit-autoupdate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
# Licensed under the Apache License Version 2.0

name: Keep pre-commit hooks up to date

on:
schedule:
- cron: '0 16 * * 5' # Every Friday 4pm
workflow_dispatch:

# NOTE: This will drop all permissions from GITHUB_TOKEN except metadata read,
# and then (re)add the ones listed below:
permissions:
contents: write
pull-requests: write

jobs:
pre_commit_autoupdate:
name: Detect outdated pre-commit hooks
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- name: Set up Python 3.11
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.11

- name: Install pre-commit
run: |-
pip install \
--disable-pip-version-check \
--no-warn-script-location \
--user \
pre-commit
echo "PATH=${HOME}/.local/bin:${PATH}" >> "${GITHUB_ENV}"

- name: Check for outdated hooks
run: |-
pre-commit autoupdate
git diff -- .pre-commit-config.yaml

- name: Create pull request from changes (if any)
id: create-pull-request
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
author: 'pre-commit <pre-commit@tools.invalid>'
base: main
body: |-
For your consideration.

:warning: Please **CLOSE AND RE-OPEN** this pull request so that [further workflow runs get triggered](https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs) for this pull request.
branch: precommit-autoupdate
commit-message: "pre-commit: Autoupdate"
delete-branch: true
draft: true
labels: enhancement
title: "pre-commit: Autoupdate"

- name: Log pull request URL
if: "${{ steps.create-pull-request.outputs.pull-request-url }}"
run: |
echo "Pull request URL is: ${{ steps.create-pull-request.outputs.pull-request-url }}"
37 changes: 37 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) 2023 Sebastian Pipping <sebastian@pipping.org>
# Licensed under the Apache License Version 2.0

name: Run pre-commit

# Drop permissions to minimum for security
permissions:
contents: read

on:
pull_request:
push:
schedule:
- cron: '0 2 * * 5' # Every Friday at 2am
workflow_dispatch:

jobs:
pre_commit_run:
name: Run pre-commit
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1

- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: 3.11

- name: Install yapf (to be available to pre-commit)
run: |-
pip install \
--disable-pip-version-check \
--no-warn-script-location \
--user \
.
echo "PATH=${HOME}/.local/bin:${PATH}" >> "${GITHUB_ENV}"

- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
*~
# Merge files created by git.
*.orig
# Byte compiled python modules.
# Compiled python.
*.pyc
*.pickle
# vim swap files
.*.sw?
.sw?
Expand All @@ -32,3 +33,13 @@
/dist
/.tox
/yapf.egg-info

# IDEs
/.idea
/.vscode/settings.json

# Virtual Environment
/.venv*/

# Worktrees
/.wt
6 changes: 6 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[settings]
force_single_line=true
known_third_party=yapf_third_party
known_yapftests=yapftests

sections=FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER,YAPFTESTS
36 changes: 36 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# File introduces automated checks triggered on git events
# to enable run `pip install pre-commit && pre-commit install`

repos:
- repo: https://github.com/pycqa/isort
rev: 6.0.0
hooks:
- id: isort
name: isort (python)
- repo: local
hooks:
- id: yapf
name: yapf
language: python
entry: yapf
args: [-i]
types: [python]
- repo: https://github.com/pycqa/flake8
rev: 7.1.1
hooks:
- id: flake8
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: check-docstring-first
- id: check-added-large-files
- id: check-yaml
- id: debug-statements
- id: check-merge-conflict
- id: double-quote-string-fixer
- id: end-of-file-fixer
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
21 changes: 21 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# File configures YAPF to be used as a git hook with https://github.com/pre-commit/pre-commit

- id: yapf
name: yapf
description: "A formatter for Python files."
entry: yapf
args: [-i] #inplace
language: python
types: [python]

- id: yapf-diff
name: yapf-diff
description: "A formatter for Python files. (formats only changes included in commit)"
always_run: true
language: python
pass_filenames: false
stages: [pre-commit]
entry: |
bash -c "git diff -U0 --no-color --relative HEAD \
| yapf-diff \
| tee >(git apply --allow-empty -p0)"
5 changes: 5 additions & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
3.7.9
3.8.10
3.9.13
3.10.11
3.11.5
3 changes: 1 addition & 2 deletions .style.yapf
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[style]
# YAPF uses the chromium style
based_on_style = chromium
based_on_style = yapf
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

15 changes: 15 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"recommendations": [
"eeyore.yapf",
"dangmai.workspace-default-settings",
"ms-python.flake8",
"ms-python.isort",
"ms-python.python",
],
// These are remarked as extenstions you should disable for this workspace.
// VSCode does not support disabling extensions via workspace config files.
"unwantedRecommendations": [
"ms-python.black-formatter",
"ms-python.pylint"
]
}
33 changes: 33 additions & 0 deletions .vscode/settings.default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"[python]": {
"diffEditor.ignoreTrimWhitespace": false,
"editor.defaultFormatter": "eeyore.yapf",
"editor.formatOnSaveMode": "file",
"editor.formatOnSave": true,
"editor.wordBasedSuggestions": false,
"files.trimTrailingWhitespace": true,
},
"python.analysis.extraPaths": [
"./third_party"
],
"python.analysis.typeCheckingMode": "basic",
"python.languageServer": "Pylance",
"files.exclude": {
"**/*$py.class": true
},
"json.schemas": [
{
"fileMatch": [
"/.vscode/settings.default.json"
],
"url": "vscode://schemas/settings/folder"
}
],
"workspace-default-settings.runOnActivation": true,
"workspace-default-settings.jsonIndentation": 4
}
Loading