Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc cleanups following rewrite #152

Merged
merged 10 commits into from
Nov 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
root = true

[*.md]
max_line_length = 80

[LICENSE.txt]
max_line_length = 78

[*.py]
max_line_length = 89
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build/
htmlcov/
pg_activity.egg-info
pgactivity/__pycache__/
Expand Down
16 changes: 13 additions & 3 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -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.
36 changes: 17 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -123,7 +121,7 @@ Navigation mode
| `Space` | Tag or untag the process |
| `q` | Quit |
| `Other` | Back to activity |

Screenshot
----------

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ exclude = '''
| \.venv
| dist
)/
| setup.py
| pg_activity
)
'''
46 changes: 30 additions & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
7 changes: 2 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down