Skip to content

Commit 713b4d5

Browse files
configure src layout
1 parent a2c29e2 commit 713b4d5

11 files changed

+118
-117
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ jobs:
4949
name: 🏁 Build Component Packages & Update Dependencies/Artifacts
5050
command: |
5151
python -m venv venv && . venv/bin/activate
52-
pip install --upgrade pip wheel setuptools
52+
pip install --upgrade pip
5353
set -eo pipefail
5454
pip install -e .[ci,dev,testing,celery,diskcache] --progress-bar off
5555
pip list | grep dash
5656
npm ci
5757
npm run build.sequential
58-
python setup.py sdist
58+
python -m build
5959
mkdir dash-package && cp dist/*.tar.gz dash-package/dash-package.tar.gz
6060
ls -la dash-package
6161
no_output_timeout: 30m

.gitignore

+7-7
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ coverage.xml
4242
# Distribution / packaging
4343
.Python
4444
build/
45-
dash/deps/
46-
dash/html/*
47-
!dash/html/.gitkeep
48-
dash/dcc/*
49-
!dash/dcc/.gitkeep
50-
dash/dash_table/*
51-
!dash/dash_table/.gitkeep
45+
src/dash/deps/
46+
src/dash/html/*
47+
!src/dash/html/.gitkeep
48+
src/dash/dcc/*
49+
!src/dash/dcc/.gitkeep
50+
src/dash/dash_table/*
51+
!src/dash/dash_table/.gitkeep
5252
develop-eggs/
5353
dist/
5454
downloads/

.pylintrc

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ ignore-patterns=
1515

1616
# Add files or directories matching the regex patterns to the ignore-list.
1717
# The regex matches against paths.
18-
ignore-paths=^dash/dcc/.*$,
19-
^dash/html/.*$,
20-
^dash/dash_table/.*$
18+
ignore-paths=^src/dash/dcc/.*$,
19+
^src/dash/html/.*$,
20+
^src/dash/dash_table/.*$
2121

2222
# Python code to execute, usually for sys.path manipulation such as
2323
# pygtk.require().

.pylintrc312

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ ignore-patterns=
1515

1616
# Add files or directories matching the regex patterns to the ignore-list.
1717
# The regex matches against paths.
18-
ignore-paths=^dash/dcc/.*$,
19-
^dash/html/.*$,
20-
^dash/dash_table/.*$
18+
ignore-paths=^src/dash/dcc/.*$,
19+
^src/dash/html/.*$,
20+
^src/dash/dash_table/.*$
2121

2222
# Python code to execute, usually for sys.path manipulation such as
2323
# pygtk.require().

MAKE_A_NEW_BACK_END.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ We also include a couple of files that are only used to generate the components:
1717

1818
Then we also have Python files. Most of these are generated directly from `metadata.json` - for example `Checklist.py` is a class definition corresponding to the Checklist React component, and if you look inside it you’ll see it inherits from the `dash.development.base_component.Component` class, it has a docstring listing all props and their types in Python notation (instead of “array of objects”, it says “list of dicts”), and it has a constructor that ensures you can only create it with appropriate props. Then there are some Python files that are NOT generated, but copied from https://github.com/plotly/dash-core-components/tree/master/dash_core_components_base - `__init__.py` collects all the component classes and explicitly lists all the browser assets in `_js_dist` and possibly `_css_dist`.
1919

20-
Each back end must have a way to generate its own wrappers for these React components. The Python wrappers are generated source code files as described above, created by [`_py_components_generation.py`](https://github.com/plotly/dash/blob/dev/dash/development/_py_components_generation.py) - other languages may choose to either generate files, or create precompiled objects of some sort, but the key requirements are:
20+
Each back end must have a way to generate its own wrappers for these React components. The Python wrappers are generated source code files as described above, created by [`_py_components_generation.py`](https://github.com/plotly/dash/blob/dev/src/dash/development/_py_components_generation.py) - other languages may choose to either generate files, or create precompiled objects of some sort, but the key requirements are:
2121
- Provide a natural way for users of this language to create components as data structures, keeping in mind that components may be nested inside the children prop of some other components, and most props are optional.
2222
- To the extent that we can help users with built-in documentation and IDE auto-completion, we should try to do that.
2323
- When requested by the framework, the component must serialize to JSON. This looks like:

MANIFEST.in

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
include README.md
22
include LICENSE
33
include requires-*.txt
4-
include dash/favicon.ico
5-
include dash/extract-meta.js
6-
include dash/deps/*.js
7-
include dash/deps/*.map
8-
include dash/dcc/*
9-
include dash/html/*
10-
include dash/dash_table/*
11-
include dash/dash-renderer/build/*.js
12-
include dash/dash-renderer/build/*.map
13-
include dash/labextension/dist/dash-jupyterlab.tgz
14-
include dash/labextension/package.json
4+
include src/dash/favicon.ico
5+
include src/dash/extract-meta.js
6+
include src/dash/deps/*.js
7+
include src/dash/deps/*.map
8+
include src/dash/dcc/*
9+
include src/dash/html/*
10+
include src/dash/dash_table/*
11+
include src/dash/dash-renderer/build/*.js
12+
include src/dash/dash-renderer/build/*.map
13+
include src/dash/labextension/dist/dash-jupyterlab.tgz
14+
include src/dash/labextension/package.json

package.json

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
"license": "UNLICENSED",
44
"scripts": {
55
"private::format.black": "black dash tests --exclude metadata_test.py",
6-
"private::format.renderer": "cd dash/dash-renderer && npm run format",
6+
"private::format.renderer": "cd src/dash/dash-renderer && npm run format",
77
"private::format.dcc": "cd components/dash-core-components && npm run format",
8-
"private::initialize.renderer": "cd dash/dash-renderer && npm ci",
9-
"private::cibuild.components": "python dash/development/update_components.py 'all' --ci True",
10-
"private::build.components": "python dash/development/update_components.py 'all'",
11-
"private::cibuild.renderer": "cd dash/dash-renderer && renderer build",
12-
"private::build.renderer": "cd dash/dash-renderer && renderer build",
8+
"private::initialize.renderer": "cd src/dash/dash-renderer && npm ci",
9+
"private::cibuild.components": "python src/dash/development/update_components.py 'all' --ci True",
10+
"private::build.components": "python src/dash/development/update_components.py 'all'",
11+
"private::cibuild.renderer": "cd src/dash/dash-renderer && renderer build",
12+
"private::build.renderer": "cd src/dash/dash-renderer && renderer build",
1313
"private::build.jupyterlab": "cd \\@plotly/dash-jupyterlab && jlpm install && jlpm build:pack",
14-
"private::lint.black": "node -e \"if ((process.env.PYVERSION || 'python312') !== 'python38'){process.exit(1)} \" || black dash tests --exclude metadata_test.py --check",
15-
"private::lint.flake8": "flake8 --exclude=metadata_test.py dash tests",
16-
"private::lint.pylint-dash": "PYLINTRC=${PYLINTRC:=.pylintrc312} && pylint dash setup.py --rcfile=$PYLINTRC",
14+
"private::lint.black": "node -e \"if ((process.env.PYVERSION || 'python312') !== 'python38'){process.exit(1)} \" || black src tests --exclude metadata_test.py --check",
15+
"private::lint.flake8": "flake8 --exclude=metadata_test.py src tests",
16+
"private::lint.pylint-dash": "PYLINTRC=${PYLINTRC:=.pylintrc312} && pylint src setup.py --rcfile=$PYLINTRC",
1717
"private::lint.pylint-tests": "PYLINTRC=${PYLINTRC:=.pylintrc312} && pylint tests/unit tests/integration -d all -e C0410,C0413,W0109 --rcfile=$PYLINTRC",
18-
"private::lint.renderer": "cd dash/dash-renderer && npm run lint",
18+
"private::lint.renderer": "cd src/dash/dash-renderer && npm run lint",
1919
"private::test.setup-components": "cd \\@plotly/dash-test-components && npm ci && npm run build",
2020
"private::test.setup-nested": "cd \\@plotly/dash-generator-test-component-nested && npm ci && npm run build",
2121
"private::test.setup-standard": "cd \\@plotly/dash-generator-test-component-standard && npm ci && npm run build",
@@ -28,7 +28,7 @@
2828
"private::test.R.deploy-nested": "npm run private::test.setup-nested && cd \\@plotly/dash-generator-test-component-nested && sudo R CMD INSTALL .",
2929
"private::test.R.deploy-standard": "npm run private::test.setup-standard && cd \\@plotly/dash-generator-test-component-standard && sudo R CMD INSTALL .",
3030
"private::test.unit-dash": "pytest tests/unit",
31-
"private::test.unit-renderer": "cd dash/dash-renderer && npm run test",
31+
"private::test.unit-renderer": "cd src/dash/dash-renderer && npm run test",
3232
"private::test.unit-generation": "cd \\@plotly/dash-generator-test-component-typescript && npm ci && npm test",
3333
"private::test.integration-dash": "TESTFILES=$(circleci tests glob \"tests/integration/**/test_*.py\" | circleci tests split --split-by=timings) && pytest --headless --nopercyfinalize --junitxml=test-reports/junit_intg.xml ${TESTFILES}",
3434
"private::test.integration-dash-import": "cd tests/integration/dash && python dash_import_test.py",
@@ -43,7 +43,7 @@
4343
"setup-tests.R": "run-s private::test.R.deploy-*",
4444
"citest.integration": "run-s setup-tests.py private::test.integration-*",
4545
"citest.unit": "run-s private::test.unit-**",
46-
"test": "pytest && cd dash/dash-renderer && npm run test"
46+
"test": "pytest && cd src/dash/dash-renderer && npm run test"
4747
},
4848
"devDependencies": {
4949
"husky": "8.0.3",

pyproject.toml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
[build-system]
2+
requires = ["setuptools>=61.2"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "dash"
7+
authors = [{name = "Chris Parmer", email = "[email protected]"}]
8+
license = {text = "MIT"}
9+
description = "A Python framework for building reactive web-apps. Developed by Plotly."
10+
classifiers = [
11+
"Development Status :: 5 - Production/Stable",
12+
"Environment :: Web Environment",
13+
"Framework :: Dash",
14+
"Framework :: Flask",
15+
"Intended Audience :: Developers",
16+
"Intended Audience :: Education",
17+
"Intended Audience :: Financial and Insurance Industry",
18+
"Intended Audience :: Healthcare Industry",
19+
"Intended Audience :: Manufacturing",
20+
"Intended Audience :: Science/Research",
21+
"License :: OSI Approved :: MIT License",
22+
"Programming Language :: Python",
23+
"Programming Language :: Python :: 3",
24+
"Programming Language :: Python :: 3.8",
25+
"Programming Language :: Python :: 3.9",
26+
"Programming Language :: Python :: 3.10",
27+
"Programming Language :: Python :: 3.11",
28+
"Programming Language :: Python :: 3.12",
29+
"Topic :: Database :: Front-Ends",
30+
"Topic :: Office/Business :: Financial :: Spreadsheet",
31+
"Topic :: Scientific/Engineering :: Visualization",
32+
"Topic :: Software Development :: Libraries :: Application Frameworks",
33+
"Topic :: Software Development :: Widget Sets",
34+
]
35+
requires-python = ">=3.8"
36+
dynamic = ["version", "dependencies", "optional-dependencies"]
37+
38+
[project.readme]
39+
file = "README.md"
40+
content-type = "text/markdown"
41+
42+
[project.urls]
43+
Homepage = "https://plotly.com/dash"
44+
Documentation = "https://dash.plotly.com"
45+
Source = "https://github.com/plotly/dash"
46+
"Issue Tracker" = "https://github.com/plotly/dash/issues"
47+
48+
[project.entry-points]
49+
pytest11 = {dash = "dash.testing.plugin"}
50+
51+
[project.scripts]
52+
dash-generate-components = "dash.development.component_generator:cli"
53+
renderer = "dash.development.build_process:renderer"
54+
dash-update-components = "dash.development.update_components:cli"
55+
56+
[tool.setuptools]
57+
include-package-data = true
58+
59+
[tool.setuptools.dynamic]
60+
version = {attr = "dash.version.__version__"}
61+
dependencies = { file = "requires-install.txt"}
62+
63+
[tool.setuptools.dynamic.optional-dependencies]
64+
ci = { file = "requires-ci.txt" }
65+
dev = { file = "requires-dev.txt" }
66+
testing = { file = "requires-testing.txt" }
67+
celery = { file = "requires-celery.txt" }
68+
diskcache = { file = "requires-diskcache.txt" }
69+
compress = { file = "requires-compress.txt" }
70+
71+
[tool.setuptools.packages.find]
72+
namespaces = false
73+
where = ["src"]

requires-ci.txt

+1
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ xlrd>=2.0.1;python_version>="3.8"
2525
xlrd<2;python_version<"3.8"
2626
pytest-rerunfailures
2727
jupyterlab<4.0.0
28+
build==1.0.3

setup.py

+4-77
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,19 @@
1-
import io
2-
from setuptools import setup, find_packages
3-
4-
main_ns = {}
5-
exec(open("dash/version.py", encoding="utf-8").read(), main_ns) # pylint: disable=exec-used, consider-using-with
6-
7-
8-
def read_req_file(req_type):
9-
with open(f"requires-{req_type}.txt", encoding="utf-8") as fp:
10-
requires = (line.strip() for line in fp)
11-
return [req for req in requires if req and not req.startswith("#")]
1+
from setuptools import setup
122

133

144
setup(
15-
name="dash",
16-
version=main_ns["__version__"],
17-
author="Chris Parmer",
18-
author_email="[email protected]",
19-
packages=find_packages(exclude=["tests*"]),
20-
include_package_data=True,
21-
license="MIT",
22-
description=(
23-
"A Python framework for building reactive web-apps. "
24-
"Developed by Plotly."
25-
),
26-
long_description=io.open("README.md", encoding="utf-8").read(), # pylint: disable=consider-using-with
27-
long_description_content_type="text/markdown",
28-
install_requires=read_req_file("install"),
29-
python_requires=">=3.8",
30-
extras_require={
31-
"ci": read_req_file("ci"),
32-
"dev": read_req_file("dev"),
33-
"testing": read_req_file("testing"),
34-
"celery": read_req_file("celery"),
35-
"diskcache": read_req_file("diskcache"),
36-
"compress": read_req_file("compress")
37-
},
38-
entry_points={
39-
"console_scripts": [
40-
"dash-generate-components = "
41-
"dash.development.component_generator:cli",
42-
"renderer = dash.development.build_process:renderer",
43-
"dash-update-components = dash.development.update_components:cli"
44-
],
45-
"pytest11": ["dash = dash.testing.plugin"],
46-
},
47-
url="https://plotly.com/dash",
48-
project_urls={
49-
"Documentation": "https://dash.plotly.com",
50-
"Source": "https://github.com/plotly/dash",
51-
"Issue Tracker": "https://github.com/plotly/dash/issues",
52-
},
53-
classifiers=[
54-
"Development Status :: 5 - Production/Stable",
55-
"Environment :: Web Environment",
56-
"Framework :: Dash",
57-
"Framework :: Flask",
58-
"Intended Audience :: Developers",
59-
"Intended Audience :: Education",
60-
"Intended Audience :: Financial and Insurance Industry",
61-
"Intended Audience :: Healthcare Industry",
62-
"Intended Audience :: Manufacturing",
63-
"Intended Audience :: Science/Research",
64-
"License :: OSI Approved :: MIT License",
65-
"Programming Language :: Python",
66-
"Programming Language :: Python :: 3",
67-
"Programming Language :: Python :: 3.8",
68-
"Programming Language :: Python :: 3.9",
69-
"Programming Language :: Python :: 3.10",
70-
"Programming Language :: Python :: 3.11",
71-
"Programming Language :: Python :: 3.12",
72-
"Topic :: Database :: Front-Ends",
73-
"Topic :: Office/Business :: Financial :: Spreadsheet",
74-
"Topic :: Scientific/Engineering :: Visualization",
75-
"Topic :: Software Development :: Libraries :: Application Frameworks",
76-
"Topic :: Software Development :: Widget Sets",
77-
],
785
data_files=[
796
# like `jupyter nbextension install --sys-prefix`
807
("share/jupyter/nbextensions/dash", [
81-
"dash/nbextension/main.js",
8+
"src/dash/nbextension/main.js",
829
]),
8310
# like `jupyter nbextension enable --sys-prefix`
8411
("etc/jupyter/nbconfig/notebook.d", [
85-
"dash/nbextension/dash.json"
12+
"src/dash/nbextension/dash.json"
8613
]),
8714
# Place jupyterlab extension in extension directory
8815
("share/jupyter/lab/extensions", [
89-
"dash/labextension/dist/dash-jupyterlab.tgz"
16+
"src/dash/labextension/dist/dash-jupyterlab.tgz"
9017
]),
9118
],
9219
)

tests/integration/dash/dash_import_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
assert isinstance(dash, types.ModuleType), "dash can be imported"
1010

1111
this_dir = os.path.dirname(__file__)
12-
with open(os.path.join(this_dir, "../../../dash/version.py")) as fp:
12+
with open(os.path.join(this_dir, "../../../src/dash/version.py")) as fp:
1313
assert dash.__version__ in fp.read(), "version is consistent"
1414

1515
assert getattr(dash, "Dash").__name__ == "Dash", "access to main Dash class is valid"

0 commit comments

Comments
 (0)