pgcli 4.2.0__tar.gz → 4.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. pgcli-4.4.0/.coveragerc +2 -0
  2. pgcli-4.4.0/.editorconfig +15 -0
  3. pgcli-4.4.0/.github/ISSUE_TEMPLATE.md +9 -0
  4. pgcli-4.4.0/.github/PULL_REQUEST_TEMPLATE.md +12 -0
  5. pgcli-4.4.0/.github/workflows/ci.yml +92 -0
  6. pgcli-4.4.0/.github/workflows/codeql.yml +41 -0
  7. pgcli-4.4.0/.github/workflows/publish.yml +97 -0
  8. pgcli-4.4.0/.gitignore +76 -0
  9. pgcli-4.4.0/.pre-commit-config.yaml +10 -0
  10. {pgcli-4.2.0 → pgcli-4.4.0}/AUTHORS +6 -0
  11. pgcli-4.4.0/CONTRIBUTING.rst +216 -0
  12. pgcli-4.4.0/Dockerfile +6 -0
  13. {pgcli-4.2.0/pgcli.egg-info → pgcli-4.4.0}/PKG-INFO +32 -34
  14. {pgcli-4.2.0 → pgcli-4.4.0}/README.rst +15 -30
  15. pgcli-4.4.0/RELEASES.md +6 -0
  16. pgcli-4.4.0/TODO +12 -0
  17. pgcli-4.4.0/Vagrantfile +138 -0
  18. {pgcli-4.2.0 → pgcli-4.4.0}/changelog.rst +35 -0
  19. pgcli-4.4.0/pgcli/__init__.py +1 -0
  20. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/auth.py +2 -6
  21. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/completion_refresher.py +2 -6
  22. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/config.py +0 -1
  23. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/key_bindings.py +1 -2
  24. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/main.py +157 -155
  25. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/packages/formatter/sqlformatter.py +3 -10
  26. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/packages/parseutils/__init__.py +1 -3
  27. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/packages/parseutils/ctes.py +1 -1
  28. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/packages/parseutils/meta.py +2 -8
  29. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/packages/parseutils/tables.py +5 -20
  30. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/packages/parseutils/utils.py +1 -3
  31. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/packages/pgliterals/pgliterals.json +1 -1
  32. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/packages/sqlcompletion.py +28 -44
  33. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/pgbuffer.py +8 -11
  34. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/pgclirc +27 -0
  35. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/pgcompleter.py +48 -146
  36. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/pgexecute.py +17 -21
  37. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/pgstyle.py +1 -3
  38. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/pgtoolbar.py +4 -12
  39. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/pyev.py +13 -35
  40. pgcli-4.4.0/pgcli-completion.bash +76 -0
  41. {pgcli-4.2.0 → pgcli-4.4.0/pgcli.egg-info}/PKG-INFO +32 -34
  42. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli.egg-info/SOURCES.txt +28 -0
  43. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli.egg-info/requires.txt +17 -2
  44. pgcli-4.4.0/post-install +4 -0
  45. pgcli-4.4.0/post-remove +4 -0
  46. pgcli-4.4.0/pylintrc +2 -0
  47. {pgcli-4.2.0 → pgcli-4.4.0}/pyproject.toml +70 -28
  48. pgcli-4.4.0/release.py +132 -0
  49. pgcli-4.4.0/sanity_checks.txt +37 -0
  50. pgcli-4.4.0/screenshots/image01.png +0 -0
  51. pgcli-4.4.0/screenshots/image02.png +0 -0
  52. pgcli-4.4.0/screenshots/kharkiv-destroyed.jpg +0 -0
  53. pgcli-4.4.0/screenshots/pgcli.gif +0 -0
  54. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/db_utils.py +3 -7
  55. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/environment.py +26 -39
  56. pgcli-4.4.0/tests/features/fixture_data/mock_pg_service.conf +4 -0
  57. pgcli-4.4.0/tests/features/steps/__init__.py +0 -0
  58. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/steps/basic_commands.py +3 -7
  59. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/steps/crud_table.py +1 -3
  60. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/steps/iocommands.py +3 -9
  61. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/steps/wrappers.py +1 -5
  62. {pgcli-4.2.0 → pgcli-4.4.0}/tests/formatter/test_sqlformatter.py +2 -2
  63. {pgcli-4.2.0 → pgcli-4.4.0}/tests/metadata.py +15 -61
  64. pgcli-4.4.0/tests/parseutils/test_function_metadata.py +13 -0
  65. {pgcli-4.2.0 → pgcli-4.4.0}/tests/parseutils/test_parseutils.py +3 -7
  66. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_application_name.py +1 -3
  67. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_auth.py +2 -6
  68. pgcli-4.4.0/tests/test_init_commands_simple.py +94 -0
  69. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_main.py +81 -71
  70. pgcli-4.4.0/tests/test_naive_completion.py +104 -0
  71. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_pgcompleter.py +3 -9
  72. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_pgexecute.py +61 -108
  73. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_smart_completion_multiple_schemata.py +55 -127
  74. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_smart_completion_public_schema_only.py +107 -202
  75. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_sqlcompletion.py +38 -72
  76. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_ssh_tunnel.py +6 -20
  77. {pgcli-4.2.0 → pgcli-4.4.0}/tests/utils.py +7 -18
  78. pgcli-4.4.0/tox.ini +31 -0
  79. pgcli-4.2.0/pgcli/__init__.py +0 -1
  80. pgcli-4.2.0/tests/parseutils/test_function_metadata.py +0 -19
  81. pgcli-4.2.0/tests/test_naive_completion.py +0 -133
  82. /pgcli-4.2.0/pgcli/packages/__init__.py → /pgcli-4.4.0/.git-blame-ignore-revs +0 -0
  83. {pgcli-4.2.0 → pgcli-4.4.0}/LICENSE.txt +0 -0
  84. {pgcli-4.2.0 → pgcli-4.4.0}/MANIFEST.in +0 -0
  85. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/__main__.py +0 -0
  86. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/explain_output_formatter.py +0 -0
  87. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/magic.py +0 -0
  88. {pgcli-4.2.0/pgcli/packages/pgliterals → pgcli-4.4.0/pgcli/packages}/__init__.py +0 -0
  89. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/packages/formatter/__init__.py +0 -0
  90. {pgcli-4.2.0/tests/features → pgcli-4.4.0/pgcli/packages/pgliterals}/__init__.py +0 -0
  91. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/packages/pgliterals/main.py +0 -0
  92. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/packages/prioritization.py +0 -0
  93. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli/packages/prompt_utils.py +0 -0
  94. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli.egg-info/dependency_links.txt +0 -0
  95. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli.egg-info/entry_points.txt +0 -0
  96. {pgcli-4.2.0 → pgcli-4.4.0}/pgcli.egg-info/top_level.txt +0 -0
  97. {pgcli-4.2.0 → pgcli-4.4.0}/setup.cfg +0 -0
  98. {pgcli-4.2.0 → pgcli-4.4.0}/tests/conftest.py +0 -0
  99. {pgcli-4.2.0/tests/features/steps → pgcli-4.4.0/tests/features}/__init__.py +0 -0
  100. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/auto_vertical.feature +0 -0
  101. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/basic_commands.feature +0 -0
  102. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/crud_database.feature +0 -0
  103. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/crud_table.feature +0 -0
  104. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/expanded.feature +0 -0
  105. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/fixture_data/help.txt +0 -0
  106. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/fixture_data/help_commands.txt +0 -0
  107. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/fixture_utils.py +0 -0
  108. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/iocommands.feature +0 -0
  109. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/named_queries.feature +0 -0
  110. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/pgbouncer.feature +0 -0
  111. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/specials.feature +0 -0
  112. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/steps/auto_vertical.py +0 -0
  113. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/steps/crud_database.py +0 -0
  114. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/steps/expanded.py +0 -0
  115. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/steps/named_queries.py +0 -0
  116. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/steps/pgbouncer.py +0 -0
  117. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/steps/specials.py +0 -0
  118. {pgcli-4.2.0 → pgcli-4.4.0}/tests/features/wrappager.py +0 -0
  119. {pgcli-4.2.0 → pgcli-4.4.0}/tests/formatter/__init__.py +0 -0
  120. {pgcli-4.2.0 → pgcli-4.4.0}/tests/parseutils/test_ctes.py +0 -0
  121. {pgcli-4.2.0 → pgcli-4.4.0}/tests/pytest.ini +0 -0
  122. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_completion_refresher.py +0 -0
  123. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_config.py +0 -0
  124. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_fuzzy_completion.py +0 -0
  125. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_pgspecial.py +0 -0
  126. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_prioritization.py +0 -0
  127. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_prompt_utils.py +0 -0
  128. {pgcli-4.2.0 → pgcli-4.4.0}/tests/test_rowlimit.py +0 -0
