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

Use tabs to display commands in macOS or Windows #1196

Closed
7 tasks done
Mariatta opened this issue Oct 17, 2023 · 11 comments
Closed
7 tasks done

Use tabs to display commands in macOS or Windows #1196

Mariatta opened this issue Oct 17, 2023 · 11 comments

Comments

@Mariatta
Copy link
Member Author

I guess this is a feature of a sphinx extension.
Regardless whether it's Furo or a Sphinx extension, I think we should make use of the feature, and I identified a few places where Tabs could be used (and there might be more)

There are different commands for the different environments ie Linux, mac, etc.

The commands for macOS vs Windows can be contained in Tabs.

It has instructions for windows, macOs, Unix.

There's a different command for windows vs macos/unix.

@Mariatta
Copy link
Member Author

Mariatta commented Oct 19, 2023

It was suggested on Discord that we use the sphinx-inline-tabs extension for this.

@pradyunsg
Copy link
Member

Corresponding documentation: https://sphinx-inline-tabs.readthedocs.io/en/latest/

@lancegoyke
Copy link
Contributor

I was playing around with this today and have some notes to share.

Todo

Another location where tabs could be used:

Testing environments

I'm unclear on the different commands + environment cases when running the tests. It appears there are three suitable commands:

  1. ./python
  2. ./python.exe
  3. ./python.bat

On what systems should the user run the ./python command?

The proof of concept below shows two tabs: Windows and Unix/Linux/macOS. It sounds like we will need a third tab to describe the ./python command for testing.

Does anyone have more knowledge on this than myself?

Proof of concept

Here's a proof of concept, from the devguide/index.rst file:

Quick reference
---------------

Here are the basic steps needed to get set up and contribute a patch.
This is meant as a checklist, once you know the basics. For complete
instructions please see the :ref:`setup guide <setup>`.

1. Install and set up :ref:`Git <vcsetup>` and other dependencies
   (see the :ref:`Git Setup <setup>` page for detailed information).

5. Fork `the CPython repository <https://github.com/python/cpython>`_
   to your GitHub account and :ref:`get the source code <checkout>` using::

      git clone https://github.com/<your_username>/cpython
      cd cpython

6. Build Python, on Unix and macOS use:

   .. tab:: Unix/Linux/macOS

      .. code-block:: shell

         ./configure --with-pydebug && make -j

   .. tab:: Windows

      .. code-block:: dosbatch

         PCbuild\build.bat -e -d

   See also :ref:`more detailed instructions <compiling>`,
   :ref:`how to install and build dependencies <build-dependencies>`,
   and the platform-specific pages for :ref:`Unix <unix-compiling>`,
   :ref:`macOS`, and :ref:`Windows <windows-compiling>`.

7. :ref:`Run the tests <runtests>`:

   .. tab:: Unix/Linux/macOS

      .. code-block:: shell

         ./python.exe -m test -j3

   .. tab:: Windows

      .. code-block:: dosbatch

         ./python.bat -m test -j3

   On :ref:`most <mac-python.exe>` macOS systems, replace :file:`./python`
   with :file:`./python.exe`.  On Windows, use :file:`python.bat`.

@hugovk
Copy link
Member

hugovk commented Oct 25, 2023

https://devguide.python.org/ says:

On most macOS systems, replace ./python with ./python.exe. On Windows, use python.bat.

So:

  • ./python

is Unix,

  • ./python.exe

is macOS, and

  • ./python.bat

is Windows.

So shall we have those three tabs?

@hugovk
Copy link
Member

hugovk commented Oct 25, 2023

That will mean we'll need some duplication for:

On Unix and macOS use:
make patchcheck

and on Windows:
.\python.bat Tools\patchcheck\patchcheck.py

Something along the lines of:

.. tab: Unix

   make patchcheck

.. tab: macOS

   make patchcheck

.. tab: Windows

   .\python.bat Tools\patchcheck\patchcheck.py

But I think that's fine: it will allow people to select the OS of their choice and they'll see the correct instructions.

@lancegoyke
Copy link
Contributor

Thank you for reviewing this, @hugovk!

Okay, that was my suspicion and I agree that repetition in the tags is the right way forward.

If this Issue is unclaimed, I would be happy to work on it.

@hugovk
Copy link
Member

hugovk commented Oct 25, 2023

Please do, you've made a good start :)

And the first PR can be small: enable the extension and add some tabs to a single page. We don't need to add tabs to the whole devguide in a single go.

@hugovk hugovk changed the title Use Furo's tab to display commands in macOS or Windows Use tabs to display commands in macOS or Windows Nov 9, 2023
@hugovk
Copy link
Member

hugovk commented Nov 14, 2023

@lancegoyke Thanks for doing the first two pages!

We also now have some JavaScript to activate the relevant tab based on the browser's OS.


I've added the pages from #1196 (comment) to a checklist in the top post, and added a couple of more /documentation pages that can have Unix vs. Windows tabs.

@hugovk
Copy link
Member

hugovk commented Mar 25, 2024

I think we're all done here? We can re-open, or open new issues or PRs for anything else.

Thanks for all the PRs, @lancegoyke!

@hugovk hugovk closed this as completed Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants