-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use flit to build the package, add simple test
- Loading branch information
Showing
9 changed files
with
186 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Python application | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
test: | ||
name: Run tests on ${{ matrix.py }} | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
py: | ||
- "3.11" | ||
- "3.10" | ||
- "3.9" | ||
- "3.8" | ||
- "3.7" | ||
- "pypy-3.9" | ||
- "pypy-3.8" | ||
- "pypy-3.7" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.py }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.py }} | ||
check-latest: true | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip flit | ||
flit install --deps=develop | ||
- name: Lint with flake8 | ||
run: flake8 clickhouse_cli --count --max-complexity=31 --show-source --statistics | ||
- name: Test with pytest | ||
run: pytest --cov=clickhouse_cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ | |
*.egg-info | ||
dist | ||
build | ||
.coverage | ||
.tox/* | ||
.python-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
install: clean | ||
python setup.py install | ||
PYTHON=`which python` | ||
|
||
dev: | ||
$(PYTHON) -m pip install --upgrade pip flit | ||
$(PYTHON) -m flit install --deps=develop | ||
|
||
build: clean | ||
$(PYTHON) -m flit build | ||
|
||
install: build | ||
$(PYTHON) -m flit install --deps=production | ||
|
||
clean: | ||
$(PYTHON) setup.py clean | ||
find . -name '*.pyc' -delete | ||
find . -name '*~' -delete | ||
rm -rf clickhouse_cli.egg-info build dist | ||
|
||
test: | ||
tox | ||
|
||
register: | ||
python setup.py register -r pypi | ||
$(PYTHON) setup.py register -r pypi | ||
|
||
upload: | ||
python setup.py sdist upload -r pypi | ||
$(PYTHON) setup.py sdist upload -r pypi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env python | ||
# | ||
"""Entrypoint module for `python -m clickhouse_cli`. | ||
Why does this file exist, and why __main__? For more info, read: | ||
- https://www.python.org/dev/peps/pep-0338/ | ||
- https://docs.python.org/2/using/cmdline.html#cmdoption-m | ||
- https://docs.python.org/3/using/cmdline.html#cmdoption-m | ||
""" | ||
|
||
import sys | ||
|
||
from clickhouse_cli.cli import run_cli | ||
|
||
if __name__ == '__main__': | ||
sys.exit(run_cli()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
[build-system] | ||
requires = ["flit_core >=3.2,<4"] | ||
build-backend = "flit_core.buildapi" | ||
|
||
[project] | ||
name = "clickhouse-cli" | ||
description = "A third-party client for the Clickhouse DBMS server." | ||
authors = [{name = "Igor Hatarist", email = "igor@hatari.st"}] | ||
readme = "README.md" | ||
dynamic = ["version"] | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: Implementation :: PyPy", | ||
"Topic :: Database", | ||
"Topic :: Software Development", | ||
] | ||
requires-python = ">=3.7" | ||
dependencies = [ | ||
"click>=6.6", | ||
"prompt-toolkit>=2.0", | ||
"pygments>=2.1.3", | ||
"requests>=2.11.1", | ||
"sqlparse>=0.2.2", | ||
] | ||
|
||
[project.urls] | ||
Home = "https://github.com/hatarist/clickhouse-cli" | ||
Documentation = "https://github.com/hatarist/clickhouse-cli" | ||
Source = "https://github.com/hatarist/clickhouse-cli" | ||
Tracker = "https://github.com/hatarist/clickhouse-cli/issues" | ||
|
||
[project.scripts] | ||
clickhouse-cli = "clickhouse_cli.cli:run_cli" | ||
|
||
[project.optional-dependencies] | ||
dev = [ | ||
"flake8", | ||
"build", | ||
] | ||
test = [ | ||
"pytest", | ||
"pytest-cov", | ||
] | ||
doc = [ | ||
"sphinx", | ||
] | ||
tox = [ | ||
"virtualenv", | ||
"tox", | ||
] | ||
|
||
[tool.flit.sdist] | ||
include = [ | ||
"tests/*.py", | ||
"LICENSE.txt", | ||
"Makefile", | ||
"tox.ini", | ||
] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import pytest | ||
|
||
from clickhouse_cli.cli import run_cli | ||
|
||
|
||
def test_main_help(): | ||
# Call with the --help option as a basic sanity check. | ||
with pytest.raises(SystemExit) as exinfo: | ||
run_cli(["--help", ]) | ||
assert exinfo.value.code == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[tox] | ||
skip_missing_interpreters = True | ||
envlist = | ||
py37 | ||
py38 | ||
py39 | ||
py310 | ||
py311 | ||
flake8 | ||
|
||
[testenv] | ||
deps = | ||
pytest | ||
pytest-cov | ||
commands = | ||
pytest --cov=clickhouse_cli {posargs} | ||
|
||
[testenv:flake8] | ||
deps = | ||
flake8 | ||
commands = | ||
flake8 clickhouse_cli tests setup.py | ||
|
||
[flake8] | ||
extend-ignore = E501 |