Skip to content

Commit 53843c0

Browse files
authored
🚨 Apply automatic formatting (#474)
1 parent 3aa3f7c commit 53843c0

62 files changed

Lines changed: 555 additions & 669 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.docstr.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
skip_magic: True
2-
skip_file_doc: True
3-
skip_init: True
4-
skip_private: True
5-
ignore_setter: True
6-
fail-under: 100
1+
skip_magic: true
2+
skip_file_doc: true
3+
skip_init: true
4+
skip_private: true
5+
ignore_setter: true
6+
fail-under: 100

.github/workflows/codeql-analysis.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ "main", "v1" ]
16+
branches: ["main", "v1"]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ "main", "v1" ]
19+
branches: ["main", "v1"]
2020
schedule:
21-
- cron: '25 22 * * 1'
21+
- cron: '25 22 * * 1'
2222

2323
jobs:
2424
analyze:
@@ -32,7 +32,7 @@ jobs:
3232
strategy:
3333
fail-fast: false
3434
matrix:
35-
language: [ 'python' ]
35+
language: ['python']
3636
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
3737
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
3838

@@ -48,11 +48,11 @@ jobs:
4848
# If you wish to specify custom queries, you can do so here or in a config file.
4949
# By default, queries listed here will override any specified in a config file.
5050
# Prefix the list here with "+" to use these queries and those in the config file.
51-
51+
5252
# 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
5353
# queries: security-extended,security-and-quality
5454

55-
55+
5656
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5757
# If this step fails, then you should remove it and run the build manually (see below)
5858
- name: Autobuild
@@ -61,7 +61,7 @@ jobs:
6161
# ℹ️ Command-line programs to run using the OS shell.
6262
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
6363

64-
# If the Autobuild fails above, remove it and uncomment the following three lines.
64+
# If the Autobuild fails above, remove it and uncomment the following three lines.
6565
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
6666

6767
# - run: |
Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,30 @@
1-
name: "Linting and unittests"
1+
name: "unittests"
22

33
on:
44
push:
55
paths:
6-
- '**.py'
6+
- '**.py'
77
pull_request:
88
branches: ["main"]
99

1010
jobs:
11-
lint:
12-
runs-on: ubuntu-latest
13-
container:
14-
image: python:3.8
15-
16-
steps:
17-
- uses: actions/checkout@v2
18-
- name: Install dependencies
19-
run: |
20-
python -m pip install --upgrade pip
21-
pip install -e .[lint]
22-
- name: Lint format with `black`
23-
run: black bibtexparser tests setup.py --check
24-
- name: Lint imports with `isort`
25-
run: isort bibtexparser tests setup.py --check-only --profile black
26-
- name: Check docstr-coverage with `docstr-coverage`
27-
run: docstr-coverage bibtexparser
2811

2912
build:
3013
strategy:
3114
matrix:
3215
os: [ubuntu-latest, windows-latest, macos-latest]
33-
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']
16+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
3417
runs-on: ${{ matrix.os }}
3518
steps:
36-
- uses: actions/checkout@v2
37-
- name: Set up Python ${{ matrix.python-version }}
38-
uses: actions/setup-python@v1
39-
with:
40-
python-version: ${{ matrix.python-version }}
41-
- name: Install dependencies
42-
run: |
43-
python -m pip install --upgrade pip
44-
pip install -e .[test]
45-
- name: Test with pytest
46-
run: |
47-
pytest tests
48-
19+
- uses: actions/checkout@v2
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v1
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -e .[test]
28+
- name: Test with pytest
29+
run: |
30+
pytest tests

.github/workflows/pre-commit.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: pre-commit
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@main
14+
- uses: actions/setup-python@main
15+
with:
16+
python-version: '<3.12' # https://github.com/HunterMcGushion/docstr_coverage/issues/137
17+
- uses: pre-commit/action@main

.github/workflows/publish-to-test-pypi.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
steps:
1414
- uses: actions/checkout@v3
15-
15+
1616
- name: Set up Python
1717
uses: actions/setup-python@v4
1818
with:
@@ -37,7 +37,7 @@ jobs:
3737
with:
3838
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
3939
repository-url: https://test.pypi.org/legacy/
40-
40+
4141
- name: Publish distribution 📦 to PyPI
4242
uses: pypa/gh-action-pypi-publish@release/v1
4343
with:

.pre-commit-config.yaml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-toml
9+
- id: debug-statements
10+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
11+
rev: v2.12.0
12+
hooks:
13+
- id: pretty-format-yaml
14+
args: [--preserve-quotes, --autofix, --indent, '2']
15+
- id: pretty-format-toml
16+
args: [--autofix, --indent, '4', --trailing-commas]
17+
- repo: https://github.com/pre-commit/pygrep-hooks
18+
rev: v1.10.0
19+
hooks:
20+
- id: python-check-blanket-noqa
21+
- id: python-check-blanket-type-ignore
22+
- id: python-no-log-warn
23+
- id: python-use-type-annotations
24+
- id: rst-backticks
25+
- id: rst-directive-colons
26+
- id: rst-inline-touching-normal
27+
- repo: https://github.com/psf/black
28+
rev: 24.2.0
29+
hooks:
30+
- id: black
31+
args: [--safe, --quiet, --line-length=100]
32+
- repo: https://github.com/PyCQA/autoflake
33+
rev: v2.3.0
34+
hooks:
35+
- id: autoflake
36+
args: [--in-place, --remove-unused-variable]
37+
- repo: https://github.com/pycqa/isort
38+
rev: 5.13.2
39+
hooks:
40+
- id: isort
41+
name: isort
42+
args: ["--force-single-line", "--line-length=100", "--profile=black"]
43+
- repo: https://github.com/asottile/pyupgrade
44+
rev: v3.15.1
45+
hooks:
46+
- id: pyupgrade
47+
args: [--py36-plus]
48+
- repo: https://github.com/PyCQA/flake8
49+
rev: 7.0.0
50+
hooks:
51+
- id: flake8
52+
args: ["--ignore=E722,W503,E203", --max-line-length=110, "--per-file-ignores=*/__init__.py:F401"]
53+
- repo: https://github.com/asottile/setup-cfg-fmt
54+
rev: v2.5.0
55+
hooks:
56+
- id: setup-cfg-fmt
57+
- repo: https://github.com/HunterMcGushion/docstr_coverage
58+
rev: v2.3.0
59+
hooks:
60+
- id: docstr-coverage
61+
args: ["bibtexparser"]

CONTRIBUTING.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Contributing
1+
## Contributing
22

33
Thanks heaps for being interested in contributing to python-bibtexparser.
44

@@ -8,15 +8,16 @@ We are always looking for people to improve the library. Contributions include,
88
2. Providing bugfixing PRs
99
3. Implementing any of the issues or continuing any of the PRs labelled with `needs help` or `good first issue`.
1010

11-
### Some guidelines:
11+
### Some guidelines
1212

1313
1. Be nice! Were all doing this in our free time; no one is obligated to do anything.
14-
2. Add sufficient tests to your PRs
14+
2. Add sufficient tests to your PRs.
1515
3. Document your code.
1616
4. Don't hesitate to ask questions.
1717

1818
### Version 1 vs version 2
19-
Also note that there are currently two independent "default" branches:
19+
20+
Also note that there are currently two independent "default" branches:
2021
First, `main`, where we maintain the `v2` of bibtexparser, which is a complete re-write and currently still in beta and not feature complete.
2122
Second, `v1` where we maintain the stable `v1` version of bibtexparser. Note that on `v1` we accept only small, non-breaking changes and are planning to stop support as soon as `v2` reaches reasonable stability.
2223
The two branches are never going to be merged anymore, thus if you want to change something for both versions, you will have to open two PRs.
@@ -25,8 +26,8 @@ Issues are labelled `v1` and `v2`, correspondingly.
2526

2627
### Dev-Dependencies, testing and linting on v2.
2728

28-
To install the dev dependencies, run `pip install -e .[test,lint,docs]` from within the cloned repository. Then:
29+
To install the dev dependencies, run `pip install -e .[test,docs]` from within the cloned repository. Then:
2930

3031
- To test your code, run `pytest .`
31-
- To lint your code (required for CI/CD to pass), run: `black bibtexparser tests docs && isort bibtexparser tests docs --profile black`
32+
- To lint your code (enforces code style), run: `pre-commit run --all-files` (if you need to install pre-commit, run `pip install pre-commit`).
3233
- To build and preview the docs, navigate into `docs` and run `make html`. Then open the `index.html` file in the `docs/build/html` folder.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ If instead, you want to use v1, install it using:
1919
pip install bibtexparser~=1.0
2020
```
2121

22-
Note that all development and maintenance effort is focussed on v2.
22+
Note that all development and maintenance effort is focussed on v2.
2323
Small PRs for v1 are still accepted, but only as long as they are backwards compatible and don't introduce much additional technical debt.
24-
Development of version one happens on the dedicated [v1 branch](https://github.com/sciunto-org/python-bibtexparser/tree/v1).
24+
Development of version one happens on the dedicated [v1 branch](https://github.com/sciunto-org/python-bibtexparser/tree/v1).
2525

26-
The remainder of this README is specific to v2.
26+
The remainder of this README is specific to v2.
2727

2828
## Documentation
2929
Go check out our documentation on [https://bibtexparser.readthedocs.io/en/main/](https://bibtexparser.readthedocs.io/en/main/).
@@ -66,7 +66,7 @@ new_bibtex_string = bibtexparser.write_string(bib_database,
6666
)
6767
```
6868

69-
These examples really only show the bare minimum.
69+
These examples really only show the bare minimum.
7070
Consult the documentation for a list of available middleware, parsing options and write-formatting options.
7171

7272
## V2 Architecture and Terminology
@@ -76,21 +76,21 @@ Consult the documentation for a list of available middleware, parsing options an
7676
The architecture consists of the following components:
7777

7878
#### Library
79-
Reflects the contents of a parsed bibtex files, including all comments, entries, strings, preamples and their metadata (e.g. order).
79+
Reflects the contents of a parsed bibtex files, including all comments, entries, strings, preamples and their metadata (e.g. order).
8080

8181
#### A Splitter
8282
Splits a bibtex string into basic blocks (Entry, String, Preamble, ...), with correspondingly split content (e.g. fields on Entry, key-value on String, ...).
83-
The splitter aims to be forgiving when facing invalid bibtex: A line starting with a block definition (`@....`) ends the previous block, even if not yet every bracket is closed, failing the parsing of the previous block. Correspondingly, one block type is "ParsingFailedBlock".
83+
The splitter aims to be forgiving when facing invalid bibtex: A line starting with a block definition (``@....``) ends the previous block, even if not yet every bracket is closed, failing the parsing of the previous block. Correspondingly, one block type is "ParsingFailedBlock".
8484

8585
#### Middleware
86-
Middleware layers transform a library and its blocks, for example by decoding latex special characters, interpolating string references, resoling crossreferences or re-ordering blocks. Thus, the choice of middleware allows to customize parsing and writing to ones specific usecase. Note: Middlewares, by default, no not mutate their input, but return a modified copy.
86+
Middleware layers transform a library and its blocks, for example by decoding latex special characters, interpolating string references, resoling crossreferences or re-ordering blocks. Thus, the choice of middleware allows to customize parsing and writing to ones specific usecase. Note: Middlewares, by default, no not mutate their input, but return a modified copy.
8787

8888
#### Writer
89-
Writes the content of a bibtex library to a `.bib` file. Optional formatting parameters can be passed using a corresponding dedicated data structure.
89+
Writes the content of a bibtex library to a ``.bib`` file. Optional formatting parameters can be passed using a corresponding dedicated data structure.
9090

9191
## About
9292

93-
Since 2022, `bibtexparser` is primarily written and maintained by Michael Weiss ([@MiWeiss](https://github.com/MiWeiss/)). In 2024, Tom de Geus ([@tdegeus](https://github.com/tdegeus)) joined as co-maintainer.
93+
Since 2022, `bibtexparser` is primarily written and maintained by Michael Weiss ([@MiWeiss](https://github.com/MiWeiss/)). In 2024, Tom de Geus ([@tdegeus](https://github.com/tdegeus)) joined as co-maintainer.
9494

9595
Credits and thanks to the many contributors who helped creating this library, including
9696
François Boulogne ([@sciunto](https://github.com/sciunto/), creator of the first version) and Olivier Mangin ([@omangin](https://github.com/omangin/), long-term contributor).

RELEASE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Tagged version are automatically released to pypi using github actions.
1+
Tagged version are automatically released to pypi using github actions.
22

33
Oder/Manual release instructions:
44

@@ -17,4 +17,3 @@ Oder/Manual release instructions:
1717
twine upload dist/*
1818
* Create release on Github
1919
* Verify docs are automatically updated
20-

0 commit comments

Comments
 (0)