Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix _imports_.py generation #473

Merged
merged 2 commits into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## 0.31.0 - 2018-11-26
## 0.31.1 - 2018-11-29
## Fixed
- Fix `_imports_.py` indentation generation. [#473](https://github.com/plotly/dash/pull/473/files)

## 0.31.0 - 2018-11-29
## Added
- Combined `extract-meta` and python component files generation in a cli [#451](https://github.com/plotly/dash/pull/451)

Expand Down
22 changes: 8 additions & 14 deletions dash/development/_py_components_generation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import collections
import copy
import os
import textwrap

from dash.development.base_component import _explicitize_args
from ._all_keywords import kwlist
Expand Down Expand Up @@ -167,19 +166,14 @@ def generate_class_file(typename, props, description, namespace):

def generate_imports(project_shortname, components):
with open(os.path.join(project_shortname, '_imports_.py'), 'w') as f:
f.write(textwrap.dedent(
'''
{}

__all__ = [
{}
]
'''.format(
'\n'.join(
'from .{0} import {0}'.format(x) for x in components),
',\n'.join(' "{}"'.format(x) for x in components)
)
).lstrip())
imports_string = '{}\n\n{}'.format(
'\n'.join(
'from .{0} import {0}'.format(x) for x in components),
'__all__ = [\n{}\n]'.format(
',\n'.join(' "{}"'.format(x) for x in components))
)

f.write(imports_string)


def generate_classes_files(project_shortname, metadata, *component_generators):
Expand Down
2 changes: 1 addition & 1 deletion dash/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.31.0'
__version__ = '0.31.1'