Skip to content

Commit

Permalink
Merge pull request #1180 from dbcli/modernize
Browse files Browse the repository at this point in the history
Modernize
  • Loading branch information
amjith authored Nov 25, 2024
2 parents b3efe01 + c21dec0 commit a8f9687
Show file tree
Hide file tree
Showing 66 changed files with 3,670 additions and 3,348 deletions.
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[run]
parallel = True
source = mycli
46 changes: 12 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,21 @@ on:
pull_request:
paths-ignore:
- '**.md'
- 'AUTHORS'

jobs:
linux:
build:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [
'3.8',
'3.9',
'3.10',
'3.11',
'3.12',
]
include:
- python-version: '3.8'
os: ubuntu-20.04 # MySQL 8.0.36
- python-version: '3.9'
os: ubuntu-20.04 # MySQL 8.0.36
- python-version: '3.10'
os: ubuntu-22.04 # MySQL 8.0.36
- python-version: '3.11'
os: ubuntu-22.04 # MySQL 8.0.36
- python-version: '3.12'
os: ubuntu-22.04 # MySQL 8.0.36
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

runs-on: ${{ matrix.os }}
steps:

- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v1
with:
version: "latest"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
Expand All @@ -43,10 +30,7 @@ jobs:
sudo /etc/init.d/mysql start
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install --no-cache-dir -e .
run: uv sync --all-extras -p ${{ matrix.python-version }}

- name: Wait for MySQL connection
run: |
Expand All @@ -59,13 +43,7 @@ jobs:
PYTEST_PASSWORD: root
PYTEST_HOST: 127.0.0.1
run: |
./setup.py test --pytest-args="--cov-report= --cov=mycli"
uv run tox -e py${{ matrix.python-version }}
- name: Lint
run: |
./setup.py lint --branch=HEAD
- name: Coverage
run: |
coverage combine
coverage report
- name: Run Style Checks
run: uv run tox -e style
80 changes: 80 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Publish Python Package

on:
release:
types: [created]

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v1
with:
version: "latest"

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --all-extras -p ${{ matrix.python-version }}

- name: Run unit tests
run: uv run tox -e py${{ matrix.python-version }}

- name: Run Style Checks
run: uv run tox -e style

build:
runs-on: ubuntu-latest
needs: [test]

steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v1
with:
version: "latest"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: uv sync --all-extras -p 3.12

- name: Build
run: uv build

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-packages
path: dist/

publish:
name: Publish to PyPI
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [build]
environment: release
permissions:
id-token: write
steps:
- name: Download distribution packages
uses: actions/download-artifact@v4
with:
name: python-packages
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
12 changes: 5 additions & 7 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
Upcoming Release (TBD)
======================
1.29.0 (TBD)
============

Bug Fixes:
Bug Fixes
----------

* fix SSL through SSH jump host by using a true python socket for a tunnel

Internal:
---------

Features:
Internal
---------

* Modernize to use PEP-621. Use `uv` instead of `pip` in GH actions.

1.28.0 (2024/11/10)
======================
Expand Down
4 changes: 3 additions & 1 deletion mycli/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
__version__ = "1.28.0"
import importlib.metadata

__version__ = importlib.metadata.version("mycli")
40 changes: 20 additions & 20 deletions mycli/clibuffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def cond():
return False
else:
return not _multiline_exception(doc.text)

return cond


Expand All @@ -23,33 +24,32 @@ def _multiline_exception(text):
# Multi-statement favorite query is a special case. Because there will
# be a semicolon separating statements, we can't consider semicolon an
# EOL. Let's consider an empty line an EOL instead.
if text.startswith('\\fs'):
return orig.endswith('\n')
if text.startswith("\\fs"):
return orig.endswith("\n")

return (
# Special Command
text.startswith('\\') or

text.startswith("\\")
or
# Delimiter declaration
text.lower().startswith('delimiter') or

text.lower().startswith("delimiter")
or
# Ended with the current delimiter (usually a semi-column)
text.endswith(special.get_current_delimiter()) or

text.endswith('\\g') or
text.endswith('\\G') or
text.endswith(r'\e') or
text.endswith(r'\clip') or

text.endswith(special.get_current_delimiter())
or text.endswith("\\g")
or text.endswith("\\G")
or text.endswith(r"\e")
or text.endswith(r"\clip")
or
# Exit doesn't need semi-column`
(text == 'exit') or

(text == "exit")
or
# Quit doesn't need semi-column
(text == 'quit') or

(text == "quit")
or
# To all teh vim fans out there
(text == ':q') or

(text == ":q")
or
# just a plain enter without any text
(text == '')
(text == "")
)
Loading

0 comments on commit a8f9687

Please sign in to comment.