Fabien
Fabien

Reputation: 787

How to know the version number of docutils

I found myself searching for the version of docutils the server was running. To my surprise, it wasn't as straight forward as typing whatever command with flag "--version". I finally got it through the commands below, but isn't it something more direct than that?

# Assuming we are on Debian like distribution
aptitude show python-docutils

# If "docutils" is managed by pip
pip freeze | grep docutils

Upvotes: 0

Views: 1075

Answers (2)

G. Milde
G. Milde

Reputation: 929

Since release 0.19 (2022-07-05), the docutils package comes with the "docutils" CLI front end, so you can just open a terminal and type

 docutils --version

(Other front end tools like rst2html5 come with the --version command line option, too.)

If the "docutils" package was installed with pip, the command

 pip show docutils

includes the version in the displayed info.

Upvotes: 0

Chris
Chris

Reputation: 46346

The Docutils package (like many other Python packages) exposes a version number through the parameter __version__ (search for this in /path/to/docutils/__init__.py for the definition/documentation). A simple one liner to display this is:

python -c "import docutils; print docutils.__version__"

Edit: Having just tried python rst2html.py --version I get the following information printed to screen

rst2html.py (Docutils 0.9.1 [release], Python 2.6.8, on linux2)

is this what you are after?

Upvotes: 1

Related Questions