diff --git a/.editorconfig b/.editorconfig index 2b78eb51..c0fb1a76 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,4 +1,10 @@ root = true +[*.md] +max_line_length = 80 + +[LICENSE.txt] +max_line_length = 78 + [*.py] max_line_length = 89 diff --git a/.gitignore b/.gitignore index 4a0de8fe..cbd12fd5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +build/ htmlcov/ pg_activity.egg-info pgactivity/__pycache__/ diff --git a/LICENSE.txt b/LICENSE.txt index ea391b5f..5bf1ccd3 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,8 +1,18 @@ Copyright (c) 2012 - 2019, Julien Tachoires Copyright (c) 2020, Dalibo -Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies. +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose, without fee, and without a written agreement is +hereby granted, provided that the above copyright notice and this paragraph +and the following two paragraphs appear in all copies. -IN NO EVENT SHALL DALIBO BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF DALIBO HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +IN NO EVENT SHALL DALIBO BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, +INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF +THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF DALIBO HAS BEEN +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -DALIBO SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND DALIBO HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +DALIBO SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND DALIBO +HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR +MODIFICATIONS. diff --git a/README.md b/README.md index 2752a4a7..1a28def5 100644 --- a/README.md +++ b/README.md @@ -5,33 +5,28 @@ 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) [![Build Status](https://travis-ci.com/dalibo/pg_activity.svg?branch=master)](https://travis-ci.com/dalibo/pg_activity) - -Dependencies ------------- - - - `python` ≥ **3.6** - - `psycopg2` ≥ **2.5** - - `psutil` ≥ **0.5.1** - -Installation from sources: -`setuptools` ≥ **0.6.14** - -You have to install the package `psycopg2` from `pgdg` [APT](https://wiki.postgresql.org/wiki/Apt) or [YUM](https://yum.postgresql.org/) repositories. `psycopg2` can also been installed from `pip` with `pip install psycopg2` or `pip install psycopg2-binary` for the binary version. - Installation ------------ - sudo python setup.py install +`pg_activity` requires Python 3.6 or later. It can be installed using pip +(available, e.g., as `apt install python3-pip` on Debian-based distributions): -### Installation with man page + $ python3 -m pip install pg_activity psycopg2-binary - sudo python setup.py install --with-man +or directly from your Linux distribution, if available, e.g.: + + $ sudo apt install pg-activity Usage ----- -`pg_activity` works localy or remotely. In local execution context, to obtain sufficient rights to display system informations, the system user running `pg_activity` must be the same user running postgresql server (`postgres` by default), or have more rights like `root`. Otherwise, `pg_activity` can fallback to a degraded mode without displaying system informations. On the same way, PostgreSQL user used to connect to the database must be super-user. +`pg_activity` works localy or remotely. In local execution context, to obtain +sufficient rights to display system informations, the system user running +`pg_activity` must be the same user running postgresql server (`postgres` by +default), or have more rights like `root`. Otherwise, `pg_activity` can fallback +to a degraded mode without displaying system informations. On the same way, +PostgreSQL user used to connect to the database must be super-user. ex: sudo -u postgres pg_activity -U postgres @@ -83,7 +78,10 @@ Options 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`. +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 @@ -123,7 +121,7 @@ Navigation mode | `Space` | Tag or untag the process | | `q` | Quit | | `Other` | Back to activity | - + Screenshot ---------- diff --git a/pyproject.toml b/pyproject.toml index 19b8aa4f..5d3b2b0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,6 @@ exclude = ''' | \.venv | dist )/ - | setup.py | pg_activity ) ''' diff --git a/setup.py b/setup.py index 3bd9b447..0dafdd89 100644 --- a/setup.py +++ b/setup.py @@ -2,36 +2,50 @@ data_files = None for opt in sys.argv: - if opt == '--with-man': - data_files = [('/usr/share/man/man1', ['docs/man/pg_activity.1'])] + if opt == "--with-man": + data_files = [("/usr/share/man/man1", ["docs/man/pg_activity.1"])] sys.argv.remove(opt) from setuptools import setup -with open('README.md') as fo: +with open("README.md") as fo: long_description = fo.read() setup( - name = 'pg_activity', - version = '1.6.2', - author = 'Julien Tachoires', - author_email = 'julmon@gmail.com', - scripts = ['pg_activity'], - packages = ['pgactivity'], - url = 'https://github.com/julmon/pg_activity', - license = 'LICENSE.txt', - description = 'Command line tool for PostgreSQL server activity monitoring.', - long_description = long_description, - long_description_content_type='text/markdown', + name="pg_activity", + version="1.6.2", + author="Dalibo", + author_email="contact@dalibo.com", + scripts=["pg_activity"], + packages=["pgactivity"], + url="https://github.com/dalibo/pg_activity", + license="PostgreSQL", + description="Command line tool for PostgreSQL server activity monitoring.", + long_description=long_description, + long_description_content_type="text/markdown", classifiers=[ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Environment :: Console :: Curses", + "License :: OSI Approved :: PostgreSQL License", "Programming Language :: Python :: 3", + "Topic :: Database", ], + keywords="postgresql activity monitoring cli sql top", python_requires=">=3.6", - install_requires = [ + install_requires=[ "attrs", "blessed", "humanize", "psutil >= 2.0.0", ], - data_files = data_files, + extras_require={ + "testing": [ + "psycopg2-binary", + "pytest", + "pytest-datadir", + "pytest-postgresql", + ], + }, + data_files=data_files, ) diff --git a/tox.ini b/tox.ini index 9174301c..4ce6ec71 100644 --- a/tox.ini +++ b/tox.ini @@ -7,11 +7,8 @@ python = 3.7: check-manifest, lint, mypy, py37 [testenv] -deps = - psycopg2-binary - pytest - pytest-datadir - pytest-postgresql +extras = + testing commands = pytest {toxinidir}/pgactivity {toxinidir}/tests {posargs:-vv}