Skip to content

Commit 5f1b898

Browse files
authored
Merge pull request #241 from best-practice-and-impact/dev
Updates for v1.2.0
2 parents 3cc3a19 + 33c918b commit 5f1b898

Some content is hidden

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

49 files changed

+2223
-2015
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: [3.8]
18+
python-version: ['3.11']
1919

2020
steps:
2121
- uses: actions/checkout@v2
@@ -38,7 +38,7 @@ jobs:
3838
if: github.repository == 'best-practice-impact/gptables'
3939
uses: codecov/codecov-action@v3
4040
with:
41-
name: gptables-pytests-py3.8
41+
name: gptables-pytests-py3.11
4242
flags: pytests
4343
file: ./coverage.xml
4444
fail_ci_if_error: true
@@ -49,7 +49,8 @@ jobs:
4949
runs-on: ubuntu-latest
5050
strategy:
5151
matrix:
52-
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
52+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
53+
5354

5455
steps:
5556
- uses: actions/checkout@v2
@@ -71,7 +72,8 @@ jobs:
7172
runs-on: windows-latest
7273
strategy:
7374
matrix:
74-
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
75+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
76+
7577

7678
steps:
7779
- uses: actions/checkout@v2
@@ -99,10 +101,10 @@ jobs:
99101

100102
steps:
101103
- uses: actions/checkout@v2
102-
- name: Set up Python 3.7
104+
- name: Set up Python 3.11
103105
uses: actions/setup-python@v2
104106
with:
105-
python-version: 3.7
107+
python-version: '3.11'
106108
- uses: actions/cache@v2
107109
with:
108110
path: ~\AppData\Local\pip\Cache
@@ -126,10 +128,10 @@ jobs:
126128
steps:
127129
- name: Checkout source
128130
uses: actions/checkout@v2
129-
- name: Set up Python 3.7
131+
- name: Set up Python 3.11
130132
uses: actions/setup-python@v1
131133
with:
132-
python-version: 3.7
134+
python-version: '3.11'
133135
- name: Build package
134136
run: |
135137
pip install wheel

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ env/
55
*.pyc
66
*~lock*
77
docs/build/**
8-
gptables/examples/*.xlsx
8+
gptables/examples/*.xlsx
9+
.vscode/

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"python.testing.pytestArgs": [
3+
"gptables"
4+
],
5+
"python.testing.unittestEnabled": false,
6+
"python.testing.pytestEnabled": true
7+
}

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,6 @@ machine-readable CSV-W files.
5050
4. Optionally upload a ``notes_table`` with information about any notes.
5151

5252
5. You ``write_workbook`` to win.
53+
54+
55+
**Note**: This package is not intending to create perfectly accessible spreadsheets but will help with the bulk of the work needed. Users of this packages should refer back to the `main spreadsheet guidance <https://analysisfunction.civilservice.gov.uk/policy-store/releasing-statistics-in-spreadsheets/>`_ or the `spreadsheet accessibility checklist <https://analysisfunction.civilservice.gov.uk/policy-store/making-spreadsheets-accessible-a-brief-checklist-of-the-basics/>`_ after using it to make sure nothing has been missed. Please email `[email protected] <mailto:[email protected]>`_ if you use the package so we can monitor use and the outputs produced.

docs/source/changelog.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,33 @@ Unreleased
1919
Released (PyPI)
2020
===============
2121

22+
v1.2.0
23+
------
24+
:Date: 2024-12-05
25+
26+
**Added**
27+
28+
* Column width customisation to cover sheet
29+
* Incorporated rich text functionaliy into the cover page by using List[dict, str] to format text in the intro, about, and contact sections.
30+
* Rich text format lists can now be of length 2.
31+
* gptables now supports python 3.11
32+
* Official disclaimer included at the bottom of the README and PyPI index
33+
* pyproject.toml is now used to manage the packaging
34+
* Bugfix to allow writing of tables containing only integers
35+
* New examples to more simply explain things to new users
36+
* Update documentation for additional formatting
37+
38+
**Removed**
39+
40+
* CI for Python 3.6 on Linux, as no longer supported by GitHub action ``setup-python``
41+
* Dataclasses as a dependency due to no longer supporting Python 3.6
42+
* setup.py as this has been replaced by the more modern pyproject.toml
43+
44+
**Changed**
45+
46+
* Default theme now includes cover sheet text wrapping set to True
47+
48+
2249
v1.1.0
2350
------
2451
:Date: 2022-07-27

docs/source/doc.gptable.rst

Lines changed: 174 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ formatting of that element specified in the :class:`~.core.theme.Theme`.
6969

7070
.. _`XlsxWriter format properties`: https://xlsxwriter.readthedocs.io/format.html#format-methods-and-format-properties
7171

72-
``["It is ", {"bold": True}, "inevitable"]`` would give you "It is *inevitable*".
72+
``["It is ", {"bold": True}, "inevitable"]`` would give you "It is **inevitable**".
7373

7474
See this in practice under :ref:`Example Usage`.
7575

@@ -135,6 +135,179 @@ This ``additional_formatting`` parameter is best demonstrated by example:
135135
}
136136
]
137137
138+
Formatting methods
139+
^^^^^
140+
141+
The following tables show the Excel format categories, along with an example demonstrating the syntax required
142+
for use in gptables. Some formatting methods use indexing to map to Excel's built-in formats. This information
143+
can be found in the applicable sections below.
144+
145+
^^^^
146+
Font formatting
147+
^^^^
148+
149+
This table demonstrates the font formatting methods available. You can find all options
150+
for `underline styles in the XlsxWriter documentation`_.
151+
152+
.. _`underline styles in the XlsxWriter documentation`: https://xlsxwriter.readthedocs.io/format.html#format-set-underline
153+
154+
.. list-table::
155+
:header-rows: 1
156+
:widths: 19 30
157+
:align: left
158+
159+
* - Description
160+
- Example usage
161+
* - Font type
162+
- {"font_name": "Arial"}
163+
* - Font size
164+
- {"font_size": 30}
165+
* - Font colour
166+
- {"font_color": "red"}
167+
* - Bold
168+
- {"bold": True}
169+
* - Italic
170+
- {"italic": True}
171+
* - Underline
172+
- {"underline": 1}
173+
* - Strikeout
174+
- {"font_strikeout": True}
175+
* - Super/Subscript
176+
- | {"font_script": 1} # Superscript
177+
| {"font_script": 2} # Subscript
178+
..
179+
^^^^^^
180+
Number formatting
181+
^^^^^^
182+
183+
This table demonstrates how to set the numeric format using indexing and string arguments. You can find all
184+
options for `numeric formats in the XlsxWriter documentation`_.
185+
186+
.. _`numeric formats in the XlsxWriter documentation`: https://xlsxwriter.readthedocs.io/format.html#format-set-num-format
187+
188+
.. list-table::
189+
:header-rows: 1
190+
:widths: 19 30
191+
:align: left
192+
193+
* - Description
194+
- Example usage
195+
* - Numeric format
196+
- | {"num_format": 1} # Format index
197+
| {"num_format": "d mmm yyyy"} # Format string
198+
..
199+
200+
^^^^^^^^^^^
201+
Protection formatting
202+
^^^^^^^^^^^
203+
204+
This table demonstrates the protection methods available.
205+
206+
.. list-table::
207+
:header-rows: 1
208+
:widths: 19 30
209+
:align: left
210+
211+
* - Description
212+
- Example usage
213+
* - Lock cells
214+
- {"locked": True}
215+
* - Hide formulas
216+
- {"hidden": True}
217+
..
218+
219+
^^^^^^^^^^^^
220+
Alignment formatting
221+
^^^^^^^^^^^^
222+
223+
This table demonstrates the alignment formatting options available. You can find all options for
224+
`horizontal and vertical alignment in the XlsxWriter documentation`_.
225+
226+
.. _`horizontal and vertical alignment in the XlsxWriter documentation`: https://xlsxwriter.readthedocs.io/format.html#format-set-align
227+
228+
.. list-table::
229+
:header-rows: 1
230+
:widths: 19 30
231+
:align: left
232+
233+
* - Description
234+
- Example usage
235+
* - Horizontal align
236+
- {"align": "center"}
237+
* - Vertical align
238+
- {"align": "vcenter"}
239+
* - Rotation
240+
- {"rotation": 30}
241+
* - Text wrap
242+
- {"text_wrap": True}
243+
* - Center across
244+
- {"set_center_across": True}
245+
* - Indentation
246+
- {"indentation":2}
247+
* - Shrink to fit
248+
- {"shrink": True}
249+
..
250+
251+
^^^^^^^^^^^^^^^^
252+
Pattern formatting
253+
^^^^^^^^^^^^^^^^
254+
255+
This table demonstrates the pattern formatting options available.
256+
257+
.. list-table::
258+
:header-rows: 1
259+
:widths: 19 30
260+
:align: left
261+
262+
* - Description
263+
- Example usage
264+
* - Cell pattern
265+
- {"pattern": 1}
266+
* - Background colour
267+
- {"bg_color": "white"}
268+
* - Foreground colour
269+
- {"fg_color": "white"}
270+
..
271+
272+
^^^^^^^^^^^^^^^^^^
273+
Border formatting
274+
^^^^^^^^^^^^^^^^^^
275+
276+
This table demonstrates the border formatting options available. You can find all options
277+
for `border styles in the XlsxWriter documentation`_.
278+
279+
.. _`border styles in the XlsxWriter documentation`: https://xlsxwriter.readthedocs.io/format.html#format-set-border
280+
281+
.. list-table::
282+
:header-rows: 1
283+
:widths: 19 30
284+
:align: left
285+
286+
* - Description
287+
- Example usage
288+
* - Cell border
289+
- {"border": 1}
290+
* - Bottom border
291+
- {"bottom": 1}
292+
* - Top border
293+
- {"top": 1}
294+
* - Left border
295+
- {"left": 1}
296+
* - Right border
297+
- {"right": 1}
298+
* - Border colour
299+
- {"border_color": "red"}
300+
* - Bottom colour
301+
- {"bottom_color":"#FF0000"}
302+
* - Top colour
303+
- {"top_color": "red"}
304+
* - Left colour
305+
- {"left_color": "#FF0000"}
306+
* - Right colour
307+
- {"right_color": "red"}
308+
309+
..
310+
138311
For any formatting beyond this, if the package should support it then please raise an issue
139312
or create a pull request. Otherwise, you will need to modify the underlying
140313
:class:`~.core.wrappers.GPWorkbook` or :class:`~.core.wrappers.GPWorksheet` objects

docs/source/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ machine-readable CSV-W files.
5656
5. You :func:`~.core.api.write_workbook` to win.
5757

5858

59+
**Note**: This package is not intending to create perfectly accessible spreadsheets but will help with the bulk of the work needed. Users of this packages should refer back to the `main spreadsheet guidance <https://analysisfunction.civilservice.gov.uk/policy-store/releasing-statistics-in-spreadsheets/>`_ or the `spreadsheet accessibility checklist <https://analysisfunction.civilservice.gov.uk/policy-store/making-spreadsheets-accessible-a-brief-checklist-of-the-basics/>`_ after using it to make sure nothing has been missed. Please email `[email protected] <mailto:[email protected]>`_ if you use the package so we can monitor use and the outputs produced.
60+
61+
5962
.. toctree::
6063
:maxdepth: 2
6164
:hidden:

0 commit comments

Comments
 (0)