Skip to content

Commit e2c44a6

Browse files
committed
Add setup.py for git hook in pre-commits to work
1 parent 2d75485 commit e2c44a6

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

setup.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# -*- coding: utf-8 -*-
2+
from setuptools import setup
3+
4+
packages = ['readsql']
5+
6+
package_data = {'': ['*']}
7+
8+
install_requires = ['argparse>=1.4.0,<2.0.0']
9+
10+
entry_points = {'console_scripts': ['readsql = readsql.__main__:command_line']}
11+
12+
setup_kwargs = {
13+
'name': 'readsql',
14+
'version': '0.1.0',
15+
'description': 'Convert SQL to most human readable format',
16+
'long_description': '# readsql\n\nConvert SQL to most human readable format\n\nIt can convert SQL code and even SQL strings in other languages (only Python at the moment)\n\n# Installation\n\n`pip install readsql`\n\n# Usage\n\n1. Format SQL code provided in command line\n - `readsql <SQL_STRING> -s`\n2. Format an SQL file\n - `readsql <FILE_PATH>`\n\n# Usage examples\n\n1. `readsql <SQL_STRING> -s`\n - `readsql \'select sushi from tokyo\' -s`\n - returns `SELECT sushi FROM tokyo`\n2. `readsql <FILE_PATH>`\n 1. `readsql sql_example.sql`\n 2. given a Python file (ends with `.py`), it looks for variables `query` and formats their insides\n - variable to represent SQL code can be changed with `-py` option\n - `readsql sql_in_python_variable_example.py -py sql`\n - given a Python file with this code\n```python\ndef get_query():\n limit = 6\n sql = f"SELEct speed from world where animal=\'dolphin\' limit {limit}"\n return sql\n```\nconverts it to\n```python\ndef get_query():\n limit = 6\n sql = f"SELECT speed FROM world WHERE animal=\'dolphin\' LIMIT {limit}"\n return sql\n```\n\n# Development\nHaving the repo cloned\n\n- `python readsql tests/sql_example.sql` converts example SQL code to easier readable format\n- `python readsql tests/sql_in_python_example.py` converts example SQL code in Python (it looks for variables `query`)\n- we can change the SQL variable with `-py` option `python readsql tests/sql_in_python_variable_example.py -py sql`\n- `python readsql "select sushi from tokyo" -s` takes the `"select sushi from tokyo"` string as input and outputs it formatted\n\n# Testing\n\nHave `pytest` installed and run `pytest -v` (-v stands for verbose)\n',
17+
'author': 'Azis',
18+
'author_email': 'azuolas.krusna@yahoo.com',
19+
'maintainer': 'Azis',
20+
'maintainer_email': 'azuolas.krusna@yahoo.com',
21+
'url': 'https://github.com/AzisK/readsql/',
22+
'packages': packages,
23+
'package_data': package_data,
24+
'install_requires': install_requires,
25+
'entry_points': entry_points,
26+
'python_requires': '>=3.6,<4.0',
27+
}
28+
29+
30+
setup(**setup_kwargs)

0 commit comments

Comments
 (0)