Skip to content

docs: flip TOML and envvars order #2389

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

henryiii
Copy link
Contributor

To start, I've asked Copilot for a script to flip the order of the tabs. It gave me this one:

import re

# filepath: /Users/henryschreiner/git/software/cibuildwheel/docs/options.md
file_path = "/Users/henryschreiner/git/software/cibuildwheel/docs/options.md"

# Regular expression to match the examples section
example_pattern = re.compile(
    r"(!!! tab examples \"Environment variables\".*?```.*?```.*?)"
    r"(!!! tab examples \"pyproject\.toml\".*?```.*?```.*?)",
    re.DOTALL
)

def flip_examples(file_path):
    with open(file_path, "r") as file:
        content = file.read()

    # Swap the order of the examples
    updated_content = example_pattern.sub(r"\2\n\n\1", content)

    with open(file_path, "w") as file:
        file.write(updated_content)

    print("Examples flipped successfully!")

# Run the function
flip_examples(file_path)

This commit is the result of that.


Next I'd like to update the headings so that both options are shown. I'd like to put one on the left, the other on the right, but not sure how to do that yet. Putting this here for now.

@joerick
Copy link
Contributor

joerick commented May 16, 2025

I added some code to make little tags like this on each option

image

They work by adding attributes using markdown attribute list syntax, like so:

### `archs` {: #archs cmd-line env-var toml }

@joerick
Copy link
Contributor

joerick commented May 16, 2025

But, I did notice a problem with the result of the swapping code, it seems that some of the tabs got out-of-sync in the swap - here the examples for project-requires-python and enable got mixed up.

Screen Recording 2025-05-16 at 6 54 35 pm

@henryiii
Copy link
Contributor Author

I was secretly hoping you would jump in and fix this, though this is even better than what I was imagining. :)

@joerick
Copy link
Contributor

joerick commented May 16, 2025

I've only flipped the titles and added attrs for the first few headings, but thought I'd push where I was up to.

@henryiii
Copy link
Contributor Author

henryiii commented May 16, 2025

I can fix this if you want, but at PyCon, so might not be soon. (Probably tonight Sunday night or next week)

@henryiii henryiii force-pushed the henryiii/docs/tomlfirst branch from 5b0f5dc to b28501a Compare May 18, 2025 19:42
@henryiii henryiii marked this pull request as ready for review May 19, 2025 01:48
@henryiii henryiii marked this pull request as draft May 19, 2025 01:51
@henryiii henryiii force-pushed the henryiii/docs/tomlfirst branch from b28501a to f89f68a Compare May 19, 2025 02:31
@henryiii henryiii marked this pull request as ready for review May 19, 2025 02:31
@henryiii
Copy link
Contributor Author

Fixed a few small things too, like the old mention of numpy needing to be old (not true since some 2.x version), and the text on enable.

@henryiii henryiii force-pushed the henryiii/docs/tomlfirst branch from f89f68a to 5cca163 Compare May 19, 2025 03:04
@henryiii
Copy link
Contributor Author

The table at the top seems to be picking up the last section and sections, though they aren't options. It's kind of handy, but noticed the current docs don't do that.

@henryiii henryiii force-pushed the henryiii/docs/tomlfirst branch from 5cca163 to f001060 Compare May 20, 2025 19:13
@henryiii henryiii force-pushed the henryiii/docs/tomlfirst branch from f001060 to 1365071 Compare May 20, 2025 21:09
@henryiii
Copy link
Contributor Author

By the way, the badges align a little strangely when the window is narrow. Not terrible.

I think this is ready.

@joerick
Copy link
Contributor

joerick commented May 21, 2025

By the way, the badges align a little strangely when the window is narrow. Not terrible.

Yeah, I noticed that too. I can fix it when I get half an hour to play in detail.

Co-authored-by: Matthieu Darbois <[email protected]>
@joerick
Copy link
Contributor

joerick commented May 21, 2025

A few things I noticed when looking though just now. Most are styling-related, which I can deal with.

image
  • the two ALL_CAPS options jump out like a sore thumb, I think we should just normalise the header naming to kebab-case, the badge handles the specifics
  • The sidebar TOC is missing a few sections
image
  • This formatting of 'command-line' section in the top-of-page TOC is a bit janky
image
  • this formatting of badges is odd due to the use of float. I'll switch to a flexbox container.
image
  • the env var badge for this entry is missing a CIBW_

(while i'm at it)

image
  • this table (build+skip) formatting is terrible with the line-breaks inside each identifier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants