Skip to content

Commit

Permalink
Merge pull request #473 from plotly/fix-imports
Browse files Browse the repository at this point in the history
Fix `_imports_.py` generation
  • Loading branch information
T4rk1n committed Nov 29, 2018
2 parents 951c890 + 2f5d6e9 commit 93f82c6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
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'

0 comments on commit 93f82c6

Please sign in to comment.