pg-activity


Namepg-activity JSON
Version 3.5.1 PyPI version JSON
download
home_pageNone
SummaryCommand line tool for PostgreSQL server activity monitoring.
upload_time2024-04-03 12:47:04
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licensePostgreSQL
keywords activity cli monitoring postgresql sql top
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            ![pg_activity](https://github.com/dalibo/pg_activity/raw/master/docs/imgs/logo-horizontal.png)

Command line tool for PostgreSQL server activity monitoring.

[![Latest PyPI version](https://img.shields.io/pypi/v/pg_activity.svg)](https://pypi.python.org/pypi/pg_activity)
[![Lint](https://github.com/dalibo/pg_activity/actions/workflows/lint.yml/badge.svg)](https://github.com/dalibo/pg_activity/actions/workflows/lint.yml)
[![Tests](https://github.com/dalibo/pg_activity/actions/workflows/tests.yml/badge.svg)](https://github.com/dalibo/pg_activity/actions/workflows/tests.yml)

![pg_activity screenshot](https://raw.github.com/dalibo/pg_activity/master/docs/imgs/screenshot.png)

# Installation

## From distribution packages

The simplest way to install pg\_activity is through the package manager of your
Linux distribution, if it ships with a package. E.g., on Debian-based
distributions (e.g. Debian, Ubuntu, Mint...):

    $ sudo apt install pg-activity

(on Debian bullseye, the current stable version, a backport is available: `apt
install pg-activity/bullseye-backports`).

The PostgreSQL Global Development Group (PGDG) also provides packages for
RPM-based (https://yum.postgresql.org/) and Debian-based distributions
(https://wiki.postgresql.org/wiki/Apt).

**Note:** distribution packages may not be up to date with the latest
pg\_activity releases. Before submitting a bug report here:
-   check the package version, compare that to our latest release and then
    review the [change log][changelog] to see if the bug has been fixed;
-   if the issue is about packaging, e.g. missing dependencies, reach out
    the package maintainer (or PGDG) first.

## From PyPI

pg\_activity can be installed using pip on Python 3.8 or later along with
psycopg:

    $ python3 -m pip install "pg_activity[psycopg]"

Alternatively, [pipx](https://pypi.org/project/pipx/) can be used to install
and run pg\_activity in an isolated environment:

    $ pipx install "pg_activity[psycopg]"

In case your `$PATH` does not already contain it, the full path is:

    $ ~/.local/bin/pg_activity

## From source, using git

This is only necessary to test development versions. First, clone the repository:

    $ git clone https://github.com/dalibo/pg_activity.git

Change the branch if necessary. Then create a dedicated environment,
and install pg\_activity with the psycopg database driver:

    $ cd pg_activity
    $ python3 -m venv .venv
    $ . .venv/bin/activate
    (.venv) $ pip install ".[psycopg]"
    (.venv) $ pg_activity

To quit this env and destroy it:

    $ deactivate
    $ rm -r .venv

# Usage

`pg_activity` works locally or remotely. In local execution context, to obtain
sufficient rights to display system information, the system user running
`pg_activity` must be the same user running postgresql server (`postgres` by
default), or have more rights like `root`. The PostgreSQL user used to connect
to the database must be super-user in order to get as much data as possible.
Otherwise, `pg_activity` can fall back to a degraded mode where some data like
system information or temporary file data are not displayed.

ex:

    sudo -u postgres pg_activity -U postgres

## Options

    pg_activity [options] [connection string]

    Configuration:
      --profile PROFILE     Configuration profile matching a PROFILE.conf file in
                            ${XDG_CONFIG_HOME:~/.config}/pg_activity/ or
                            /etc/pg_activity/.

    Options:
      --blocksize BLOCKSIZE
                            Filesystem blocksize (default: 4096).
      --rds                 Enable support for AWS RDS (implies --no-tempfiles and filters out the rdsadmin database from space calculation).
      --output FILEPATH     Store running queries as CSV.
      --no-db-size          Skip total size of DB.
      --no-tempfiles        Skip tempfile count and size.
      --no-walreceiver      Skip walreceiver checks.
      -w, --wrap-query      Wrap query column instead of truncating.
      --duration-mode DURATION_MODE
                            Duration mode. Values: 1-QUERY(default), 2-TRANSACTION, 3-BACKEND.
      --min-duration SECONDS
                            Don't display queries with smaller than specified duration (in seconds).
      --filter FIELD:REGEX  Filter activities with a (case insensitive) regular expression applied on selected fields. Known fields are: dbname.
      --debug-file DEBUG_FILE
                            Enable debug and write it to DEBUG_FILE.
      --version             show program's version number and exit.
      --help                Show this help message and exit.

    Connection Options:
      connection string     A valid connection string to the database, e.g.: 'host=HOSTNAME port=PORT user=USER dbname=DBNAME'.
      -h HOSTNAME, --host HOSTNAME
                            Database server host or socket directory.
      -p PORT, --port PORT  Database server port.
      -U USERNAME, --username USERNAME
                            Database user name.
      -d DBNAME, --dbname DBNAME
                            Database name to connect to.

    Process table display options:
      These options may be used hide some columns from the processes table.

      --no-pid              Disable PID.
      --no-database         Disable DATABASE.
      --no-user             Disable USER.
      --no-client           Disable CLIENT.
      --no-cpu              Disable CPU%.
      --no-mem              Disable MEM%.
      --no-read             Disable READ/s.
      --no-write            Disable WRITE/s.
      --no-time             Disable TIME+.
      --no-wait             Disable W.
      --no-app-name         Disable App.

    Header display options:
      --no-inst-info        Display instance information.
      --no-sys-info         Display system information.
      --no-proc-info        Display workers process information.

    Other display options:
      --hide-queries-in-logs
                            Disable log_min_duration_statements and log_min_duration_sample for pg_activity.
      --refresh REFRESH     Refresh rate. Values: 0.5, 1, 2, 3, 4, 5 (default: 2).

## Configuration

`pg_activity` may be configured through a configuration file, in [INI format][],
read from `${XDG_CONFIG_HOME:~/.config}/pg_activity.conf` or
`/etc/pg_activity.conf` in that order. Command-line options may override
configuration file settings.
This is used to control how columns in the processes table are rendered or which
items of the header should be displayed, e.g.:
```ini
[header]
show_instance = yes
show_system = yes
show_workers = no

[client]
hidden = yes

[database]
width = 9
```

Alternatively, the user might define *configuration profiles* in the form of
files located at `${XDG_CONFIG_HOME:~/.config}/pg_activity/<my-profile>.conf` or
`/etc/pg_activity/<my-profile>.conf`; these can then be used through the
`--profile <my-profile>` command-line option. The format of these files is the
same as the main configuration file.

`pg_activity` ships with a few built-in profiles:

- `narrow`, providing a narrow user interface with most non-essential
  columns in the process table hidden,
- `wide`, providing a wide user interface (the inverse of `narrow`), and,
- `minimal`, providing an even more minimal user interface with header
  information hidden

[INI format]: https://docs.python.org/3/library/configparser.html#supported-ini-file-structure

## Notes

Length of SQL query text that `pg_activity` reports relies on PostgreSQL
parameter `track_activity_query_size`. Default value is `1024` (expressed in
bytes). If your SQL query text look truncated, you should increase
`track_activity_query_size`.


## Interactives commands

| Key       | Action                                                           |
|-----------|------------------------------------------------------------------|
| `r`       | Sort by READ/s, descending                                       |
| `w`       | Sort by WRITE/s, descending                                      |
| `c`       | Sort by CPU%, descending                                         |
| `m`       | Sort by MEM%, descending                                         |
| `t`       | Sort by TIME+, descending                                        |
| `T`       | Change duration mode: query, transaction, backend                |
| `Space`   | Pause on/off                                                     |
| `v`       | Change queries display mode: full, indented, truncated           |
| `UP/DOWN` | Scroll processes list                                            |
| `k/j`     | Scroll processes list                                            |
| `q`       | Quit                                                             |
| `+`       | Increase refresh time. Maximum value : 5s                        |
| `-`       | Decrease refresh time. Minimum Value : 0.5s                      |
| `F1/1`    | Running queries list                                             |
| `F2/2`    | Waiting queries list                                             |
| `F3/3`    | Blocking queries list                                            |
| `h`       | Help page                                                        |
| `R`       | Refresh                                                          |
| `D`       | Refresh Database Size (including when --no-dbzise option applied)|
| `s`       | Display system information in header                             |
| `i`       | Display general instance information in header                   |
| `o`       | Display worker information in header                             |

## Navigation mode

| Key        | Action                                        |
|------------|-----------------------------------------------|
| `UP`/`k`   | Move up the cursor                            |
| `DOWN`/`j` | Move down the cursor                          |
| `K`        | Terminate the current backend/tagged backends |
| `C`        | Cancel the current backend/tagged backends    |
| `Space`    | Tag or untag the process                      |
| `q`        | Quit                                          |
| `Other`    | Back to activity                              |

## FAQ

**I can't see my queries only TPS is shown**

`pg_activity` scans the view `pg_stat_activity` with a user defined refresh
time comprised between 0.5 and 5 seconds. It can be modified in the interface
with the `+` and `-` keys. Any query executed between two scans won't be
displayed.


What is more, `pg_activity` uses different queries to get :

*    settings from `pg_settings`
*    version info using `version()`
*    queries and number of connections from `pg_stat_activity`
*    locks from `pg_locks`
*    tps from `pg_database` using `pg_stat_get_db_xact_commit()` and
     `pg_stat_get_db_xact_rollback()`
*    and more ( eg : `pg_cancel_backend()` and `pg_terminate_backend()` )

Those queries cannot be seen in the query tab because all queries issued from
the `pg_activity` backend are considered as noise and are not displayed . On
the other hand, the transactions used to get the info for `pg_activity`'s
reporting are still accounted for by postgres in `pg_stat_get_db_xact_commit()`
and `pg_stat_get_db_xact_commit()`. Therefore `pg_activity` will display a non
zero TPS even with no activity on the database, and/or no activity displayed on
screen.

**How can I specify a password for authentication ?**

pg_activity uses libpq to access to PostgreSQL therefore all the traditional
methods are available.

You can pass the password for the database connection in a password file.
Information can also be given via PostgreSQL's environment variables
(PGPASSFILE or PGPASSWORD) or via the connection string parameters.

The password file is preferred since it's more secure (security is deferred to
the OS). Please avoid password in connection strings at all cost.

# Hacking

In order to work on pg\_activity source code, in particular to run the tests
suite, a temporary PostgreSQL database cluster will be created; accordingly,
PostgreSQL server binaries (e.g. `initdb`, `pg_ctl`) need to be available. For
instance, on a Debian system, this means simply having the `postgresql` package
installed.

To set up a development environment, get the source repository:

    $ git clone https://github.com/dalibo/pg_activity
    $ cd pg_activity

and then create a [virtual environment][venv], activate it and install the
project along with development dependencies:

    $ python3 -m venv .venv
    $ .venv/bin/activate
    (.venv) $ pip install -e ".[dev]"

The source code is formatted with [black][] and [isort][] and typed checked with
[mypy][] (all those are included in the development environment). Make sure to
respect this, e.g. by configuring your editor, before committing changes.
Alternatively, you can install [pre-commit][] hooks so that this will be checked
automatically:

    (.venv) $ pre-commit install

[venv]: https://docs.python.org/3/library/venv.html
[black]: https://black.readthedocs.io/
[isort]: https://pycqa.github.io/isort/
[mypy]: https://mypy.readthedocs.io/
[pre-commit]: https://pre-commit.com/

To run the tests suite, simply invoke:

    (.venv) $ pytest
    ================================ test session starts =================================
    platform linux -- Python 3.11.2, pytest-7.3.1, pluggy-1.0.0
    psycopg: 3.1.8
    configfile: pytest.ini
    plugins: cov-4.0.0, accept-0.1.9, postgresql-4.1.1
    collected 70 items

    pgactivity/activities.py ..                                                    [  2%]
    pgactivity/config.py ..                                                        [  5%]
    pgactivity/data.py ..                                                          [  8%]
    pgactivity/handlers.py .....                                                   [ 15%]
    pgactivity/keys.py .                                                           [ 17%]
    pgactivity/types.py ..............                                             [ 37%]
    pgactivity/utils.py .........                                                  [ 50%]
    pgactivity/views.py .....                                                      [ 57%]
    tests/test_activities.py ...                                                   [ 61%]
    tests/test_config.py ..                                                        [ 64%]
    tests/test_data.py ................                                            [ 87%]
    tests/test_scroll.txt .                                                        [ 88%]
    tests/test_types.py .                                                          [ 90%]
    tests/test_ui.txt .                                                            [ 91%]
    tests/test_views.py ....                                                       [ 97%]
    tests/test_views.txt .                                                         [ 98%]
    tests/test_widgets.txt .                                                       [100%]

    ================================ 70 passed in 11.89s =================================

# Change log

See [CHANGELOG.md][changelog].

[changelog]: https://github.com/dalibo/pg_activity/blob/master/CHANGELOG.md

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pg-activity",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Denis Laxalde <denis.laxalde@dalibo.com>, Benoit Lobr\u00e9au <benoit.lobreau@dalibo.com>",
    "keywords": "activity, cli, monitoring, postgresql, sql, top",
    "author": null,
    "author_email": "Julien Tachoires <julmon@gmail.com>, Benoit Lobr\u00e9au <benoit.lobreau@dalibo.com>, Denis Laxalde <denis.laxalde@dalibo.com>, Dalibo <contact@dalibo.com>",
    "download_url": "https://files.pythonhosted.org/packages/de/f4/618c75b98704dca607dfe9f0bb07a429ef7097e5343c4797535ac4569649/pg-activity-3.5.1.tar.gz",
    "platform": null,
    "description": "![pg_activity](https://github.com/dalibo/pg_activity/raw/master/docs/imgs/logo-horizontal.png)\n\nCommand line tool for PostgreSQL server activity monitoring.\n\n[![Latest PyPI version](https://img.shields.io/pypi/v/pg_activity.svg)](https://pypi.python.org/pypi/pg_activity)\n[![Lint](https://github.com/dalibo/pg_activity/actions/workflows/lint.yml/badge.svg)](https://github.com/dalibo/pg_activity/actions/workflows/lint.yml)\n[![Tests](https://github.com/dalibo/pg_activity/actions/workflows/tests.yml/badge.svg)](https://github.com/dalibo/pg_activity/actions/workflows/tests.yml)\n\n![pg_activity screenshot](https://raw.github.com/dalibo/pg_activity/master/docs/imgs/screenshot.png)\n\n# Installation\n\n## From distribution packages\n\nThe simplest way to install pg\\_activity is through the package manager of your\nLinux distribution, if it ships with a package. E.g., on Debian-based\ndistributions (e.g. Debian, Ubuntu, Mint...):\n\n    $ sudo apt install pg-activity\n\n(on Debian bullseye, the current stable version, a backport is available: `apt\ninstall pg-activity/bullseye-backports`).\n\nThe PostgreSQL Global Development Group (PGDG) also provides packages for\nRPM-based (https://yum.postgresql.org/) and Debian-based distributions\n(https://wiki.postgresql.org/wiki/Apt).\n\n**Note:** distribution packages may not be up to date with the latest\npg\\_activity releases. Before submitting a bug report here:\n-   check the package version, compare that to our latest release and then\n    review the [change log][changelog] to see if the bug has been fixed;\n-   if the issue is about packaging, e.g. missing dependencies, reach out\n    the package maintainer (or PGDG) first.\n\n## From PyPI\n\npg\\_activity can be installed using pip on Python 3.8 or later along with\npsycopg:\n\n    $ python3 -m pip install \"pg_activity[psycopg]\"\n\nAlternatively, [pipx](https://pypi.org/project/pipx/) can be used to install\nand run pg\\_activity in an isolated environment:\n\n    $ pipx install \"pg_activity[psycopg]\"\n\nIn case your `$PATH` does not already contain it, the full path is:\n\n    $ ~/.local/bin/pg_activity\n\n## From source, using git\n\nThis is only necessary to test development versions. First, clone the repository:\n\n    $ git clone https://github.com/dalibo/pg_activity.git\n\nChange the branch if necessary. Then create a dedicated environment,\nand install pg\\_activity with the psycopg database driver:\n\n    $ cd pg_activity\n    $ python3 -m venv .venv\n    $ . .venv/bin/activate\n    (.venv) $ pip install \".[psycopg]\"\n    (.venv) $ pg_activity\n\nTo quit this env and destroy it:\n\n    $ deactivate\n    $ rm -r .venv\n\n# Usage\n\n`pg_activity` works locally or remotely. In local execution context, to obtain\nsufficient rights to display system information, the system user running\n`pg_activity` must be the same user running postgresql server (`postgres` by\ndefault), or have more rights like `root`. The PostgreSQL user used to connect\nto the database must be super-user in order to get as much data as possible.\nOtherwise, `pg_activity` can fall back to a degraded mode where some data like\nsystem information or temporary file data are not displayed.\n\nex:\n\n    sudo -u postgres pg_activity -U postgres\n\n## Options\n\n    pg_activity [options] [connection string]\n\n    Configuration:\n      --profile PROFILE     Configuration profile matching a PROFILE.conf file in\n                            ${XDG_CONFIG_HOME:~/.config}/pg_activity/ or\n                            /etc/pg_activity/.\n\n    Options:\n      --blocksize BLOCKSIZE\n                            Filesystem blocksize (default: 4096).\n      --rds                 Enable support for AWS RDS (implies --no-tempfiles and filters out the rdsadmin database from space calculation).\n      --output FILEPATH     Store running queries as CSV.\n      --no-db-size          Skip total size of DB.\n      --no-tempfiles        Skip tempfile count and size.\n      --no-walreceiver      Skip walreceiver checks.\n      -w, --wrap-query      Wrap query column instead of truncating.\n      --duration-mode DURATION_MODE\n                            Duration mode. Values: 1-QUERY(default), 2-TRANSACTION, 3-BACKEND.\n      --min-duration SECONDS\n                            Don't display queries with smaller than specified duration (in seconds).\n      --filter FIELD:REGEX  Filter activities with a (case insensitive) regular expression applied on selected fields. Known fields are: dbname.\n      --debug-file DEBUG_FILE\n                            Enable debug and write it to DEBUG_FILE.\n      --version             show program's version number and exit.\n      --help                Show this help message and exit.\n\n    Connection Options:\n      connection string     A valid connection string to the database, e.g.: 'host=HOSTNAME port=PORT user=USER dbname=DBNAME'.\n      -h HOSTNAME, --host HOSTNAME\n                            Database server host or socket directory.\n      -p PORT, --port PORT  Database server port.\n      -U USERNAME, --username USERNAME\n                            Database user name.\n      -d DBNAME, --dbname DBNAME\n                            Database name to connect to.\n\n    Process table display options:\n      These options may be used hide some columns from the processes table.\n\n      --no-pid              Disable PID.\n      --no-database         Disable DATABASE.\n      --no-user             Disable USER.\n      --no-client           Disable CLIENT.\n      --no-cpu              Disable CPU%.\n      --no-mem              Disable MEM%.\n      --no-read             Disable READ/s.\n      --no-write            Disable WRITE/s.\n      --no-time             Disable TIME+.\n      --no-wait             Disable W.\n      --no-app-name         Disable App.\n\n    Header display options:\n      --no-inst-info        Display instance information.\n      --no-sys-info         Display system information.\n      --no-proc-info        Display workers process information.\n\n    Other display options:\n      --hide-queries-in-logs\n                            Disable log_min_duration_statements and log_min_duration_sample for pg_activity.\n      --refresh REFRESH     Refresh rate. Values: 0.5, 1, 2, 3, 4, 5 (default: 2).\n\n## Configuration\n\n`pg_activity` may be configured through a configuration file, in [INI format][],\nread from `${XDG_CONFIG_HOME:~/.config}/pg_activity.conf` or\n`/etc/pg_activity.conf` in that order. Command-line options may override\nconfiguration file settings.\nThis is used to control how columns in the processes table are rendered or which\nitems of the header should be displayed, e.g.:\n```ini\n[header]\nshow_instance = yes\nshow_system = yes\nshow_workers = no\n\n[client]\nhidden = yes\n\n[database]\nwidth = 9\n```\n\nAlternatively, the user might define *configuration profiles* in the form of\nfiles located at `${XDG_CONFIG_HOME:~/.config}/pg_activity/<my-profile>.conf` or\n`/etc/pg_activity/<my-profile>.conf`; these can then be used through the\n`--profile <my-profile>` command-line option. The format of these files is the\nsame as the main configuration file.\n\n`pg_activity` ships with a few built-in profiles:\n\n- `narrow`, providing a narrow user interface with most non-essential\n  columns in the process table hidden,\n- `wide`, providing a wide user interface (the inverse of `narrow`), and,\n- `minimal`, providing an even more minimal user interface with header\n  information hidden\n\n[INI format]: https://docs.python.org/3/library/configparser.html#supported-ini-file-structure\n\n## Notes\n\nLength of SQL query text that `pg_activity` reports relies on PostgreSQL\nparameter `track_activity_query_size`. Default value is `1024` (expressed in\nbytes). If your SQL query text look truncated, you should increase\n`track_activity_query_size`.\n\n\n## Interactives commands\n\n| Key       | Action                                                           |\n|-----------|------------------------------------------------------------------|\n| `r`       | Sort by READ/s, descending                                       |\n| `w`       | Sort by WRITE/s, descending                                      |\n| `c`       | Sort by CPU%, descending                                         |\n| `m`       | Sort by MEM%, descending                                         |\n| `t`       | Sort by TIME+, descending                                        |\n| `T`       | Change duration mode: query, transaction, backend                |\n| `Space`   | Pause on/off                                                     |\n| `v`       | Change queries display mode: full, indented, truncated           |\n| `UP/DOWN` | Scroll processes list                                            |\n| `k/j`     | Scroll processes list                                            |\n| `q`       | Quit                                                             |\n| `+`       | Increase refresh time. Maximum value : 5s                        |\n| `-`       | Decrease refresh time. Minimum Value : 0.5s                      |\n| `F1/1`    | Running queries list                                             |\n| `F2/2`    | Waiting queries list                                             |\n| `F3/3`    | Blocking queries list                                            |\n| `h`       | Help page                                                        |\n| `R`       | Refresh                                                          |\n| `D`       | Refresh Database Size (including when --no-dbzise option applied)|\n| `s`       | Display system information in header                             |\n| `i`       | Display general instance information in header                   |\n| `o`       | Display worker information in header                             |\n\n## Navigation mode\n\n| Key        | Action                                        |\n|------------|-----------------------------------------------|\n| `UP`/`k`   | Move up the cursor                            |\n| `DOWN`/`j` | Move down the cursor                          |\n| `K`        | Terminate the current backend/tagged backends |\n| `C`        | Cancel the current backend/tagged backends    |\n| `Space`    | Tag or untag the process                      |\n| `q`        | Quit                                          |\n| `Other`    | Back to activity                              |\n\n## FAQ\n\n**I can't see my queries only TPS is shown**\n\n`pg_activity` scans the view `pg_stat_activity` with a user defined refresh\ntime comprised between 0.5 and 5 seconds. It can be modified in the interface\nwith the `+` and `-` keys. Any query executed between two scans won't be\ndisplayed.\n\n\nWhat is more, `pg_activity` uses different queries to get :\n\n*    settings from `pg_settings`\n*    version info using `version()`\n*    queries and number of connections from `pg_stat_activity`\n*    locks from `pg_locks`\n*    tps from `pg_database` using `pg_stat_get_db_xact_commit()` and\n     `pg_stat_get_db_xact_rollback()`\n*    and more ( eg : `pg_cancel_backend()` and `pg_terminate_backend()` )\n\nThose queries cannot be seen in the query tab because all queries issued from\nthe `pg_activity` backend are considered as noise and are not displayed . On\nthe other hand, the transactions used to get the info for `pg_activity`'s\nreporting are still accounted for by postgres in `pg_stat_get_db_xact_commit()`\nand `pg_stat_get_db_xact_commit()`. Therefore `pg_activity` will display a non\nzero TPS even with no activity on the database, and/or no activity displayed on\nscreen.\n\n**How can I specify a password for authentication ?**\n\npg_activity uses libpq to access to PostgreSQL therefore all the traditional\nmethods are available.\n\nYou can pass the password for the database connection in a password file.\nInformation can also be given via PostgreSQL's environment variables\n(PGPASSFILE or PGPASSWORD) or via the connection string parameters.\n\nThe password file is preferred since it's more secure (security is deferred to\nthe OS). Please avoid password in connection strings at all cost.\n\n# Hacking\n\nIn order to work on pg\\_activity source code, in particular to run the tests\nsuite, a temporary PostgreSQL database cluster will be created; accordingly,\nPostgreSQL server binaries (e.g. `initdb`, `pg_ctl`) need to be available. For\ninstance, on a Debian system, this means simply having the `postgresql` package\ninstalled.\n\nTo set up a development environment, get the source repository:\n\n    $ git clone https://github.com/dalibo/pg_activity\n    $ cd pg_activity\n\nand then create a [virtual environment][venv], activate it and install the\nproject along with development dependencies:\n\n    $ python3 -m venv .venv\n    $ .venv/bin/activate\n    (.venv) $ pip install -e \".[dev]\"\n\nThe source code is formatted with [black][] and [isort][] and typed checked with\n[mypy][] (all those are included in the development environment). Make sure to\nrespect this, e.g. by configuring your editor, before committing changes.\nAlternatively, you can install [pre-commit][] hooks so that this will be checked\nautomatically:\n\n    (.venv) $ pre-commit install\n\n[venv]: https://docs.python.org/3/library/venv.html\n[black]: https://black.readthedocs.io/\n[isort]: https://pycqa.github.io/isort/\n[mypy]: https://mypy.readthedocs.io/\n[pre-commit]: https://pre-commit.com/\n\nTo run the tests suite, simply invoke:\n\n    (.venv) $ pytest\n    ================================ test session starts =================================\n    platform linux -- Python 3.11.2, pytest-7.3.1, pluggy-1.0.0\n    psycopg: 3.1.8\n    configfile: pytest.ini\n    plugins: cov-4.0.0, accept-0.1.9, postgresql-4.1.1\n    collected 70 items\n\n    pgactivity/activities.py ..                                                    [  2%]\n    pgactivity/config.py ..                                                        [  5%]\n    pgactivity/data.py ..                                                          [  8%]\n    pgactivity/handlers.py .....                                                   [ 15%]\n    pgactivity/keys.py .                                                           [ 17%]\n    pgactivity/types.py ..............                                             [ 37%]\n    pgactivity/utils.py .........                                                  [ 50%]\n    pgactivity/views.py .....                                                      [ 57%]\n    tests/test_activities.py ...                                                   [ 61%]\n    tests/test_config.py ..                                                        [ 64%]\n    tests/test_data.py ................                                            [ 87%]\n    tests/test_scroll.txt .                                                        [ 88%]\n    tests/test_types.py .                                                          [ 90%]\n    tests/test_ui.txt .                                                            [ 91%]\n    tests/test_views.py ....                                                       [ 97%]\n    tests/test_views.txt .                                                         [ 98%]\n    tests/test_widgets.txt .                                                       [100%]\n\n    ================================ 70 passed in 11.89s =================================\n\n# Change log\n\nSee [CHANGELOG.md][changelog].\n\n[changelog]: https://github.com/dalibo/pg_activity/blob/master/CHANGELOG.md\n",
    "bugtrack_url": null,
    "license": "PostgreSQL",
    "summary": "Command line tool for PostgreSQL server activity monitoring.",
    "version": "3.5.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/dalibo/pg_activity/issues/",
        "Changelog": "https://github.com/dalibo/pg_activity/blob/master/CHANGELOG.md",
        "Homepage": "https://github.com/dalibo/pg_activity",
        "Source code": "https://github.com/dalibo/pg_activity/"
    },
    "split_keywords": [
        "activity",
        " cli",
        " monitoring",
        " postgresql",
        " sql",
        " top"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab08f4e1e7e6c4e943f24133e9369f765e067eb21fad7bf58ce18912a47b1234",
                "md5": "727e6aa9aa807d4b2fb2930d6b0ce2eb",
                "sha256": "3a9cb8305819fae06c8f29ee78c194a1cab2821c0af6d4c79b4cb8d10847f001"
            },
            "downloads": -1,
            "filename": "pg_activity-3.5.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "727e6aa9aa807d4b2fb2930d6b0ce2eb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 71381,
            "upload_time": "2024-04-03T12:47:01",
            "upload_time_iso_8601": "2024-04-03T12:47:01.921680Z",
            "url": "https://files.pythonhosted.org/packages/ab/08/f4e1e7e6c4e943f24133e9369f765e067eb21fad7bf58ce18912a47b1234/pg_activity-3.5.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "def4618c75b98704dca607dfe9f0bb07a429ef7097e5343c4797535ac4569649",
                "md5": "af362f8bb32173efa9ff40a0aba93f40",
                "sha256": "5b8214206906a7b0f49512c7a92174b527e4168992f632b87745763ed5e28441"
            },
            "downloads": -1,
            "filename": "pg-activity-3.5.1.tar.gz",
            "has_sig": false,
            "md5_digest": "af362f8bb32173efa9ff40a0aba93f40",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 445414,
            "upload_time": "2024-04-03T12:47:04",
            "upload_time_iso_8601": "2024-04-03T12:47:04.083475Z",
            "url": "https://files.pythonhosted.org/packages/de/f4/618c75b98704dca607dfe9f0bb07a429ef7097e5343c4797535ac4569649/pg-activity-3.5.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-03 12:47:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dalibo",
    "github_project": "pg_activity",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "pg-activity"
}
        
Elapsed time: 1.21985s