pgcli 4.3.0__tar.gz → 4.5.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.
- pgcli-4.5.0/.coveragerc +2 -0
- pgcli-4.5.0/.editorconfig +15 -0
- pgcli-4.5.0/.github/ISSUE_TEMPLATE.md +9 -0
- pgcli-4.5.0/.github/PULL_REQUEST_TEMPLATE.md +11 -0
- pgcli-4.5.0/.github/workflows/ci.yml +92 -0
- pgcli-4.5.0/.github/workflows/codeql.yml +41 -0
- pgcli-4.5.0/.github/workflows/codex-review.yml +91 -0
- pgcli-4.5.0/.github/workflows/publish.yml +97 -0
- pgcli-4.5.0/.gitignore +76 -0
- pgcli-4.5.0/.pre-commit-config.yaml +10 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/AUTHORS +7 -0
- pgcli-4.5.0/CONTRIBUTING.rst +179 -0
- pgcli-4.5.0/Dockerfile +6 -0
- {pgcli-4.3.0/pgcli.egg-info → pgcli-4.5.0}/PKG-INFO +37 -41
- {pgcli-4.3.0 → pgcli-4.5.0}/README.rst +22 -36
- pgcli-4.5.0/RELEASES.md +6 -0
- pgcli-4.5.0/TODO +12 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/changelog.rst +49 -0
- pgcli-4.5.0/pgcli/__init__.py +1 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/auth.py +2 -6
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/completion_refresher.py +2 -6
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/config.py +0 -1
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/key_bindings.py +1 -2
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/magic.py +1 -1
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/main.py +168 -166
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/packages/formatter/sqlformatter.py +3 -10
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/packages/parseutils/__init__.py +3 -3
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/packages/parseutils/ctes.py +4 -1
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/packages/parseutils/meta.py +2 -8
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/packages/parseutils/tables.py +8 -20
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/packages/parseutils/utils.py +4 -3
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/packages/pgliterals/pgliterals.json +2 -1
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/packages/prioritization.py +2 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/packages/sqlcompletion.py +31 -45
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/pgbuffer.py +14 -13
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/pgclirc +27 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/pgcompleter.py +48 -146
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/pgexecute.py +30 -27
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/pgstyle.py +1 -3
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/pgtoolbar.py +4 -12
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/pyev.py +13 -35
- pgcli-4.5.0/pgcli-completion.bash +76 -0
- {pgcli-4.3.0 → pgcli-4.5.0/pgcli.egg-info}/PKG-INFO +37 -41
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli.egg-info/SOURCES.txt +29 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli.egg-info/requires.txt +15 -1
- pgcli-4.5.0/post-install +4 -0
- pgcli-4.5.0/post-remove +4 -0
- pgcli-4.5.0/pylintrc +2 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/pyproject.toml +72 -30
- pgcli-4.5.0/release.py +132 -0
- pgcli-4.5.0/sanity_checks.txt +37 -0
- pgcli-4.5.0/screenshots/image01.png +0 -0
- pgcli-4.5.0/screenshots/image02.png +0 -0
- pgcli-4.5.0/screenshots/kharkiv-destroyed.jpg +0 -0
- pgcli-4.5.0/screenshots/pgcli.gif +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/conftest.py +8 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/db_utils.py +3 -7
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/environment.py +26 -39
- pgcli-4.5.0/tests/features/fixture_data/mock_pg_service.conf +4 -0
- pgcli-4.5.0/tests/features/steps/__init__.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/steps/basic_commands.py +3 -7
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/steps/crud_table.py +1 -3
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/steps/iocommands.py +3 -9
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/steps/wrappers.py +1 -5
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/formatter/test_sqlformatter.py +2 -2
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/metadata.py +15 -61
- pgcli-4.5.0/tests/parseutils/test_function_metadata.py +13 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/parseutils/test_parseutils.py +3 -7
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_application_name.py +1 -3
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_auth.py +2 -6
- pgcli-4.5.0/tests/test_init_commands_simple.py +94 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_main.py +72 -72
- pgcli-4.5.0/tests/test_naive_completion.py +111 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_pgcompleter.py +3 -9
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_pgexecute.py +70 -117
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_rowlimit.py +26 -2
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_smart_completion_multiple_schemata.py +55 -127
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_smart_completion_public_schema_only.py +113 -202
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_sqlcompletion.py +38 -72
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_ssh_tunnel.py +6 -20
- pgcli-4.5.0/tests/test_trailing_comments.py +47 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/utils.py +7 -18
- pgcli-4.5.0/tox.ini +42 -0
- pgcli-4.3.0/pgcli/__init__.py +0 -1
- pgcli-4.3.0/tests/parseutils/test_function_metadata.py +0 -19
- pgcli-4.3.0/tests/test_naive_completion.py +0 -133
- /pgcli-4.3.0/pgcli/packages/__init__.py → /pgcli-4.5.0/.git-blame-ignore-revs +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/LICENSE.txt +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/MANIFEST.in +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/__main__.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/explain_output_formatter.py +0 -0
- {pgcli-4.3.0/pgcli/packages/pgliterals → pgcli-4.5.0/pgcli/packages}/__init__.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/packages/formatter/__init__.py +0 -0
- {pgcli-4.3.0/tests/features → pgcli-4.5.0/pgcli/packages/pgliterals}/__init__.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/packages/pgliterals/main.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli/packages/prompt_utils.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli.egg-info/dependency_links.txt +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli.egg-info/entry_points.txt +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/pgcli.egg-info/top_level.txt +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/setup.cfg +0 -0
- {pgcli-4.3.0/tests/features/steps → pgcli-4.5.0/tests/features}/__init__.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/auto_vertical.feature +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/basic_commands.feature +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/crud_database.feature +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/crud_table.feature +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/expanded.feature +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/fixture_data/help.txt +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/fixture_data/help_commands.txt +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/fixture_utils.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/iocommands.feature +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/named_queries.feature +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/pgbouncer.feature +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/specials.feature +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/steps/auto_vertical.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/steps/crud_database.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/steps/expanded.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/steps/named_queries.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/steps/pgbouncer.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/steps/specials.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/features/wrappager.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/formatter/__init__.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/parseutils/test_ctes.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/pytest.ini +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_completion_refresher.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_config.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_fuzzy_completion.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_pgspecial.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_prioritization.py +0 -0
- {pgcli-4.3.0 → pgcli-4.5.0}/tests/test_prompt_utils.py +0 -0
pgcli-4.5.0/.coveragerc
ADDED
|
@@ -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,11 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
<!--- Describe your changes in detail. -->
|
|
3
|
+
|
|
4
|
+
## Checklist
|
|
5
|
+
<!--- 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. -->
|
|
6
|
+
- [ ] I've added this contribution to the `changelog.rst`.
|
|
7
|
+
- [ ] I've added my name to the `AUTHORS` file (or it's already there).
|
|
8
|
+
<!-- We would appreciate if you comply with our code style guidelines. -->
|
|
9
|
+
- [ ] I installed pre-commit hooks (`pip install pre-commit && pre-commit install`).
|
|
10
|
+
- [ ] I verified that my changes work as expected (this may include manually testing them in your local environment, or in other available environments). Cross this out if not relevant (for example, if you're making a documentation change).
|
|
11
|
+
- [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.10", "3.11", "3.12", "3.13", "3.14"]
|
|
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,91 @@
|
|
|
1
|
+
name: Codex Review
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request_target:
|
|
5
|
+
types: [opened, labeled, reopened, ready_for_review]
|
|
6
|
+
paths-ignore:
|
|
7
|
+
- '**.md'
|
|
8
|
+
- '**.rst'
|
|
9
|
+
- 'LICENSE.txt'
|
|
10
|
+
- 'doc/**/*.txt'
|
|
11
|
+
- '**/AUTHORS'
|
|
12
|
+
- '**/SPONSORS'
|
|
13
|
+
- '**/TIPS'
|
|
14
|
+
- 'pgcli-completion.bash'
|
|
15
|
+
- 'sanity_checks.txt'
|
|
16
|
+
- 'post-install'
|
|
17
|
+
- 'post-remove'
|
|
18
|
+
- 'screenshots/**'
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
codex-review:
|
|
22
|
+
if: github.event.pull_request.draft == false || (github.event.action == 'labeled' && contains(github.event.pull_request.labels.*.name, 'codex'))
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
permissions:
|
|
25
|
+
contents: read
|
|
26
|
+
outputs:
|
|
27
|
+
final_message: ${{ steps.run_codex.outputs.final-message }}
|
|
28
|
+
|
|
29
|
+
steps:
|
|
30
|
+
- name: Check out PR merge commit
|
|
31
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
32
|
+
with:
|
|
33
|
+
ref: refs/pull/${{ github.event.pull_request.number }}/merge
|
|
34
|
+
|
|
35
|
+
- name: Fetch base and head refs
|
|
36
|
+
run: |
|
|
37
|
+
git fetch --no-tags origin \
|
|
38
|
+
${{ github.event.pull_request.base.ref }} \
|
|
39
|
+
+refs/pull/${{ github.event.pull_request.number }}/head
|
|
40
|
+
|
|
41
|
+
- name: Run Codex review
|
|
42
|
+
id: run_codex
|
|
43
|
+
uses: openai/codex-action@v1
|
|
44
|
+
env:
|
|
45
|
+
# Use env variables to handle untrusted metadata safely
|
|
46
|
+
PR_TITLE: ${{ github.event.pull_request.title }}
|
|
47
|
+
PR_BODY: ${{ github.event.pull_request.body }}
|
|
48
|
+
with:
|
|
49
|
+
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
|
|
50
|
+
prompt: |
|
|
51
|
+
You are reviewing PR #${{ github.event.pull_request.number }} for ${{ github.repository }}.
|
|
52
|
+
|
|
53
|
+
Only review changes introduced by this PR:
|
|
54
|
+
git log --oneline ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}
|
|
55
|
+
|
|
56
|
+
Focus on:
|
|
57
|
+
- correctness bugs and regressions
|
|
58
|
+
- security concerns
|
|
59
|
+
- missing tests or edge cases
|
|
60
|
+
|
|
61
|
+
Keep feedback concise and actionable.
|
|
62
|
+
|
|
63
|
+
Pull request title and body:
|
|
64
|
+
----
|
|
65
|
+
$PR_TITLE
|
|
66
|
+
$PR_BODY
|
|
67
|
+
|
|
68
|
+
post-feedback:
|
|
69
|
+
runs-on: ubuntu-latest
|
|
70
|
+
needs: codex-review
|
|
71
|
+
if: needs.codex-review.outputs.final_message != ''
|
|
72
|
+
permissions:
|
|
73
|
+
issues: write
|
|
74
|
+
pull-requests: write
|
|
75
|
+
|
|
76
|
+
steps:
|
|
77
|
+
- name: Post Codex review as PR comment
|
|
78
|
+
uses: actions/github-script@v8
|
|
79
|
+
env:
|
|
80
|
+
CODEX_FINAL_MESSAGE: |
|
|
81
|
+
${{ format('## Codex Review
|
|
82
|
+
{0}', needs.codex-review.outputs.final_message) }}
|
|
83
|
+
with:
|
|
84
|
+
github-token: ${{ github.token }}
|
|
85
|
+
script: |
|
|
86
|
+
await github.rest.issues.createComment({
|
|
87
|
+
owner: context.repo.owner,
|
|
88
|
+
repo: context.repo.repo,
|
|
89
|
+
issue_number: context.payload.pull_request.number,
|
|
90
|
+
body: process.env.CODEX_FINAL_MESSAGE,
|
|
91
|
+
});
|
|
@@ -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.10", "3.11", "3.12", "3.13", "3.14"]
|
|
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.14
|
|
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.5.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
|
+
|
|
@@ -141,6 +141,13 @@ Contributors:
|
|
|
141
141
|
* Josh Lynch (josh-lynch)
|
|
142
142
|
* Fabio (3ximus)
|
|
143
143
|
* Doug Harris (dougharris)
|
|
144
|
+
* Jay Knight (jay-knight)
|
|
145
|
+
* fbdb
|
|
146
|
+
* Charbel Jacquin (charbeljc)
|
|
147
|
+
* Devadathan M B (devadathanmb)
|
|
148
|
+
* Charalampos Stratakis
|
|
149
|
+
* Laszlo Bimba (bimlas)
|
|
150
|
+
* Anjanna
|
|
144
151
|
|
|
145
152
|
Creator:
|
|
146
153
|
--------
|
|
@@ -0,0 +1,179 @@
|
|
|
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
|
+
|
|
105
|
+
Running the integration tests
|
|
106
|
+
-----------------------------
|
|
107
|
+
|
|
108
|
+
Integration tests use `behave package <https://behave.readthedocs.io/>`_ and
|
|
109
|
+
pytest.
|
|
110
|
+
Configuration settings for this package are provided via a ``behave.ini`` file
|
|
111
|
+
in the ``tests`` directory. An example::
|
|
112
|
+
|
|
113
|
+
[behave]
|
|
114
|
+
stderr_capture = false
|
|
115
|
+
|
|
116
|
+
[behave.userdata]
|
|
117
|
+
pg_test_user = dbuser
|
|
118
|
+
pg_test_host = db.example.com
|
|
119
|
+
pg_test_port = 30000
|
|
120
|
+
|
|
121
|
+
First, install the requirements for testing:
|
|
122
|
+
|
|
123
|
+
::
|
|
124
|
+
$ uv pip install ".[dev]"
|
|
125
|
+
|
|
126
|
+
Ensure that the database user has permissions to create and drop test databases
|
|
127
|
+
by checking your ``pg_hba.conf`` file. The default user should be ``postgres``
|
|
128
|
+
at ``localhost``. Make sure the authentication method is set to ``trust``. If
|
|
129
|
+
you made any changes to your ``pg_hba.conf`` make sure to restart the postgres
|
|
130
|
+
service for the changes to take effect.
|
|
131
|
+
|
|
132
|
+
::
|
|
133
|
+
|
|
134
|
+
# ONLY IF YOU MADE CHANGES TO YOUR pg_hba.conf FILE
|
|
135
|
+
$ sudo service postgresql restart
|
|
136
|
+
|
|
137
|
+
After that:
|
|
138
|
+
|
|
139
|
+
::
|
|
140
|
+
|
|
141
|
+
$ cd pgcli/tests
|
|
142
|
+
$ behave
|
|
143
|
+
|
|
144
|
+
Note that these ``behave`` tests do not currently work when developing on Windows due to pexpect incompatibility.
|
|
145
|
+
|
|
146
|
+
To see stdout/stderr, use the following command:
|
|
147
|
+
|
|
148
|
+
::
|
|
149
|
+
|
|
150
|
+
$ behave --no-capture
|
|
151
|
+
|
|
152
|
+
Troubleshooting the integration tests
|
|
153
|
+
-------------------------------------
|
|
154
|
+
|
|
155
|
+
- Make sure postgres instance on localhost is running
|
|
156
|
+
- Check your ``pg_hba.conf`` file to verify local connections are enabled
|
|
157
|
+
- Check `this issue <https://github.com/dbcli/pgcli/issues/945>`_ for relevant information.
|
|
158
|
+
- `File an issue <https://github.com/dbcli/pgcli/issues/new>`_.
|
|
159
|
+
|
|
160
|
+
Running the unit tests
|
|
161
|
+
----------------------
|
|
162
|
+
|
|
163
|
+
The unit tests can be run with pytest:
|
|
164
|
+
|
|
165
|
+
::
|
|
166
|
+
|
|
167
|
+
$ cd pgcli
|
|
168
|
+
$ pytest
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
Coding Style
|
|
172
|
+
------------
|
|
173
|
+
|
|
174
|
+
``pgcli`` uses `ruff <https://github.com/astral-sh/ruff>`_ to format the source code.
|
|
175
|
+
|
|
176
|
+
Releases
|
|
177
|
+
--------
|
|
178
|
+
|
|
179
|
+
If you're the person responsible for releasing `pgcli`, `this guide <https://github.com/dbcli/pgcli/blob/main/RELEASES.md>`_ is for you.
|