Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepSpace2 committed Jun 9, 2020
2 parents 97a1b0b + 74f3ddf commit 4423ca1
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 18 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#### 3.0.0
#### 3.0.1
* **Removed Python 2.7 support**
* **Added Python 3.8 support**
* Renamed package name to `styleframe` (all lowercase) in accordance of PEP8
Expand All @@ -13,6 +13,7 @@
* Added `read_excel_as_template` method
* Fixed a bug that prevented saving if `read_excel` was used with `use_openpxl_style=True`, see github issue #67
* Allowing usage of pathlib.Path in `to_excel`, see github issue #69
* Added ability to execute the tests from the commandline: `styleframe --test`

#### 2.0.5
* `style_alternate_rows` can accept all arguments that `apply_style_by_indexes` accepts as kwargs.
Expand Down
15 changes: 8 additions & 7 deletions docs/commandline_interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ that lets you create an xlsx file from a json file.
Usage
-----

================= =========================================================================
Flag Explanation
================= =========================================================================
``-v`` Displays the installed versions of styleframe and its dependencies
``--json_path`` Path to the json file
==================================== =========================================================================
Flag Explanation
==================================== =========================================================================
``-v`` Displays the installed versions of styleframe and its dependencies
``--json_path`` or ``--json-path`` Path to the json file
``--json`` json string
``--output_path`` Path to the output xlsx file. If not provided defaults to ``output.xlsx``
================= =========================================================================
``--output_path`` or ``output-path`` Path to the output xlsx file. If not provided defaults to ``output.xlsx``
``--test`` Execute the tests
==================================== =========================================================================


Usage Examples
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def find_version(*file_paths):


setup(
name='StyleFrame',
name='styleframe',

# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
Expand All @@ -42,7 +42,7 @@ def find_version(*file_paths):
author_email='[email protected]',

entry_points={
'console_scripts': ['styleframe = StyleFrame.command_line.commandline:execute_from_command_line']
'console_scripts': ['styleframe = styleframe.command_line.commandline:execute_from_command_line']
},

# Choose your license
Expand Down
14 changes: 9 additions & 5 deletions styleframe/command_line/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from collections import defaultdict
from pprint import pprint

from .. import StyleFrame, Container, Styler, version
from .. import StyleFrame, Container, Styler, version, tests
from .tests.json_schema import commandline_json_schema

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

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

cli_args = parser.parse_args()

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

return cli_args

Expand All @@ -114,6 +115,9 @@ def execute_from_command_line():
if cli_args.show_schema:
pprint(commandline_json_schema)
return
if cli_args.test:
tests.tests.run()
return
CommandLineInterface(input_path=cli_args.json_path, input_json=cli_args.json,
output_path=cli_args.output_path).parse_as_json()

Expand Down
2 changes: 1 addition & 1 deletion styleframe/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def get_all_versions():
return _versions_


_version_ = '3.0.0'
_version_ = '3.0.1'
_python_version_ = get_python_version()
_pandas_version_ = get_pandas_version()
_openpyxl_version_ = get_openpyxl_version()
Expand Down

0 comments on commit 4423ca1

Please sign in to comment.