Skip to content

Commit b1f4e3f

Browse files
authored
Initial commit
0 parents  commit b1f4e3f

34 files changed

+1541
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags:
7+
- "v[0-9]+.[0-9]+.[0-9]+*"
8+
pull_request:
9+
10+
jobs:
11+
12+
tests:
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ["3.7", "3.8", "3.9", "3.10"]
18+
os: [ubuntu-latest]
19+
include:
20+
- os: windows-latest
21+
python-version: "3.8"
22+
23+
runs-on: ${{ matrix.os }}
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v1
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install -e .[testing]
35+
- name: Run pytest
36+
run: pytest --cov=src --cov-report=xml --cov-report=term-missing
37+
- name: Upload coverage to Codecov
38+
uses: codecov/codecov-action@v3

.gitignore

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
105+
__pypackages__/
106+
107+
# Celery stuff
108+
celerybeat-schedule
109+
celerybeat.pid
110+
111+
# SageMath parsed files
112+
*.sage.py
113+
114+
# Environments
115+
.env
116+
.venv
117+
env/
118+
venv/
119+
ENV/
120+
env.bak/
121+
venv.bak/
122+
123+
# Spyder project settings
124+
.spyderproject
125+
.spyproject
126+
127+
# Rope project settings
128+
.ropeproject
129+
130+
# mkdocs documentation
131+
/site
132+
133+
# mypy
134+
.mypy_cache/
135+
.dmypy.json
136+
dmypy.json
137+
138+
# Pyre type checker
139+
.pyre/
140+
141+
# pytype static type analyzer
142+
.pytype/
143+
144+
# Cython debug symbols
145+
cython_debug/
146+
147+
# PyCharm
148+
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
149+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
150+
# and can be added to the global gitignore or merged into this file. For a more nuclear
151+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
152+
#.idea/
153+
154+
.vscode/

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v4.3.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
11+
- repo: https://github.com/asottile/pyupgrade
12+
rev: v3.2.0
13+
hooks:
14+
- id: pyupgrade
15+
args: [--py37-plus]
16+
17+
- repo: https://github.com/PyCQA/isort
18+
rev: 5.10.1
19+
hooks:
20+
- id: isort
21+
22+
- repo: https://github.com/psf/black
23+
rev: 22.10.0
24+
hooks:
25+
- id: black
26+
27+
- repo: https://github.com/PyCQA/flake8
28+
rev: 5.0.4
29+
hooks:
30+
- id: flake8
31+
additional_dependencies:
32+
- flake8-comprehensions
33+
- flake8-bugbear

.readthedocs.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
3+
python:
4+
version: "3.8"
5+
install:
6+
- method: pip
7+
path: .
8+
extra_requirements:
9+
- docs
10+
11+
sphinx:
12+
builder: html
13+
fail_on_warning: true
14+
15+
# Also build PDF & ePub
16+
formats:
17+
- epub
18+
- pdf

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"files.exclude": {
3+
"**/.git": true,
4+
"**/.svn": true,
5+
"**/.hg": true,
6+
"**/CVS": true,
7+
"**/.DS_Store": true,
8+
"**/Thumbs.db": true,
9+
"**/__pycache__": true,
10+
}
11+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Chris Sewell
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.

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# sphinx-subfigure
2+
3+
[![PyPI][pypi-badge]][pypi-link]
4+
5+
A [sphinx](https://www.sphinx-doc.org) extension to create figures with multiple images:
6+
7+
- Provides a simple format for complex image layouts.
8+
- Supports HTML fully, with responsive layouts, for different screen sizes
9+
- LaTeX is supported, except for images that span multiple rows.
10+
- degrades gracefully for other formats.
11+
- Supports figure numbering and referencing.
12+
- Supports image sub-captions, via `alt` text.
13+
14+
## Usage
15+
16+
Install `sphinx-subfigure` with `pip install sphinx-subfigure`,
17+
then add `sphinx_subfigure` to your `conf.py` file's `extensions` variable:
18+
19+
```python
20+
extensions = ["sphinx_subfigure"]
21+
22+
numfig = True # optional
23+
```
24+
25+
Now add a `subfigure` directive to your document:
26+
27+
```restructuredtext
28+
.. subfigure:: AA|BC
29+
:layout-sm: A|B|C
30+
:subcaptions: above
31+
:name: myfigure
32+
:class-grid: outline
33+
34+
.. image:: imageA.png
35+
:alt: Image A
36+
37+
.. image:: imageB.png
38+
:alt: Image B
39+
40+
.. image:: imageC.png
41+
:alt: Image C
42+
43+
Figure Caption
44+
```
45+
46+
1. Each image is automatically assigned an *area identifier* (A, B, C, etc.).
47+
2. Layouts are formed by composing the areas into a grid, with rows delimited by `|`.
48+
3. Each area must be used exactly once in the layout, and form a single rectangle.
49+
4. "Empty" areas can be designated with `.`
50+
5. Additional layouts can be defined with `:layout-sm:`, `:layout-lg:`, `:layout-xl:`, for different screen sizes (HTML only).
51+
52+
![Responsive sub-figure](subfigure-responsive.gif)
53+
54+
[pypi-badge]: https://img.shields.io/pypi/v/sphinx_subfigure.svg
55+
[pypi-link]: https://pypi.org/project/sphinx_subfigure

codecov.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: 80%
6+
threshold: 0.5%
7+
patch:
8+
default:
9+
target: 75%
10+
threshold: 0.5%

docs/_static/A.png

16 KB
Loading

0 commit comments

Comments
 (0)