Skip to content

Commit 5c746f1

Browse files
Merge pull request #106 from plotly/dash-115-julia-gen
Julia generation, Dash update, test update
2 parents 86b9494 + e82d3c6 commit 5c746f1

File tree

9 files changed

+15
-4
lines changed

9 files changed

+15
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ To use this boilerplate:
2020
- `project_name`: This is the "human-readable" name of your project. For example, "Dash Core Components".
2121
- `project_shortname`: is derived from the project name, it is the name of the "Python library" for your project. By default, this is generated from your `project_name` by lowercasing the name and replacing spaces & `-` with underscores. For example, for "Dash Core Components" this would be "dash_core_components".
2222
- `component_name`: This is the name of the initial component that is generated. As a JavaScript class name it should be in PascalCase. defaults to the PascalCase version of `project_shortname`.
23+
- `jl_prefix`: Optional prefix for Julia components. For example, `dash_core_components` uses "dcc" so the Python `dcc.Input` becomes `dccInput` in Julia, and `dash_table` uses "dash" to make `dashDataTable`.
2324
- `r_prefix`: Optional prefix for R components. For example, `dash_core_components` uses "dcc" so the Python `dcc.Input` becomes `dccInput` in R, and `dash_table` uses "dash" to make `dashDataTable`.
2425
- `author_name` and `author_email`: for package.json and DESCRIPTION (for R) metadata.
2526
- `github_org`: If you plan to push this to GitHub, enter the organization or username that will own it (for URLs to the project homepage and bug report page)

cookiecutter.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"project_name": "my dash component",
33
"project_shortname": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_') }}",
44
"component_name": "{{ cookiecutter.project_shortname.split('_')|map('capitalize')|join('') }}",
5+
"jl_prefix": "",
56
"r_prefix": "",
67
"author_name": "Enter your first and last name (For package.json)",
78
"author_email": "Enter your email (For package.json)",

hooks/post_gen_project.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ def _execute_command(cmd):
8484
" ./src/lib/components"
8585
" {{cookiecutter.project_shortname}}"
8686
" -p package-info.json"
87+
" --jl-prefix '{{ cookiecutter.jl_prefix }}'"
8788
" --r-prefix '{{ cookiecutter.r_prefix }}'"
8889
.format(python_executable))
8990

tests/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
dash[dev,testing]>=1.3.1
1+
dash[dev,testing]>=1.15.0
22
pytest-cookies

tests/test_config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ default_context:
22
project_name: Test Component
33
project_shortname: test_component
44
component_name: TestComponent
5+
jl_prefix: dash
56
r_prefix: dash
67
author_name: Test
78
author_email: Test

tests/test_install.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def test_install(cookies, dash_duo):
1010
'project_name': 'Test Component',
1111
'author_name': 'test',
1212
'author_email': 'test',
13+
'jl_prefix': 'dash',
1314
'r_prefix': 'dash',
1415
})
1516

@@ -54,6 +55,12 @@ def test_install(cookies, dash_duo):
5455
['man', 'dashTestComponent.Rd'],
5556
['inst', 'deps', 'test_component.min.js'],
5657
['inst', 'deps', 'test_component.min.js.map'],
58+
# Julia
59+
['Project.toml'],
60+
['deps', 'test_component.min.js'],
61+
['deps', 'test_component.min.js.map'],
62+
['src', 'dash_testcomponent.jl'],
63+
['src', 'TestComponent.jl'],
5764
]
5865

5966
for path in expected_files:

{{cookiecutter.project_shortname}}/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"validate-init": "python _validate_init.py",
1919
"prepublishOnly": "npm run validate-init",
2020
"build:js": "webpack --mode production",
21-
"build:py_and_r": "dash-generate-components ./src/lib/components {{ cookiecutter.project_shortname }} -p package-info.json --r-prefix '{{ cookiecutter.r_prefix }}'",
21+
"build:py_and_r": "dash-generate-components ./src/lib/components {{ cookiecutter.project_shortname }} -p package-info.json --r-prefix '{{ cookiecutter.r_prefix }}' --jl-prefix '{{ cookiecutter.jl_prefix }}'",
2222
"build:py_and_r-activated": "(. venv/bin/activate || venv\\scripts\\activate && npm run build:py_and_r)",
2323
"build": "npm run build:js && npm run build:py_and_r",
2424
"build:activated": "npm run build:js && npm run build:py_and_r-activated"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# dash is required to call `build:py`
2-
dash[dev]>=1.3.1
2+
dash[dev]>=1.15.0

{{cookiecutter.project_shortname}}/tests/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
# Switch into a virtual environment
33
# pip install -r requirements.txt
44

5-
dash[dev,testing]>=1.3.1
5+
dash[dev,testing]>=1.15.0

0 commit comments

Comments
 (0)