Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Replace version tables with RST csv-table and add 3.11 #6433

Merged
merged 4 commits into from Jul 18, 2022

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Jul 13, 2022

The existing version support tables at https://pillow.readthedocs.io/en/stable/installation.html#python-support are a bit time consuming to edit when adding a new version, for example 3.11:

+----------------------+-----+-----+-----+-----+-----+-----+-----+-----+
|        Python        |3.10 | 3.9 | 3.8 | 3.7 | 3.6 | 3.5 | 3.4 | 2.7 |
+======================+=====+=====+=====+=====+=====+=====+=====+=====+
| Pillow >= 9.0        | Yes | Yes | Yes | Yes |     |     |     |     |
+----------------------+-----+-----+-----+-----+-----+-----+-----+-----+
| Pillow 8.3.2 - 8.4   | Yes | Yes | Yes | Yes | Yes |     |     |     |
+----------------------+-----+-----+-----+-----+-----+-----+-----+-----+
| Pillow 8.0 - 8.3.1   |     | Yes | Yes | Yes | Yes |     |     |     |
+----------------------+-----+-----+-----+-----+-----+-----+-----+-----+
| Pillow 7.0 - 7.2     |     |     | Yes | Yes | Yes | Yes |     |     |
+----------------------+-----+-----+-----+-----+-----+-----+-----+-----+
| Pillow 6.2.1 - 6.2.2 |     |     | Yes | Yes | Yes | Yes |     | Yes |
+----------------------+-----+-----+-----+-----+-----+-----+-----+-----+
| Pillow 6.0 - 6.2.0   |     |     |     | Yes | Yes | Yes |     | Yes |
+----------------------+-----+-----+-----+-----+-----+-----+-----+-----+
| Pillow 5.2 - 5.4     |     |     |     | Yes | Yes | Yes | Yes | Yes |
+----------------------+-----+-----+-----+-----+-----+-----+-----+-----+

+------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+
|      Python      | 3.6 | 3.5 | 3.4 | 3.3 | 3.2 | 2.7 | 2.6 | 2.5 | 2.4 |
+==================+=====+=====+=====+=====+=====+=====+=====+=====+=====+
| Pillow 5.0 - 5.1 | Yes | Yes | Yes |     |     | Yes |     |     |     |
+------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| Pillow 4         | Yes | Yes | Yes | Yes |     | Yes |     |     |     |
+------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| Pillow 2 - 3     |     | Yes | Yes | Yes | Yes | Yes | Yes |     |     |
+------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+
| Pillow < 2       |     |     |     |     |     | Yes | Yes | Yes | Yes |
+------------------+-----+-----+-----+-----+-----+-----+-----+-----+-----+

image

One option would be to flip it so higher Python versions are on the right. But it still needs a bunch of character dancing, and would also be a bit tricky to edit when rebalancing the two tables - moving some rows from the top table to the bottom table.

CSV table

Another option is to the .. csv-table:: directive.

Docs:

We can then put CSV directly in the RST file, which means there's fewer structure characters that need juggling. For example (and using the comma to help display it more like a table when editing RST):

.. csv-table:: Newer versions [table]
   :widths: auto
   :header: Python               , 3.11, 3.10, 3.9 , 3.8 , 3.7 , 3.6 , 3.5 , 3.4 , 2.7

            Pillow >= 9.3        , Yes , Yes , Yes , Yes , Yes ,     ,     ,     ,
            Pillow 9.0 - 9.2     ,     , Yes , Yes , Yes , Yes ,     ,     ,     ,
            Pillow 8.3.2 - 8.4   ,     , Yes , Yes , Yes , Yes , Yes ,     ,     ,
            Pillow 8.0 - 8.3.1   ,     ,     , Yes , Yes , Yes , Yes ,     ,     ,
            Pillow 7.0 - 7.2     ,     ,     ,     , Yes , Yes , Yes , Yes ,     ,
            Pillow 6.2.1 - 6.2.2 ,     ,     ,     , Yes , Yes , Yes , Yes ,     , Yes
            Pillow 6.0 - 6.2.0   ,     ,     ,     ,     , Yes , Yes , Yes ,     , Yes
            Pillow 5.2 - 5.4     ,     ,     ,     ,     , Yes , Yes , Yes , Yes , Yes

.. csv-table:: Older versions [table]
   :widths: auto
   :header: Python           , 3.6 , 3.5 , 3.4 , 3.3 , 3.2 , 2.7 , 2.6 , 2.5 , 2.4

            Pillow 5.0 - 5.1 , Yes , Yes , Yes ,     ,     , Yes ,     ,     ,
            Pillow 4         , Yes , Yes , Yes , Yes ,     , Yes ,     ,     ,
            Pillow 2 - 3     ,     , Yes , Yes , Yes , Yes , Yes , Yes ,     ,
            Pillow < 2       ,     ,     ,     ,     ,     , Yes , Yes , Yes , Yes

image

This is still a bit of a pain to edit.

CSV file

Or we can load them directly from CSV files:

.. csv-table:: Newer versions [CSV file]
   :file: newer-versions.csv
   :header-rows: 1
   :widths: auto

.. csv-table:: Older versions [CSV file]
   :file: older-versions.csv
   :header-rows: 1
   :widths: auto
Python,"3.10",3.9,3.8,3.7,3.6,3.5,3.4,2.7
Pillow >= 9.0,Yes,Yes,Yes,Yes,,,,
Pillow 8.3.2 - 8.4,Yes,Yes,Yes,Yes,Yes,,,
Pillow 8.0 - 8.3.1,,Yes,Yes,Yes,Yes,,,
Pillow 7.0 - 7.2,,,Yes,Yes,Yes,Yes,,
Pillow 6.2.1 - 6.2.2,,,Yes,Yes,Yes,Yes,,Yes
Pillow 6.0 - 6.2.0,,,,Yes,Yes,Yes,,Yes
Pillow 5.2 - 5.4,,,,Yes,Yes,Yes,Yes,Yes
Python,3.6,3.5,3.4,3.3,3.2,2.7,2.6,2.5,2.4
Pillow 5.0 - 5.1,Yes,Yes,Yes,,,Yes,,,
Pillow 4,Yes,Yes,Yes,Yes,,Yes,,,
Pillow 2 - 3,,Yes,Yes,Yes,Yes,Yes,Yes,,
Pillow < 2,,,,,,Yes,Yes,Yes,Yes

image

Then it's pretty easy to edit the CSV files in a spreadsheet.

One thing we'd need to watch out for: when opening newer-versions.csv, Excel has an annoying habit of converting 3.10 to 3.1, even if it's in the CSV as "3.10" or '3.10.

Putting this as a draft to compare the different options. Will delete the [CSV file]/[table] bits as well, they're just for visibility during testing.

These CSV tables are also render more compactly than the original, which is a nice plus.

Shall we switch to one of these?

@hugovk
Copy link
Member Author

hugovk commented Jul 13, 2022

Demo: https://pillow--6433.org.readthedocs.build/en/6433/installation.html#python-support

Note "Newer versions [table]" also has 3.11. I left that in by accident when testing out, will remove it from the final PR.

@radarhere
Copy link
Member

My suggestion would be a mix of the two, as the inline version still works without spaces. This would avoid the separate CSV files, while still keeping the easy of editing - radarhere@395469d / https://pillow-radarhere.readthedocs.io/en/docs-csv-table/installation.html#python-support

@hugovk
Copy link
Member Author

hugovk commented Jul 13, 2022

Yep, it also works without spaces. I think the spaces help make sure the raw text match the output, to make it easier to edit and see you're making the right changes.

But my idea for using separate CSV files is they can be much more easily manipulated using a spreadsheet program to make it easier to add/move rows, and between tables as well if necessary.

@radarhere
Copy link
Member

Ok. I would personally still just edit the raw text anyway, but it is easier for others, then sure.

@hugovk
Copy link
Member Author

hugovk commented Jul 15, 2022

Thanks, updated to use CSV files.

I also added Python 3.11 for Pillow >= 9.3, and then rebalanced the tables so 2.7 support is only in the older table.

Before

image

After

image

@hugovk hugovk marked this pull request as ready for review July 15, 2022 08:28
@hugovk hugovk changed the title Docs: Replace version tables with RST csv-table Docs: Replace version tables with RST csv-table and add 3.1 Jul 15, 2022
@hugovk hugovk changed the title Docs: Replace version tables with RST csv-table and add 3.1 Docs: Replace version tables with RST csv-table and add 3.11 Jul 15, 2022
@hugovk hugovk added this to the 9.3.0 milestone Jul 15, 2022
docs/installation.rst Outdated Show resolved Hide resolved
Co-authored-by: Andrew Murray <3112309+radarhere@users.noreply.github.com>
@radarhere radarhere merged commit f5af251 into python-pillow:main Jul 18, 2022
@hugovk hugovk deleted the docs-csv-table branch July 19, 2022 04:11
@hugovk hugovk mentioned this pull request Sep 13, 2022
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants