Skip to content

Commit 4423ca1

Browse files
committed
Merge branch 'devel'
2 parents 97a1b0b + 74f3ddf commit 4423ca1

6 files changed

Lines changed: 22 additions & 18 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#### 3.0.0
1+
#### 3.0.1
22
* **Removed Python 2.7 support**
33
* **Added Python 3.8 support**
44
* Renamed package name to `styleframe` (all lowercase) in accordance of PEP8
@@ -13,6 +13,7 @@
1313
* Added `read_excel_as_template` method
1414
* Fixed a bug that prevented saving if `read_excel` was used with `use_openpxl_style=True`, see github issue #67
1515
* Allowing usage of pathlib.Path in `to_excel`, see github issue #69
16+
* Added ability to execute the tests from the commandline: `styleframe --test`
1617

1718
#### 2.0.5
1819
* `style_alternate_rows` can accept all arguments that `apply_style_by_indexes` accepts as kwargs.

docs/commandline_interface.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ that lets you create an xlsx file from a json file.
1010
Usage
1111
-----
1212

13-
================= =========================================================================
14-
Flag Explanation
15-
================= =========================================================================
16-
``-v`` Displays the installed versions of styleframe and its dependencies
17-
``--json_path`` Path to the json file
13+
==================================== =========================================================================
14+
Flag Explanation
15+
==================================== =========================================================================
16+
``-v`` Displays the installed versions of styleframe and its dependencies
17+
``--json_path`` or ``--json-path`` Path to the json file
1818
``--json`` json string
19-
``--output_path`` Path to the output xlsx file. If not provided defaults to ``output.xlsx``
20-
================= =========================================================================
19+
``--output_path`` or ``output-path`` Path to the output xlsx file. If not provided defaults to ``output.xlsx``
20+
``--test`` Execute the tests
21+
==================================== =========================================================================
2122

2223

2324
Usage Examples

setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def find_version(*file_paths):
2424

2525

2626
setup(
27-
name='StyleFrame',
27+
name='styleframe',
2828

2929
# Versions should comply with PEP440. For a discussion on single-sourcing
3030
# the version across setup.py and the project code, see
@@ -42,7 +42,7 @@ def find_version(*file_paths):
4242
author_email='deepspace2@gmail.com',
4343

4444
entry_points={
45-
'console_scripts': ['styleframe = StyleFrame.command_line.commandline:execute_from_command_line']
45+
'console_scripts': ['styleframe = styleframe.command_line.commandline:execute_from_command_line']
4646
},
4747

4848
# Choose your license

styleframe/command_line/commandline.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from collections import defaultdict
88
from pprint import pprint
99

10-
from .. import StyleFrame, Container, Styler, version
10+
from .. import StyleFrame, Container, Styler, version, tests
1111
from .tests.json_schema import commandline_json_schema
1212

1313
styler_kwargs = set(inspect.signature(Styler).parameters.keys())
@@ -91,17 +91,18 @@ def get_cli_args():
9191

9292
group.add_argument('-v', '--version', action='store_true', default=False,
9393
help='print versions of the Python interpreter, openpyxl, pandas and StyleFrame then quit')
94-
group.add_argument('--json_path', help='path to json file which defines the Excel file')
94+
group.add_argument('--json_path', '--json-path', help='path to json file which defines the Excel file')
9595
group.add_argument('--json', help='json string which defines the Excel file')
9696
group.add_argument('--show-schema', action='store_true', help='Print the JSON schema used for validation and exit',
9797
default=False)
98-
parser.add_argument('--output_path', help='path of output Excel file, defaults to output.xlsx',
98+
group.add_argument('--test', help='execute tests', action='store_true')
99+
parser.add_argument('--output_path', '--output-path', help='path of output Excel file, defaults to output.xlsx',
99100
default='output.xlsx')
100101

101102
cli_args = parser.parse_args()
102103

103-
if not any((cli_args.version, cli_args.show_schema)) and not any((cli_args.json_path, cli_args.json)):
104-
parser.error('Either --json_path or --json are required when not using -v.')
104+
if not any((cli_args.version, cli_args.show_schema, cli_args.test)) and not any((cli_args.json_path, cli_args.json)):
105+
parser.error('Either --json_path or --json are required when not using -v or --show-schema')
105106

106107
return cli_args
107108

@@ -114,6 +115,9 @@ def execute_from_command_line():
114115
if cli_args.show_schema:
115116
pprint(commandline_json_schema)
116117
return
118+
if cli_args.test:
119+
tests.tests.run()
120+
return
117121
CommandLineInterface(input_path=cli_args.json_path, input_json=cli_args.json,
118122
output_path=cli_args.output_path).parse_as_json()
119123

styleframe/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def get_all_versions():
1717
return _versions_
1818

1919

20-
_version_ = '3.0.0'
20+
_version_ = '3.0.1'
2121
_python_version_ = get_python_version()
2222
_pandas_version_ = get_pandas_version()
2323
_openpyxl_version_ = get_openpyxl_version()

0 commit comments

Comments
 (0)