Skip to content

Commit 790a3ac

Browse files
committed
Merge branch 'jchang10_mycustom' of https://github.com/jchang10/dash into jchang10_mycustom
2 parents 6ff9900 + e266ba7 commit 790a3ac

File tree

12 files changed

+202
-116
lines changed

12 files changed

+202
-116
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ As of Dash 1.2, the renderer bundle and its peer dependencies can be packed and
4242

4343
When a change in renderer code doesn't reflect in your browser as expected, this could be: confused bundle generation, caching issue in a browser, python package not in `editable` mode, etc. The new tool reduces the risk of bundle assets by adding the digest to help compare asset changes.
4444

45+
## Python 2 And 3 Compatibility
46+
47+
Writing Python 2/3 compatible code might be a challenging task for contributors used to working on one particular version, especially new learners who start directly with Python 3.
48+
49+
From the #892, we started to adopt `python-future` instead of `six` as our tool to better achieve the goal where we can mainly write Python 3 code and make it back-compatible in Python 2.7 (last Python 2 version Dash supports before it gets deprecated).
50+
51+
Please refer to [this list of idioms](https://python-future.org/compatible_idioms.html "https://python-future.org/compatible_idioms.html") for more details on working with `python-future`.
52+
4553
## Git
4654

4755
Use the [GitHub flow](https://guides.github.com/introduction/flow/) when proposing contributions to this repository (i.e. create a feature branch and submit a PR against the default branch).

dash/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Unreleased
2+
3+
### Fixed
4+
5+
- [#829](https://github.com/plotly/dash/issues/829) Fixes the `--remote` pytest argument which was not effective in the code, adding a new argument `--remote-url` to support the selenium grid usage in the cloud.
6+
17
## [1.2.0] - 2019-08-27
28
### Added
39
- [#860](https://github.com/plotly/dash/pull/860) Adds a new arg `dev_tools_prune_errors` to `app.run_server` and `app.enable_dev_tools`. Default `True`, tracebacks only include user code and below. Set it to `False` for the previous behavior showing all the Dash and Flask parts of the stack.

dash/_utils.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
import logging
1010
from io import open # pylint: disable=redefined-builtin
1111
from functools import wraps
12-
13-
import six
12+
import future.utils as utils
1413

1514
logger = logging.getLogger()
1615

@@ -57,9 +56,7 @@ def get_asset_path(requests_pathname, asset_path, asset_url_path):
5756

5857
# pylint: disable=no-member
5958
def patch_collections_abc(member):
60-
if six.PY2:
61-
return getattr(collections, member)
62-
return getattr(collections.abc, member)
59+
return getattr(collections if utils.PY2 else collections.abc, member)
6360

6461

6562
class AttributeDict(dict):
@@ -145,8 +142,8 @@ def run_command_with_process(cmd):
145142

146143

147144
def compute_md5(path):
148-
with open(path, encoding='utf-8') as fp:
149-
return hashlib.md5(fp.read().encode('utf-8')).hexdigest()
145+
with open(path, encoding="utf-8") as fp:
146+
return hashlib.md5(fp.read().encode("utf-8")).hexdigest()
150147

151148

152149
def job(msg=""):
@@ -157,5 +154,7 @@ def _wrapper(*args, **kwargs):
157154
res = func(*args, **kwargs)
158155
logger.info("::: 🍻🍻🍻 [%s] job done 🍻🍻🍻 :::", func.__name__)
159156
return res
157+
160158
return _wrapper
159+
161160
return wrapper

dash/dash.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from textwrap import dedent
1818

1919
import flask
20-
from flask import Flask, Response
2120
from flask_compress import Compress
2221
from werkzeug.debug.tbtools import get_current_traceback
2322

@@ -241,13 +240,13 @@ def __init__(
241240

242241
# We have 3 cases: server is either True (we create the server), False
243242
# (defer server creation) or a Flask app instance (we use their server)
244-
if isinstance(server, Flask):
243+
if isinstance(server, flask.Flask):
245244
self.server = server
246245
if name is None:
247246
name = getattr(server, 'name', '__main__')
248247
elif isinstance(server, bool):
249248
name = name if name else '__main__'
250-
self.server = Flask(name) if server else None
249+
self.server = flask.Flask(name) if server else None
251250
else:
252251
raise ValueError('server must be a Flask app or a boolean')
253252

@@ -678,7 +677,7 @@ def serve_component_suites(self, package_name, path_in_package_dist):
678677
'map': 'application/json'
679678
})[path_in_package_dist.split('.')[-1]]
680679

681-
return Response(
680+
return flask.Response(
682681
pkgutil.get_data(package_name, path_in_package_dist),
683682
mimetype=mimetype
684683
)

0 commit comments

Comments
 (0)