Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Create man pages for click application as easy as this:
click-man foo
where foo
is the name of your script, as defined in console_scripts
.
→ Checkout the debian packaging example
click-man will generate one man page per command of your click CLI application specified in console_scripts
in your setup.py
/ setup.cfg
/ pyproject.toml
.
pip3 install click-man
click-man is also available for Python 2:
pip install click-man
The following sections describe different usage example for click-man.
click-man provides its own command line tool which can be passed the name of an installed script:
click-man commandname
where commandname
is the name of an installed console_script
entry point.
To specify a target directory for the man pages, use the --target
option:
click-man --target path/to/man/pages commandname
This approach of installing man pages is problematic for various reasons:
Python in general and with that pip and setuptools are aimed to be platform independent.
Man pages are not: they are a UNIX thing which means setuptools does not provide a sane solution to generate and install man pages.
We should consider using automatic man page installation only with vendor specific packaging, e.g. for *.deb
or *.rpm
packages.
Even on systems that support man pages, Python packages can be installed in virtualenvs via pip and setuptools, which do not make commands available globally. In fact, one of the "features" of a virtualenv is the ability to install a package without affecting the main system. As it is imposable to ensure a man page is only generated when not installing into a virtualenv, auto-generated man pages would pollute the main system and not stay contained in the virtualenv. Additionally, as a user could install multiple different versions of the same package into multiple different virtualenvs on the same system, there is no guarantee that a globally installed man page will document the version and behavior available in any given virtualenv.
First, we do not want to commit man pages to our source control. We want to generate them on the fly, either during build or installation time.
With setuptools and pip we face two problems:
The debhelper
packages provides a very convenient script called dh_installman
.
It checks for the debian/(pkg_name.)manpages
file and it's content which is basically a line by line list of man pages or globs:
debian/tmp/manpages/*
We override the rule provided by dh_installman
to generate our man pages in advance, like this:
override_dh_installman:
click-man <executable> --target debian/tmp/manpages
dh_installman -O--buildsystem=pybuild
Now we are able to build a debian package with the tool of our choice, e.g.:
debuild -us -uc
Checkout a working example here: repo debian package
FAQs
Generate man pages for click based CLI applications
We found that click-man demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.