PCP-PYTHON(1)

πŸ“¦
version 7.2.2 Β· 2 versions
  • 7.2.2 Β· arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 6.0.3 Β· debian bookworm, ubuntu jammy
, in arch rolling, centos-stream 10, centos-stream 9, debian trixie, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– PCP-PYTHON πŸ’–

okay bestie, gather round, we're talking about pcp-python β€” the lil glow-up helper that runs a python script using a python variant of your choosing ✨ (from the General Commands Manual section of the PCP universe, no big deal)


🌸 NAME 🌸

pcp-python β€” run a python script using a preferred python variant πŸπŸ’…


✨ SYNOPSIS ✨

pcp python [SCRIPT [ARG] ...]

like, that's the whole vibe. a script, some args, boom πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie: pcp-python has been replaced by pmpython(1), which is the preferred one now. but pcp-python is still installed, because it's there to provide backwards compatibility. iconic of it, honestly 🫢

pcp-python gives you a way to run python scripts using a customisable python binary, instead of hard-embedding any particular version of python into every single script. no more committing to one python forever, we're flexible πŸ’β€β™€οΈ

and why is that cute? because it lets version-independent python code run anywhere 🌍✨ all the python modules shipped with PCP support versions 2.6 and later (in the python2 series), and 3.3 and later (in the python3 release series). range, honey. range πŸ’…

because python monitoring and collecting scripts in PCP are relatively simple (they don't need new modules, language features, etc), it's been possible to make sure they work for all of the python versions above. so it's super common for PCP python scripts to use a "shebang" line that invokes pcp-python like this:

#!/usr/bin/pcp python

this means your custom setting gets injected instead of a hard-coded python version β€” but the user can still override the python version, like:

$ PCP_PYTHON_PROG=python3 /usr/bin/pcp python --version
Python 3.3.2
$ PCP_PYTHON_PROG=python2 /usr/bin/pcp python --version
Python 2.7.5

look at her go πŸ˜­πŸ’– two pythons, one script, zero drama.

this is convenient for shipping identical scripts on multiple platforms, and for testing different python versions with the one script β€” for example, when multiple versions of python are installed, PCP_PYTHON_PROG can be set in the local environment to override the global setting. slay 🌈

by default, the value of PCP_PYTHON_PROG from /etc/pcp.conf gets used. and the default value of this configuration parameter is set depending on some heuristics about the target build platform 🧚 those heuristics favour the use of python3 in all recent releases of PCP, for those platforms that support it. python3 main character energy fr fr πŸ‘‘


🌈 PCP ENVIRONMENT 🌈

environment variables with the prefix PCP_ are used to parameterize the file and directory names used by PCP πŸ—‚οΈβœ¨

on each installation, the file /etc/pcp.conf contains the local values for these variables. and the $PCP_CONF variable may be used to specify an alternative configuration file, as described in pcp.conf(5). noted, bestie πŸ“


πŸ‘€ SEE ALSO πŸ‘€


Performance Co-Pilot Β· PCP Β· PCP-PYTHON(1)

and that's the whole page, bestie β€” brought to you by the Performance Co-Pilot girlies over at PCP, filed under PCP-PYTHON(1) πŸŽ€βœ¨ go run some version-independent python, you absolute icon πŸ’…πŸ’–

πŸ“¦ where this page comes from