Skip to content

Conversation

AA-Turner
Copy link
Member

@AA-Turner AA-Turner commented Sep 28, 2022

This is the first step towards a new sphinx command.

References: #5618, #6938

I took inspiration from @stephenfin's approach but this is a different tack.

Feature or Bugfix

  • Feature

Sample output

(sphinx) I:\Development\sphinx>python -m sphinx._cli.__init__ --version
sphinx 5.3.0+/ac2a54de9

(sphinx) I:\Development\sphinx>python -m sphinx._cli.__init__ --help    
Usage: sphinx [--version] [--help] [--quiet] <command> [<args>]
                                                               
   Manage documentation with Sphinx.                           
                                                               
Options:                                                       
  --version, -V   Show the version and exit.                   
  --help, -h, -?  Show this message and exit.                  
  --quiet, -q     Only print errors and warnings.

For more information, visit <https://www.sphinx-doc.org/en/master/man/>.

(sphinx) I:\Development\sphinx>

A

@AA-Turner AA-Turner added this to the 5.3.0 milestone Sep 28, 2022
@AA-Turner AA-Turner self-assigned this Sep 28, 2022
@AA-Turner AA-Turner force-pushed the sphinx-cli branch 4 times, most recently from 32a6161 to 24db75c Compare September 28, 2022 10:05
@AA-Turner AA-Turner modified the milestones: 5.3.0, 6.x Oct 13, 2022
@AA-Turner AA-Turner changed the base branch from 5.x to master October 16, 2022 15:26
Copy link

@ashb ashb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I came across this issue due to looking for a way to build multiple sphinx builders in a single command/call)

I'm not sure what Sphinx's policy is on pulling in dependencies, but might it be worth considering some of:

They handle a lot of the "boilerplate" of dealing with arg parsing, subcommads, output and terminal color/encoding etc. (I'm absolutely not trying to bikeshed here)

@AA-Turner AA-Turner modified the milestones: 6.x, 7.x Apr 29, 2023
@AA-Turner AA-Turner modified the milestones: 7.x, 7.1.0 May 15, 2023
@AA-Turner AA-Turner force-pushed the sphinx-cli branch 2 times, most recently from a85e4fd to 6b72110 Compare May 18, 2023 00:43
@stephenfin
Copy link
Contributor

stephenfin commented May 18, 2023

Sample output

(sphinx) I:\Development\sphinx>python -m sphinx._cli.__init__ --version
sphinx 5.3.0+/ac2a54de9

(sphinx) I:\Development\sphinx>python -m sphinx._cli.__init__ --help    
Usage: sphinx [--version] [--help] [--quiet] <command> [<args>]
                                                               
   Manage documentation with Sphinx.                           
                                                               
Options:                                                       
  --version, -V   Show the version and exit.                   
  --help, -h, -?  Show this message and exit.                  
  --quiet, -q     Only print errors and warnings.

For more information, visit <https://www.sphinx-doc.org/en/master/man/>.

(sphinx) I:\Development\sphinx>

Out of curiosity, what's the rational for not providing a sphinx executable? I get that python -m <module-name> is the preferred pattern for something like pip because it helps you understand which version of Python you're running on (per python/cpython#66491), but for a tool like Sphinx the fact that it's written in Python should be irrelevant to anyone bar a Sphinx extension author or Sphinx core developer. Surely an unambiguous sphinx command would be preferable for "normal" people? 😄

Copy link
Contributor

@stephenfin stephenfin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of comments inline

@AA-Turner
Copy link
Member Author

Out of curiosity, what's the rational for not providing a sphinx executable?

This PR is intended to be the first in a series, and just introduces the new CLI infrastructure -- I don't want to provide sphinx before at least the main build command is ready.

A

@AA-Turner AA-Turner merged commit c41aab8 into sphinx-doc:master Apr 29, 2024
@AA-Turner AA-Turner deleted the sphinx-cli branch April 29, 2024 02:03
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants