figurelint 0.1.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.
- figurelint-0.1.0/.github/workflows/ci.yml +59 -0
- figurelint-0.1.0/.github/workflows/release.yml +49 -0
- figurelint-0.1.0/.gitignore +10 -0
- figurelint-0.1.0/CHANGELOG.md +53 -0
- figurelint-0.1.0/CONTRIBUTING.md +45 -0
- figurelint-0.1.0/LICENSE +21 -0
- figurelint-0.1.0/PKG-INFO +339 -0
- figurelint-0.1.0/README.md +284 -0
- figurelint-0.1.0/action.yml +116 -0
- figurelint-0.1.0/assets/figurelint-banner.svg +49 -0
- figurelint-0.1.0/assets/figurelint-icon.svg +17 -0
- figurelint-0.1.0/assets/figurelint-logo-dark.svg +12 -0
- figurelint-0.1.0/assets/figurelint-logo.svg +13 -0
- figurelint-0.1.0/assets/figurelint-social-preview.svg +19 -0
- figurelint-0.1.0/docs/BRAND.md +96 -0
- figurelint-0.1.0/docs/GITHUB_ACTION.md +106 -0
- figurelint-0.1.0/docs/NATURE.md +151 -0
- figurelint-0.1.0/docs/PDF_CHECKS.md +84 -0
- figurelint-0.1.0/docs/PRESETS.md +106 -0
- figurelint-0.1.0/docs/PUBLISHING.md +55 -0
- figurelint-0.1.0/docs/SVG_CHECKS.md +69 -0
- figurelint-0.1.0/docs/releases/v0.1.0.md +80 -0
- figurelint-0.1.0/examples/svg/after.svg +17 -0
- figurelint-0.1.0/examples/svg/before.svg +17 -0
- figurelint-0.1.0/pyproject.toml +68 -0
- figurelint-0.1.0/src/figurelint/__init__.py +3 -0
- figurelint-0.1.0/src/figurelint/__main__.py +4 -0
- figurelint-0.1.0/src/figurelint/checks.py +136 -0
- figurelint-0.1.0/src/figurelint/cli.py +278 -0
- figurelint-0.1.0/src/figurelint/github_annotations.py +46 -0
- figurelint-0.1.0/src/figurelint/models.py +19 -0
- figurelint-0.1.0/src/figurelint/pdf_checks.py +322 -0
- figurelint-0.1.0/src/figurelint/presets.py +225 -0
- figurelint-0.1.0/src/figurelint/svg_checks.py +679 -0
- figurelint-0.1.0/tests/test_checks.py +51 -0
- figurelint-0.1.0/tests/test_github_annotations.py +63 -0
- figurelint-0.1.0/tests/test_pdf_checks.py +157 -0
- figurelint-0.1.0/tests/test_presets.py +375 -0
- figurelint-0.1.0/tests/test_svg_checks.py +235 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
test:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: ${{ matrix.python-version }}
|
|
20
|
+
- name: Install
|
|
21
|
+
run: python -m pip install -e ".[dev]"
|
|
22
|
+
- name: Test
|
|
23
|
+
run: pytest -q
|
|
24
|
+
- name: CLI smoke test
|
|
25
|
+
run: figurelint --help
|
|
26
|
+
|
|
27
|
+
package:
|
|
28
|
+
runs-on: ubuntu-latest
|
|
29
|
+
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
- uses: actions/setup-python@v5
|
|
33
|
+
with:
|
|
34
|
+
python-version: "3.12"
|
|
35
|
+
- name: Install release tooling
|
|
36
|
+
run: python -m pip install ".[release]"
|
|
37
|
+
- name: Build wheel and source distribution
|
|
38
|
+
run: python -m build
|
|
39
|
+
- name: Validate package metadata
|
|
40
|
+
run: python -m twine check dist/*
|
|
41
|
+
- name: Install built wheel in a clean virtual environment
|
|
42
|
+
run: |
|
|
43
|
+
python -m venv /tmp/figurelint-wheel
|
|
44
|
+
/tmp/figurelint-wheel/bin/python -m pip install dist/*.whl
|
|
45
|
+
/tmp/figurelint-wheel/bin/figurelint --help
|
|
46
|
+
/tmp/figurelint-wheel/bin/figurelint presets
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
action-smoke:
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/checkout@v4
|
|
54
|
+
- name: Run FigureLint as a local composite action
|
|
55
|
+
uses: ./
|
|
56
|
+
with:
|
|
57
|
+
path: examples/svg/before.svg
|
|
58
|
+
preset: default
|
|
59
|
+
strict: "false"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
name: Build release distributions
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
- name: Build wheel and source distribution
|
|
21
|
+
run: |
|
|
22
|
+
python -m pip install build
|
|
23
|
+
python -m build
|
|
24
|
+
- name: Upload distributions
|
|
25
|
+
uses: actions/upload-artifact@v4
|
|
26
|
+
with:
|
|
27
|
+
name: release-dists
|
|
28
|
+
path: dist/
|
|
29
|
+
|
|
30
|
+
publish:
|
|
31
|
+
name: Publish to PyPI
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
needs: build
|
|
34
|
+
|
|
35
|
+
environment:
|
|
36
|
+
name: pypi
|
|
37
|
+
url: https://pypi.org/project/figurelint/
|
|
38
|
+
|
|
39
|
+
permissions:
|
|
40
|
+
id-token: write
|
|
41
|
+
|
|
42
|
+
steps:
|
|
43
|
+
- name: Retrieve distributions
|
|
44
|
+
uses: actions/download-artifact@v5
|
|
45
|
+
with:
|
|
46
|
+
name: release-dists
|
|
47
|
+
path: dist/
|
|
48
|
+
- name: Publish distributions to PyPI
|
|
49
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to FigureLint will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project follows Semantic Versioning.
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
### Planned
|
|
10
|
+
- PDF font-size and vector stroke checks
|
|
11
|
+
- color accessibility checks
|
|
12
|
+
- stronger editable-text / outlined-text analysis
|
|
13
|
+
- additional source-verified publisher presets
|
|
14
|
+
|
|
15
|
+
## [0.1.0] - 2026-09-19
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- initial FigureLint command-line interface
|
|
19
|
+
- PNG and JPEG inspection
|
|
20
|
+
- unreadable image detection
|
|
21
|
+
- missing / low DPI warnings
|
|
22
|
+
- raster dimension and transparency checks
|
|
23
|
+
- JPEG lossy-format notice
|
|
24
|
+
- SVG file discovery and inspection
|
|
25
|
+
- malformed SVG detection
|
|
26
|
+
- editable-text detection
|
|
27
|
+
- configurable lower and upper SVG font-size checks
|
|
28
|
+
- configurable lower and upper SVG stroke-width checks
|
|
29
|
+
- simple embedded CSS, inline-style, and presentation-attribute resolution
|
|
30
|
+
- PDF file discovery and inspection
|
|
31
|
+
- malformed, encrypted, empty, and multi-page PDF checks
|
|
32
|
+
- PDF page-size guardrails
|
|
33
|
+
- PDF editable-text and font-embedding checks
|
|
34
|
+
- effective DPI checks for embedded PDF raster images
|
|
35
|
+
- PDF raster soft-mask / alpha detection
|
|
36
|
+
- recursive folder scanning
|
|
37
|
+
- strict mode and CI-friendly exit codes
|
|
38
|
+
- native GitHub Actions workflow annotations
|
|
39
|
+
- reusable composite GitHub Action with preset, strict-mode, and threshold inputs
|
|
40
|
+
- preset engine shared across raster, SVG, and PDF checks
|
|
41
|
+
- built-in convenience presets: `default`, `high-resolution`, `presentation`, and `journal-generic`
|
|
42
|
+
- source-verified `nature` preset with official provenance metadata
|
|
43
|
+
- Nature 5–7 pt ordinary SVG text range
|
|
44
|
+
- Nature 0.25–1 pt SVG stroke range
|
|
45
|
+
- conservative Nature multi-panel label recognition with 8 pt bold/upright validation
|
|
46
|
+
- Nature SVG font-family consistency and Arial/Helvetica preference guidance
|
|
47
|
+
- automated tests across Python 3.10, 3.11, and 3.12
|
|
48
|
+
- package build validation for wheel and source distributions
|
|
49
|
+
- PyPI Trusted Publishing workflow using GitHub Actions OIDC
|
|
50
|
+
- official black-cat visual identity and README demo assets
|
|
51
|
+
|
|
52
|
+
[Unreleased]: https://github.com/coocoomaomao/FigureLint/compare/v0.1.0...HEAD
|
|
53
|
+
[0.1.0]: https://github.com/coocoomaomao/FigureLint/releases/tag/v0.1.0
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Contributing to FigureLint
|
|
2
|
+
|
|
3
|
+
Thanks for helping improve FigureLint. Contributions from researchers, students, designers, and developers are welcome.
|
|
4
|
+
|
|
5
|
+
## Good first contributions
|
|
6
|
+
|
|
7
|
+
Useful beginner-friendly contributions include:
|
|
8
|
+
|
|
9
|
+
- adding test images for edge cases
|
|
10
|
+
- improving documentation
|
|
11
|
+
- reporting figure-export problems seen in real workflows
|
|
12
|
+
- proposing deterministic checks for SVG or PDF files
|
|
13
|
+
- improving accessibility and color-safety checks
|
|
14
|
+
|
|
15
|
+
## Development setup
|
|
16
|
+
|
|
17
|
+
~~~bash
|
|
18
|
+
git clone https://github.com/coocoomaomao/FigureLint.git
|
|
19
|
+
cd FigureLint
|
|
20
|
+
python -m venv .venv
|
|
21
|
+
pip install -e ".[dev]"
|
|
22
|
+
pytest
|
|
23
|
+
~~~
|
|
24
|
+
|
|
25
|
+
## Design principles
|
|
26
|
+
|
|
27
|
+
FigureLint should:
|
|
28
|
+
|
|
29
|
+
1. report verifiable technical properties
|
|
30
|
+
2. avoid pretending one journal rule fits every publication
|
|
31
|
+
3. keep thresholds configurable
|
|
32
|
+
4. explain warnings clearly
|
|
33
|
+
5. remain useful from both the CLI and CI
|
|
34
|
+
|
|
35
|
+
## Pull requests
|
|
36
|
+
|
|
37
|
+
Please keep pull requests focused. Add or update tests when behavior changes, and explain the problem the change is intended to solve.
|
|
38
|
+
|
|
39
|
+
## Issues
|
|
40
|
+
|
|
41
|
+
Bug reports and feature ideas are welcome. When possible, include the file format, export tool, expected behavior, and a minimal example.
|
|
42
|
+
|
|
43
|
+
## Brand
|
|
44
|
+
|
|
45
|
+
Please follow the project visual system documented in [docs/BRAND.md](docs/BRAND.md) when adding public-facing graphics.
|
figurelint-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 coocoomaomao
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: figurelint
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Lint academic figures before submission.
|
|
5
|
+
Project-URL: Homepage, https://github.com/coocoomaomao/FigureLint
|
|
6
|
+
Project-URL: Repository, https://github.com/coocoomaomao/FigureLint
|
|
7
|
+
Project-URL: Issues, https://github.com/coocoomaomao/FigureLint/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/coocoomaomao/FigureLint/blob/main/CHANGELOG.md
|
|
9
|
+
Author: coocoomaomao
|
|
10
|
+
License: MIT License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2026 coocoomaomao
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
|
31
|
+
License-File: LICENSE
|
|
32
|
+
Keywords: academic,figures,lint,pdf,publication,research,svg,visualization
|
|
33
|
+
Classifier: Development Status :: 3 - Alpha
|
|
34
|
+
Classifier: Environment :: Console
|
|
35
|
+
Classifier: Intended Audience :: Science/Research
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Operating System :: OS Independent
|
|
38
|
+
Classifier: Programming Language :: Python :: 3
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
42
|
+
Classifier: Topic :: Scientific/Engineering
|
|
43
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
44
|
+
Requires-Python: >=3.10
|
|
45
|
+
Requires-Dist: pillow>=10.3
|
|
46
|
+
Requires-Dist: pymupdf>=1.24
|
|
47
|
+
Requires-Dist: rich>=13.7
|
|
48
|
+
Requires-Dist: typer>=0.12
|
|
49
|
+
Provides-Extra: dev
|
|
50
|
+
Requires-Dist: pytest>=8.2; extra == 'dev'
|
|
51
|
+
Provides-Extra: release
|
|
52
|
+
Requires-Dist: build>=1.2; extra == 'release'
|
|
53
|
+
Requires-Dist: twine>=5.1; extra == 'release'
|
|
54
|
+
Description-Content-Type: text/markdown
|
|
55
|
+
|
|
56
|
+
<p align="center">
|
|
57
|
+
<img src="assets/figurelint-banner.svg" alt="FigureLint — ESLint for academic figures" width="100%">
|
|
58
|
+
</p>
|
|
59
|
+
|
|
60
|
+
<p align="center">
|
|
61
|
+
<a href="https://github.com/coocoomaomao/FigureLint/actions/workflows/ci.yml">
|
|
62
|
+
<img src="https://github.com/coocoomaomao/FigureLint/actions/workflows/ci.yml/badge.svg" alt="CI">
|
|
63
|
+
</a>
|
|
64
|
+
<img src="https://img.shields.io/badge/python-3.10%2B-blue" alt="Python 3.10+">
|
|
65
|
+
<img src="https://img.shields.io/badge/license-MIT-green" alt="MIT License">
|
|
66
|
+
<img src="https://img.shields.io/badge/status-alpha-orange" alt="Status Alpha">
|
|
67
|
+
</p>
|
|
68
|
+
|
|
69
|
+
> **ESLint for academic figures.**
|
|
70
|
+
|
|
71
|
+
**FigureLint** is an open-source linter for academic figures. It helps researchers and students catch common technical quality issues before submission.
|
|
72
|
+
|
|
73
|
+
## Why
|
|
74
|
+
|
|
75
|
+
A figure can look fine on screen and still cause trouble during submission or production: low effective resolution, missing DPI metadata, tiny raster dimensions, accidental transparency, text converted to outlines, tiny labels, or strokes that become too thin in print.
|
|
76
|
+
|
|
77
|
+
FigureLint turns those checks into a repeatable command.
|
|
78
|
+
|
|
79
|
+
## See it in action
|
|
80
|
+
|
|
81
|
+
<table>
|
|
82
|
+
<tr>
|
|
83
|
+
<th>Before — easy-to-miss problems</th>
|
|
84
|
+
<th>After — publication-safer export</th>
|
|
85
|
+
</tr>
|
|
86
|
+
<tr>
|
|
87
|
+
<td><img src="examples/svg/before.svg" alt="Problematic academic SVG example" width="100%"></td>
|
|
88
|
+
<td><img src="examples/svg/after.svg" alt="Improved academic SVG example" width="100%"></td>
|
|
89
|
+
</tr>
|
|
90
|
+
</table>
|
|
91
|
+
|
|
92
|
+
Run FigureLint on the deliberately problematic example:
|
|
93
|
+
|
|
94
|
+
~~~bash
|
|
95
|
+
figurelint check examples/svg/before.svg
|
|
96
|
+
~~~
|
|
97
|
+
|
|
98
|
+
Typical findings:
|
|
99
|
+
|
|
100
|
+
~~~text
|
|
101
|
+
warning SVG_FONT_SMALL
|
|
102
|
+
Found 5 text element(s) below 7 pt; smallest resolved size is 5.00 pt.
|
|
103
|
+
|
|
104
|
+
warning SVG_STROKE_THIN
|
|
105
|
+
Found 3 stroked element(s) below 0.5 pt; thinnest resolved stroke is 0.30 pt.
|
|
106
|
+
~~~
|
|
107
|
+
|
|
108
|
+
Now check the improved version:
|
|
109
|
+
|
|
110
|
+
~~~bash
|
|
111
|
+
figurelint check examples/svg/after.svg
|
|
112
|
+
~~~
|
|
113
|
+
|
|
114
|
+
It passes the current font-size and stroke-width checks with the default thresholds.
|
|
115
|
+
|
|
116
|
+
> The demo files are intentionally simple and fully editable so you can inspect exactly what FigureLint is measuring.
|
|
117
|
+
|
|
118
|
+
## Current checks
|
|
119
|
+
|
|
120
|
+
### PNG / JPEG
|
|
121
|
+
|
|
122
|
+
- unreadable/corrupt image files
|
|
123
|
+
- missing or low DPI metadata
|
|
124
|
+
- suspiciously small raster dimensions
|
|
125
|
+
- transparency that may need flattening for some workflows
|
|
126
|
+
- JPEG usage (informational, because it is lossy)
|
|
127
|
+
|
|
128
|
+
### SVG
|
|
129
|
+
|
|
130
|
+
- malformed/unreadable SVG files
|
|
131
|
+
- whether editable `<text>` elements are present
|
|
132
|
+
- suspiciously small or large resolvable font sizes
|
|
133
|
+
- suspiciously thin or thick resolvable strokes
|
|
134
|
+
- simple CSS resolution for tag, class, id, and `tag.class` selectors
|
|
135
|
+
- inline style and SVG presentation-attribute resolution
|
|
136
|
+
|
|
137
|
+
See [SVG inspection details and assumptions](docs/SVG_CHECKS.md).
|
|
138
|
+
|
|
139
|
+
### PDF
|
|
140
|
+
|
|
141
|
+
- malformed/unreadable and password-protected PDF detection
|
|
142
|
+
- multi-page figure warnings
|
|
143
|
+
- unusually small or large page-size warnings
|
|
144
|
+
- editable-text detection
|
|
145
|
+
- font embedding checks
|
|
146
|
+
- effective DPI checks for embedded raster images
|
|
147
|
+
- raster soft-mask / alpha-channel detection
|
|
148
|
+
|
|
149
|
+
See [PDF inspection details and assumptions](docs/PDF_CHECKS.md).
|
|
150
|
+
|
|
151
|
+
### Presets
|
|
152
|
+
|
|
153
|
+
FigureLint can apply named threshold profiles across raster, SVG, and PDF checks.
|
|
154
|
+
|
|
155
|
+
~~~bash
|
|
156
|
+
figurelint presets
|
|
157
|
+
figurelint check figure.svg --preset high-resolution
|
|
158
|
+
figurelint check figures/ --preset journal-generic
|
|
159
|
+
figurelint check figure.pdf --preset nature
|
|
160
|
+
~~~
|
|
161
|
+
|
|
162
|
+
Explicit threshold options override the selected preset, so you can start from a profile and change only one value.
|
|
163
|
+
|
|
164
|
+
Most built-in profiles are FigureLint convenience presets — **not publisher policies**. The `nature` profile is source-verified against Nature's official guidance and checks 5–7 pt ordinary SVG text, 8 pt bold upright panel labels, 0.25–1 pt SVG strokes, font-family consistency/preference, 300 dpi raster imagery, and a 247 mm PDF page-depth guardrail.
|
|
165
|
+
|
|
166
|
+
See [preset engine details](docs/PRESETS.md) and [Nature preset provenance](docs/NATURE.md).
|
|
167
|
+
|
|
168
|
+
### GitHub Actions
|
|
169
|
+
|
|
170
|
+
FigureLint can emit native GitHub workflow annotations and can be used as a reusable composite action.
|
|
171
|
+
|
|
172
|
+
~~~yaml
|
|
173
|
+
- uses: coocoomaomao/FigureLint@main
|
|
174
|
+
with:
|
|
175
|
+
path: figures/
|
|
176
|
+
preset: nature
|
|
177
|
+
strict: "true"
|
|
178
|
+
~~~
|
|
179
|
+
|
|
180
|
+
After the first tagged release, pin to `@v0.1.0` instead of `@main`.
|
|
181
|
+
|
|
182
|
+
See [GitHub Action usage](docs/GITHUB_ACTION.md).
|
|
183
|
+
|
|
184
|
+
### Workflow
|
|
185
|
+
|
|
186
|
+
- recursive folder scanning
|
|
187
|
+
- CI-friendly exit codes
|
|
188
|
+
- optional strict mode
|
|
189
|
+
- configurable thresholds and named presets
|
|
190
|
+
- native GitHub Actions annotations
|
|
191
|
+
|
|
192
|
+
Planned next:
|
|
193
|
+
|
|
194
|
+
- PDF font-size and vector stroke checks
|
|
195
|
+
- color contrast and color-blind safety
|
|
196
|
+
- stronger editable-text / outlined-text analysis
|
|
197
|
+
- additional source-verified publisher presets
|
|
198
|
+
|
|
199
|
+
## Install
|
|
200
|
+
|
|
201
|
+
Requires Python 3.10+.
|
|
202
|
+
|
|
203
|
+
### PyPI
|
|
204
|
+
|
|
205
|
+
The v0.1.0 release is prepared for PyPI Trusted Publishing. Once the first public release is published:
|
|
206
|
+
|
|
207
|
+
~~~bash
|
|
208
|
+
pip install figurelint
|
|
209
|
+
~~~
|
|
210
|
+
|
|
211
|
+
### From source
|
|
212
|
+
|
|
213
|
+
~~~bash
|
|
214
|
+
git clone https://github.com/coocoomaomao/FigureLint.git
|
|
215
|
+
cd FigureLint
|
|
216
|
+
python -m venv .venv
|
|
217
|
+
pip install -e .
|
|
218
|
+
~~~
|
|
219
|
+
|
|
220
|
+
For development:
|
|
221
|
+
|
|
222
|
+
~~~bash
|
|
223
|
+
pip install -e ".[dev]"
|
|
224
|
+
pytest
|
|
225
|
+
~~~
|
|
226
|
+
|
|
227
|
+
Maintainer release instructions are documented in [docs/PUBLISHING.md](docs/PUBLISHING.md).
|
|
228
|
+
|
|
229
|
+
## Usage
|
|
230
|
+
|
|
231
|
+
Check one figure:
|
|
232
|
+
|
|
233
|
+
~~~bash
|
|
234
|
+
figurelint check path/to/figure.svg
|
|
235
|
+
~~~
|
|
236
|
+
|
|
237
|
+
Check a whole folder:
|
|
238
|
+
|
|
239
|
+
~~~bash
|
|
240
|
+
figurelint check figures/
|
|
241
|
+
~~~
|
|
242
|
+
|
|
243
|
+
Use a preset:
|
|
244
|
+
|
|
245
|
+
~~~bash
|
|
246
|
+
figurelint check figures/ --preset high-resolution
|
|
247
|
+
figurelint check figure.pdf --preset nature
|
|
248
|
+
~~~
|
|
249
|
+
|
|
250
|
+
List available presets:
|
|
251
|
+
|
|
252
|
+
~~~bash
|
|
253
|
+
figurelint presets
|
|
254
|
+
~~~
|
|
255
|
+
|
|
256
|
+
Use stricter CI behavior so warnings fail the command:
|
|
257
|
+
|
|
258
|
+
~~~bash
|
|
259
|
+
figurelint check figures/ --strict
|
|
260
|
+
~~~
|
|
261
|
+
|
|
262
|
+
Emit native GitHub Actions annotations:
|
|
263
|
+
|
|
264
|
+
~~~bash
|
|
265
|
+
figurelint check figures/ --preset nature --github-annotations
|
|
266
|
+
~~~
|
|
267
|
+
|
|
268
|
+
Customize raster thresholds:
|
|
269
|
+
|
|
270
|
+
~~~bash
|
|
271
|
+
figurelint check figure.png --min-dpi 300 --min-short-side 600
|
|
272
|
+
~~~
|
|
273
|
+
|
|
274
|
+
Customize SVG thresholds:
|
|
275
|
+
|
|
276
|
+
~~~bash
|
|
277
|
+
figurelint check figure.svg \
|
|
278
|
+
--min-font-size-pt 5 \
|
|
279
|
+
--max-font-size-pt 7 \
|
|
280
|
+
--min-stroke-width-pt 0.25 \
|
|
281
|
+
--max-stroke-width-pt 1
|
|
282
|
+
~~~
|
|
283
|
+
|
|
284
|
+
Check a PDF figure:
|
|
285
|
+
|
|
286
|
+
~~~bash
|
|
287
|
+
figurelint check figure.pdf
|
|
288
|
+
~~~
|
|
289
|
+
|
|
290
|
+
Customize PDF page-size guardrails:
|
|
291
|
+
|
|
292
|
+
~~~bash
|
|
293
|
+
figurelint check figure.pdf --min-pdf-short-side-in 1 --max-pdf-long-side-in 20
|
|
294
|
+
~~~
|
|
295
|
+
|
|
296
|
+
The existing `--min-dpi` option is also used for embedded raster images inside PDFs.
|
|
297
|
+
|
|
298
|
+
Example output:
|
|
299
|
+
|
|
300
|
+
~~~text
|
|
301
|
+
┏━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
|
|
302
|
+
┃ File ┃ Severity ┃ Code ┃ Message ┃
|
|
303
|
+
┡━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩
|
|
304
|
+
│ figure.svg │ warning │ SVG_FONT_SMALL │ Found text below 7 pt. │
|
|
305
|
+
└────────────┴──────────┴─────────────────┴──────────────────────────────┘
|
|
306
|
+
~~~
|
|
307
|
+
|
|
308
|
+
## Exit codes
|
|
309
|
+
|
|
310
|
+
- `0`: no errors; warnings are allowed unless `--strict` is used
|
|
311
|
+
- `1`: warnings found in strict mode
|
|
312
|
+
- `2`: one or more errors were found
|
|
313
|
+
|
|
314
|
+
## Brand assets
|
|
315
|
+
|
|
316
|
+
The official FigureLint visual system uses a **black cat + magnifying glass + check mark** in navy, teal, orange, and soft gray.
|
|
317
|
+
|
|
318
|
+
- [README banner](assets/figurelint-banner.svg)
|
|
319
|
+
- [Primary logo](assets/figurelint-logo.svg)
|
|
320
|
+
- [Icon / favicon source](assets/figurelint-icon.svg)
|
|
321
|
+
- [Dark-background logo](assets/figurelint-logo-dark.svg)
|
|
322
|
+
- [Social preview artwork](assets/figurelint-social-preview.svg)
|
|
323
|
+
- [Brand guide](docs/BRAND.md)
|
|
324
|
+
|
|
325
|
+
## Philosophy
|
|
326
|
+
|
|
327
|
+
FigureLint should flag **verifiable technical properties**, not pretend that every journal has the same rules. Thresholds are configurable, and future journal presets will be documented with their source guidelines.
|
|
328
|
+
|
|
329
|
+
## Release
|
|
330
|
+
|
|
331
|
+
The first public release is **v0.1.0**. See the [v0.1.0 release notes](docs/releases/v0.1.0.md).
|
|
332
|
+
|
|
333
|
+
## Contributing
|
|
334
|
+
|
|
335
|
+
Ideas, bug reports, and pull requests are welcome. The first milestones are tracked in GitHub Issues.
|
|
336
|
+
|
|
337
|
+
## License
|
|
338
|
+
|
|
339
|
+
MIT
|