@@ -0,0 +1,2 @@
1
+ [run]
2
+ source=pgcli
@@ -0,0 +1,15 @@
1
+ # editorconfig.org
2
+ # Get your text editor plugin at:
3
+ # http://editorconfig.org/#download
4
+ root = true
5
+
6
+ [*]
7
+ charset = utf-8
8
+ end_of_line = lf
9
+ indent_size = 4
10
+ indent_style = space
11
+ insert_final_newline = true
12
+ trim_trailing_whitespace = true
13
+
14
+ [travis.yml]
15
+ indent_size = 2
@@ -0,0 +1,9 @@
1
+ ## Description
2
+ <!--- Describe your problem as fully as you can. -->
3
+
4
+ ## Your environment
5
+ <!-- This gives us some more context to work with. -->
6
+
7
+ - [ ] Please provide your OS and version information.
8
+ - [ ] Please provide your CLI version.
9
+ - [ ] What is the output of ``pip freeze`` command.
@@ -0,0 +1,12 @@
1
+ ## Description
2
+ <!--- Describe your changes in detail. -->
3
+
4
+
5
+
6
+ ## Checklist
7
+ <!--- We appreciate your help and want to give you credit. Please take a moment to put an `x` in the boxes below as you complete them. -->
8
+ - [ ] I've added this contribution to the `changelog.rst`.
9
+ - [ ] I've added my name to the `AUTHORS` file (or it's already there).
10
+ <!-- We would appreciate if you comply with our code style guidelines. -->
11
+ - [ ] I installed pre-commit hooks (`pip install pre-commit && pre-commit install`).
12
+ - [x] Please squash merge this pull request (uncheck if you'd like us to merge as multiple commits)
@@ -0,0 +1,92 @@
1
+ name: pgcli
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ paths-ignore:
9
+ - '**.rst'
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+
15
+ strategy:
16
+ matrix:
17
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
18
+
19
+ services:
20
+ postgres:
21
+ image: postgres:10
22
+ env:
23
+ POSTGRES_USER: postgres
24
+ POSTGRES_PASSWORD: postgres
25
+ ports:
26
+ - 5432:5432
27
+ options: >-
28
+ --health-cmd pg_isready
29
+ --health-interval 10s
30
+ --health-timeout 5s
31
+ --health-retries 5
32
+
33
+ steps:
34
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
36
+ - uses: astral-sh/setup-uv@c7f87aa956e4c323abf06d5dec078e358f6b4d04 # v6.0.0
37
+ with:
38
+ version: "latest"
39
+
40
+ - name: Set up Python ${{ matrix.python-version }}
41
+ uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
42
+ with:
43
+ python-version: ${{ matrix.python-version }}
44
+
45
+ - name: Install pgbouncer
46
+ run: |
47
+ sudo apt install pgbouncer -y
48
+
49
+ sudo chmod 666 /etc/pgbouncer/*.*
50
+
51
+ cat <<EOF > /etc/pgbouncer/userlist.txt
52
+ "postgres" "postgres"
53
+ EOF
54
+
55
+ cat <<EOF > /etc/pgbouncer/pgbouncer.ini
56
+ [databases]
57
+ * = host=localhost port=5432
58
+ [pgbouncer]
59
+ listen_port = 6432
60
+ listen_addr = localhost
61
+ auth_type = trust
62
+ auth_file = /etc/pgbouncer/userlist.txt
63
+ logfile = pgbouncer.log
64
+ pidfile = pgbouncer.pid
65
+ admin_users = postgres
66
+ EOF
67
+
68
+ sudo systemctl stop pgbouncer
69
+
70
+ pgbouncer -d /etc/pgbouncer/pgbouncer.ini
71
+
72
+ psql -h localhost -U postgres -p 6432 pgbouncer -c 'show help'
73
+
74
+ - name: Install requirements
75
+ run: uv sync --all-extras -p ${{ matrix.python-version }}
76
+
77
+ - name: Run unit tests
78
+ run: uv run tox -e py${{ matrix.python-version }}
79
+
80
+ - name: Run integration tests
81
+ env:
82
+ PGUSER: postgres
83
+ PGPASSWORD: postgres
84
+ TERM: xterm
85
+
86
+ run: uv run tox -e integration
87
+
88
+ - name: Check changelog for ReST compliance
89
+ run: uv run tox -e rest
90
+
91
+ - name: Run style checks
92
+ run: uv run tox -e style
@@ -0,0 +1,41 @@
1
+ name: "CodeQL"
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+ schedule:
9
+ - cron: "29 13 * * 1"
10
+
11
+ jobs:
12
+ analyze:
13
+ name: Analyze
14
+ runs-on: ubuntu-latest
15
+ permissions:
16
+ actions: read
17
+ contents: read
18
+ security-events: write
19
+
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ language: [ python ]
24
+
25
+ steps:
26
+ - name: Checkout
27
+ uses: actions/checkout@v3
28
+
29
+ - name: Initialize CodeQL
30
+ uses: github/codeql-action/init@v2
31
+ with:
32
+ languages: ${{ matrix.language }}
33
+ queries: +security-and-quality
34
+
35
+ - name: Autobuild
36
+ uses: github/codeql-action/autobuild@v2
37
+
38
+ - name: Perform CodeQL Analysis
39
+ uses: github/codeql-action/analyze@v2
40
+ with:
41
+ category: "/language:${{ matrix.language }}"
@@ -0,0 +1,97 @@
1
+ name: Publish Python Package
2
+
3
+ on:
4
+ release:
5
+ types: [created]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+
14
+ strategy:
15
+ matrix:
16
+ python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
17
+
18
+ services:
19
+ postgres:
20
+ image: postgres:10
21
+ env:
22
+ POSTGRES_USER: postgres
23
+ POSTGRES_PASSWORD: postgres
24
+ ports:
25
+ - 5432:5432
26
+ options: >-
27
+ --health-cmd pg_isready
28
+ --health-interval 10s
29
+ --health-timeout 5s
30
+ --health-retries 5
31
+
32
+ steps:
33
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
35
+ - uses: astral-sh/setup-uv@c7f87aa956e4c323abf06d5dec078e358f6b4d04 # v6.0.0
36
+ with:
37
+ version: "latest"
38
+
39
+ - name: Set up Python ${{ matrix.python-version }}
40
+ uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
41
+ with:
42
+ python-version: ${{ matrix.python-version }}
43
+
44
+ - name: Install dependencies
45
+ run: uv sync --all-extras -p ${{ matrix.python-version }}
46
+
47
+ - name: Run unit tests
48
+ env:
49
+ LANG: en_US.UTF-8
50
+ run: uv run tox -e py${{ matrix.python-version }}
51
+
52
+ - name: Run Style Checks
53
+ run: uv run tox -e style
54
+
55
+ build:
56
+ runs-on: ubuntu-latest
57
+ needs: [test]
58
+
59
+ steps:
60
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
61
+ - uses: astral-sh/setup-uv@c7f87aa956e4c323abf06d5dec078e358f6b4d04 # v6.0.0
62
+ with:
63
+ version: "latest"
64
+
65
+ - name: Set up Python
66
+ uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
67
+ with:
68
+ python-version: '3.13'
69
+
70
+ - name: Install dependencies
71
+ run: uv sync --all-extras -p 3.13
72
+
73
+ - name: Build
74
+ run: uv build
75
+
76
+ - name: Store the distribution packages
77
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
78
+ with:
79
+ name: python-packages
80
+ path: dist/
81
+
82
+ publish:
83
+ name: Publish to PyPI
84
+ runs-on: ubuntu-latest
85
+ if: startsWith(github.ref, 'refs/tags/')
86
+ needs: [build]
87
+ environment: release
88
+ permissions:
89
+ id-token: write
90
+ steps:
91
+ - name: Download distribution packages
92
+ uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
93
+ with:
94
+ name: python-packages
95
+ path: dist/
96
+ - name: Publish to PyPI
97
+ uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
pgcli-4.4.0/.gitignore ADDED
@@ -0,0 +1,76 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+
5
+ # C extensions
6
+ *.so
7
+
8
+ # Distribution / packaging
9
+ .Python
10
+ env/
11
+ pyvenv/
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ *.egg-info/
23
+ .installed.cfg
24
+ *.egg
25
+
26
+ # PyInstaller
27
+ # Usually these files are written by a python script from a template
28
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
29
+ *.manifest
30
+ *.spec
31
+
32
+ # Installer logs
33
+ pip-log.txt
34
+ pip-delete-this-directory.txt
35
+
36
+ # Unit test / coverage reports
37
+ htmlcov/
38
+ .tox/
39
+ .coverage
40
+ .coverage.*
41
+ .cache
42
+ nosetests.xml
43
+ coverage.xml
44
+ .pytest_cache
45
+ tests/behave.ini
46
+
47
+ # Translations
48
+ *.mo
49
+ *.pot
50
+
51
+ # Django stuff:
52
+ *.log
53
+
54
+ # Sphinx documentation
55
+ docs/_build/
56
+
57
+ # PyBuilder
58
+ target/
59
+
60
+ # PyCharm
61
+ .idea/
62
+ *.iml
63
+
64
+ # Vagrant
65
+ .vagrant/
66
+
67
+ # Generated Packages
68
+ *.deb
69
+ *.rpm
70
+
71
+ .vscode/
72
+ venv/
73
+
74
+ .ropeproject/
75
+ uv.lock
76
+
@@ -0,0 +1,10 @@
1
+ repos:
2
+ - repo: https://github.com/astral-sh/ruff-pre-commit
3
+ # Ruff version.
4
+ rev: v0.11.7
5
+ hooks:
6
+ # Run the linter.
7
+ - id: ruff
8
+ args: [ --fix ]
9
+ # Run the formatter.
10
+ - id: ruff-format
@@ -137,7 +137,13 @@ Contributors:
137
137
  * Chris Rose (offbyone/offby1)
138
138
  * Mathieu Dupuy (deronnax)
139
139
  * Chris Novakovic
140
+ * Max Smolin (maximsmol)
140
141
  * Josh Lynch (josh-lynch)
142
+ * Fabio (3ximus)
143
+ * Doug Harris (dougharris)
144
+ * Jay Knight (jay-knight)
145
+ * fbdb
146
+ * Charbel Jacquin (charbeljc)
141
147
 
142
148
  Creator:
143
149
  --------
@@ -0,0 +1,216 @@
1
+ Development Guide
2
+ -----------------
3
+ This is a guide for developers who would like to contribute to this project.
4
+
5
+ GitHub Workflow
6
+ ---------------
7
+
8
+ If you're interested in contributing to pgcli, first of all my heart felt
9
+ thanks. `Fork the project <https://github.com/dbcli/pgcli>`_ on github. Then
10
+ clone your fork into your computer (``git clone <url-for-your-fork>``). Make
11
+ the changes and create the commits in your local machine. Then push those
12
+ changes to your fork. Then click on the pull request icon on github and create
13
+ a new pull request. Add a description about the change and send it along. I
14
+ promise to review the pull request in a reasonable window of time and get back
15
+ to you.
16
+
17
+ In order to keep your fork up to date with any changes from mainline, add a new
18
+ git remote to your local copy called 'upstream' and point it to the main pgcli
19
+ repo.
20
+
21
+ ::
22
+
23
+ $ git remote add upstream git@github.com:dbcli/pgcli.git
24
+
25
+ Once the 'upstream' end point is added you can then periodically do a ``git
26
+ pull upstream main`` to update your local copy and then do a ``git push
27
+ origin main`` to keep your own fork up to date.
28
+
29
+ Check Github's `Understanding the GitHub flow guide
30
+ <https://guides.github.com/introduction/flow/>`_ for a more detailed
31
+ explanation of this process.
32
+
33
+ Local Setup
34
+ -----------
35
+
36
+ The installation instructions in the README file are intended for users of
37
+ pgcli. If you're developing pgcli, you'll need to install it in a slightly
38
+ different way so you can see the effects of your changes right away without
39
+ having to go through the install cycle every time you change the code.
40
+
41
+ Set up [uv](https://docs.astral.sh/uv/getting-started/installation/) for development:
42
+
43
+ ::
44
+
45
+ cd pgcli
46
+ uv venv
47
+ source ./pgcli-dev/bin/activate
48
+
49
+ Once the virtualenv is activated, install pgcli using pip as follows:
50
+
51
+ ::
52
+
53
+ $ uv pip install --editable .
54
+
55
+ or
56
+
57
+ $ uv pip install -e .
58
+
59
+ This will install the necessary dependencies as well as install pgcli from the
60
+ working folder into the virtualenv. By installing it using `pip install -e`
61
+ we've linked the pgcli installation with the working copy. Any changes made
62
+ to the code are immediately available in the installed version of pgcli. This
63
+ makes it easy to change something in the code, launch pgcli and check the
64
+ effects of your changes.
65
+
66
+ Adding PostgreSQL Special (Meta) Commands
67
+ -----------------------------------------
68
+
69
+ If you want to work on adding new meta-commands (such as `\dp`, `\ds`, `dy`),
70
+ you need to contribute to `pgspecial <https://github.com/dbcli/pgspecial/>`_
71
+ project.
72
+
73
+ Visual Studio Code Debugging
74
+ -----------------------------
75
+ To set up Visual Studio Code to debug pgcli requires a launch.json file.
76
+
77
+ Within the project, create a file: .vscode\\launch.json like below.
78
+
79
+ ::
80
+
81
+ {
82
+ // Use IntelliSense to learn about possible attributes.
83
+ // Hover to view descriptions of existing attributes.
84
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
85
+ "version": "0.2.0",
86
+ "configurations": [
87
+ {
88
+ "name": "Python: Module",
89
+ "type": "python",
90
+ "request": "launch",
91
+ "module": "pgcli.main",
92
+ "justMyCode": false,
93
+ "console": "externalTerminal",
94
+ "env": {
95
+ "PGUSER": "postgres",
96
+ "PGPASS": "password",
97
+ "PGHOST": "localhost",
98
+ "PGPORT": "5432"
99
+ }
100
+ }
101
+ ]
102
+ }
103
+
104
+ Building RPM and DEB packages
105
+ -----------------------------
106
+
107
+ You will need Vagrant 1.7.2 or higher. In the project root there is a
108
+ Vagrantfile that is setup to do multi-vm provisioning. If you're setting things
109
+ up for the first time, then do:
110
+
111
+ ::
112
+
113
+ $ version=x.y.z vagrant up debian
114
+ $ version=x.y.z vagrant up centos
115
+
116
+ If you already have those VMs setup and you're merely creating a new version of
117
+ DEB or RPM package, then you can do:
118
+
119
+ ::
120
+
121
+ $ version=x.y.z vagrant provision
122
+
123
+ That will create a .deb file and a .rpm file.
124
+
125
+ The deb package can be installed as follows:
126
+
127
+ ::
128
+
129
+ $ sudo dpkg -i pgcli*.deb # if dependencies are available.
130
+
131
+ or
132
+
133
+ $ sudo apt-get install -f pgcli*.deb # if dependencies are not available.
134
+
135
+
136
+ The rpm package can be installed as follows:
137
+
138
+ ::
139
+
140
+ $ sudo yum install pgcli*.rpm
141
+
142
+ Running the integration tests
143
+ -----------------------------
144
+
145
+ Integration tests use `behave package <https://behave.readthedocs.io/>`_ and
146
+ pytest.
147
+ Configuration settings for this package are provided via a ``behave.ini`` file
148
+ in the ``tests`` directory. An example::
149
+
150
+ [behave]
151
+ stderr_capture = false
152
+
153
+ [behave.userdata]
154
+ pg_test_user = dbuser
155
+ pg_test_host = db.example.com
156
+ pg_test_port = 30000
157
+
158
+ First, install the requirements for testing:
159
+
160
+ ::
161
+ $ uv pip install ".[dev]"
162
+
163
+ Ensure that the database user has permissions to create and drop test databases
164
+ by checking your ``pg_hba.conf`` file. The default user should be ``postgres``
165
+ at ``localhost``. Make sure the authentication method is set to ``trust``. If
166
+ you made any changes to your ``pg_hba.conf`` make sure to restart the postgres
167
+ service for the changes to take effect.
168
+
169
+ ::
170
+
171
+ # ONLY IF YOU MADE CHANGES TO YOUR pg_hba.conf FILE
172
+ $ sudo service postgresql restart
173
+
174
+ After that:
175
+
176
+ ::
177
+
178
+ $ cd pgcli/tests
179
+ $ behave
180
+
181
+ Note that these ``behave`` tests do not currently work when developing on Windows due to pexpect incompatibility.
182
+
183
+ To see stdout/stderr, use the following command:
184
+
185
+ ::
186
+
187
+ $ behave --no-capture
188
+
189
+ Troubleshooting the integration tests
190
+ -------------------------------------
191
+
192
+ - Make sure postgres instance on localhost is running
193
+ - Check your ``pg_hba.conf`` file to verify local connections are enabled
194
+ - Check `this issue <https://github.com/dbcli/pgcli/issues/945>`_ for relevant information.
195
+ - `File an issue <https://github.com/dbcli/pgcli/issues/new>`_.
196
+
197
+ Running the unit tests
198
+ ----------------------
199
+
200
+ The unit tests can be run with pytest:
201
+
202
+ ::
203
+
204
+ $ cd pgcli
205
+ $ pytest
206
+
207
+
208
+ Coding Style
209
+ ------------
210
+
211
+ ``pgcli`` uses `ruff <https://github.com/astral-sh/ruff>`_ to format the source code.
212
+
213
+ Releases
214
+ --------
215
+
216
+ If you're the person responsible for releasing `pgcli`, `this guide <https://github.com/dbcli/pgcli/blob/main/RELEASES.md>`_ is for you.
pgcli-4.4.0/Dockerfile ADDED
@@ -0,0 +1,6 @@
1
+ FROM python:3.8
2
+
3
+ COPY . /app
4
+ RUN cd /app && pip install -e .
5
+
6
+ CMD pgcli