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

rename to reactpy #16

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# built JS files
*.min.js
*.min.js.map

# Created by .ignore support plugin (hsz.mobi)
### VisualStudioCode template
.vscode
Expand Down
12 changes: 6 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Package: idomDash
Title: A custom component for Dash that uses IDOM
Version: 0.0.5
Description: A custom component for Dash that uses IDOM
Package: reactpyDash
Title: A custom component for Dash that uses ReactPy
Version: 0.1.0
Description: A custom component for Dash that uses ReactPy
Depends: R (>= 3.0.2)
Imports:
Suggests:
License: MIT + file LICENSE
URL: https://github.com/idom-team/idom-dash
BugReports: https://github.com/idom-team/idom-dash/issues
URL: https://github.com/reactpy-team/reactpy-dash
BugReports: https://github.com/reactpy-team/reactpy-dash/issues
Encoding: UTF-8
LazyData: true
KeepSource: true
8 changes: 4 additions & 4 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include idom_dash/idom_dash.min.js
include idom_dash/idom_dash.min.js.map
include idom_dash/metadata.json
include idom_dash/package-info.json
include reactpy_dash/reactpy_dash.min.js
include reactpy_dash/reactpy_dash.min.js.map
include reactpy_dash/metadata.json
include reactpy_dash/package-info.json
include README.md
include LICENSE
include package.json
5 changes: 3 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# AUTO GENERATED FILE - DO NOT EDIT

export(IdomDashComponent)
export(idomDashComponent)
export(ReactPyDashComponent)
export(reactPyDashComponent)
export(reactpyDashComponent)
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

name = "IdomDash"
uuid = "1b08a953-4be3-4667-9a23-f213e429975d"
name = "ReactpyDash"
uuid = "1b08a953-4be3-4667-9a23-4f770f38b795"
authors = ["Ryan Morshead <[email protected]>"]
version = "0.0.5"
version = "0.1.0"

[deps]
Dash = "1b08a953-4be3-4667-9a23-3db579824955"
Expand Down
18 changes: 9 additions & 9 deletions R/internal.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.idomDash_js_metadata <- function() {
deps_metadata <- list(`idom_dash` = structure(list(name = "idom_dash",
version = "0.0.5", src = list(href = NULL,
.reactpyDash_js_metadata <- function() {
deps_metadata <- list(`reactpy_dash` = structure(list(name = "reactpy_dash",
version = "0.1.0", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'idom_dash.min.js',
stylesheet = NULL, head = NULL, attachment = NULL, package = "idomDash",
script = 'reactpy_dash.min.js',
stylesheet = NULL, head = NULL, attachment = NULL, package = "reactpyDash",
all_files = FALSE), class = "html_dependency"),
`idom_dash` = structure(list(name = "idom_dash",
version = "0.0.5", src = list(href = NULL,
`reactpy_dash` = structure(list(name = "reactpy_dash",
version = "0.1.0", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'idom_dash.min.js.map',
stylesheet = NULL, head = NULL, attachment = NULL, package = "idomDash",
script = 'reactpy_dash.min.js.map',
stylesheet = NULL, head = NULL, attachment = NULL, package = "reactpyDash",
all_files = FALSE, dynamic = TRUE), class = "html_dependency"))
return(deps_metadata)
}
8 changes: 4 additions & 4 deletions R/idomDashComponent.R → R/reactPyDashComponent.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# AUTO GENERATED FILE - DO NOT EDIT

#' @export
idomDashComponent <- function(viewId=NULL) {
reactPyDashComponent <- function(viewId=NULL) {

props <- list(viewId=viewId)
if (length(props) > 0) {
props <- props[!vapply(props, is.null, logical(1))]
}
component <- list(
props = props,
type = 'IdomDashComponent',
namespace = 'idom_dash',
type = 'ReactPyDashComponent',
namespace = 'reactpy_dash',
propNames = c('viewId'),
package = 'idomDash'
package = 'reactpyDash'
)

structure(component, class = c('dash_component', 'list'))
Expand Down
19 changes: 19 additions & 0 deletions R/reactpyDashComponent.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# AUTO GENERATED FILE - DO NOT EDIT

#' @export
reactpyDashComponent <- function(viewId=NULL) {

props <- list(viewId=viewId)
if (length(props) > 0) {
props <- props[!vapply(props, is.null, logical(1))]
}
component <- list(
props = props,
type = 'ReactPyDashComponent',
namespace = 'reactpy_dash',
propNames = c('viewId'),
package = 'reactpyDash'
)

structure(component, class = c('dash_component', 'list'))
}
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# idom-dash
# reactpy-dash

`idom-dash` is a Dash component library that uses [IDOM](https://github.com/idom-team/idom)
`reactpy-dash` is a Dash component library that uses [ReactPy](https://github.com/reactpy-team/reactpy)
a Python package for creating highly interactive user interfaces. To learn more about
IDOM check out its [documentation](https://idom-docs.herokuapp.com/docs/index.html).
ReactPy check out its [documentation](https://reactpy-docs.herokuapp.com/docs/index.html).

# Getting Started

```bash
pip install idom-dash dash==1.19.0
pip install reactpy-dash dash==1.19.0
```

Then try out a quick example:
Expand All @@ -16,8 +16,8 @@ Then try out a quick example:
import dash
from dash import html as dash_html

from idom_dash import adapt_layout, configure_app
from idom import component, html, use_state
from reactpy_dash import adapt_layout, configure_app
from reactpy import component, html, use_state

external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
Expand Down Expand Up @@ -47,8 +47,8 @@ if __name__ == "__main__":
app.run("127.0.0.1", 5000, debug=True)
```

To learn what you can do with IDOM's interactive components, check out
[more examples](https://idom-docs.herokuapp.com/docs/examples.html).
To learn what you can do with ReactPy's interactive components, check out
[more examples](https://reactpy-docs.herokuapp.com/docs/examples.html).

# Developer Installation

Expand All @@ -59,14 +59,14 @@ Be sure you have [NPM](https://www.npmjs.com/get-npm) installed, then run the fo
3. Run the test suite

```bash
git clone https://github.com/idom-team/idom-dash.git
cd idom-dash
git clone https://github.com/reactpy-team/reactpy-dash.git
cd reactpy-dash
pip install -e . -r requirements.txt
npm install
pytest tests
```

## Write your component code in `src/lib/components/IdomDashComponent.react.js`.
## Write your component code in `src/lib/components/ReactPyDashComponent.react.js`.

- The demo app is in `src/demo` and you will import your example component code into your demo app.
- Test your code in a Python environment:
Expand All @@ -82,9 +82,9 @@ pytest tests
- A sample test is available in `tests/test_usage.py`, it will load `usage.py` and you can then automate interactions with selenium.
- Run the tests with `$ pytest tests`.
- The Dash team uses these types of integration tests extensively. Browse the Dash component code on GitHub for more examples of testing (e.g. https://github.com/plotly/dash-core-components)
- Add custom styles to your component by putting your custom CSS files into your distribution folder (`idom_dash`).
- Add custom styles to your component by putting your custom CSS files into your distribution folder (`reactpy_dash`).
- Make sure that they are referenced in `MANIFEST.in` so that they get properly included when you're ready to publish your component.
- Make sure the stylesheets are added to the `_css_dist` dict in `idom_dash/__init__.py` so dash will serve them automatically when the component suite is requested.
- Make sure the stylesheets are added to the `_css_dist` dict in `reactpy_dash/__init__.py` so dash will serve them automatically when the component suite is requested.
- [Review your code](./review_checklist.md)

## Create a production build and publish:
Expand All @@ -106,7 +106,7 @@ pytest tests
3. Test your tarball by copying it into a new environment and installing it locally:

```
$ pip install idom_dash-0.0.1.tar.gz
$ pip install reactpy_dash-0.0.1.tar.gz
```

4. If it works, then you can publish the component to NPM and PyPI:
Expand Down
32 changes: 15 additions & 17 deletions _validate_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@
import importlib


components_package = 'idom_dash'
components_package = "reactpy_dash"

components_lib = importlib.import_module(components_package)

missing_dist_msg = 'Warning {} was not found in `{}.__init__.{}`!!!'
missing_manifest_msg = '''
missing_dist_msg = "Warning {} was not found in `{}.__init__.{}`!!!"
missing_manifest_msg = """
Warning {} was not found in `MANIFEST.in`!
It will not be included in the build!
'''
"""

with open('MANIFEST.in', 'r') as f:
with open("MANIFEST.in", "r") as f:
manifest = f.read()


def check_dist(dist, filename):
# Support the dev bundle.
if filename.endswith('dev.js'):
if filename.endswith("dev.js"):
return True

return any(
filename in x
for d in dist
for x in (
[d.get('relative_package_path')]
if not isinstance(d.get('relative_package_path'), list)
else d.get('relative_package_path')
[d.get("relative_package_path")]
if not isinstance(d.get("relative_package_path"), list)
else d.get("relative_package_path")
)
)

Expand All @@ -46,22 +46,20 @@ def check_manifest(filename):
def check_file(dist, filename):
if not check_dist(dist, filename):
print(
missing_dist_msg.format(filename, components_package, '_js_dist'),
file=sys.stderr
missing_dist_msg.format(filename, components_package, "_js_dist"),
file=sys.stderr,
)
if not check_manifest(filename):
print(missing_manifest_msg.format(filename),
file=sys.stderr)
print(missing_manifest_msg.format(filename), file=sys.stderr)


for cur, _, files in os.walk(components_package):
for f in files:

if f.endswith('js'):
if f.endswith("js"):
# noinspection PyProtectedMember
check_file(components_lib._js_dist, f)
elif f.endswith('css'):
elif f.endswith("css"):
# noinspection PyProtectedMember
check_file(components_lib._css_dist, f)
elif not f.endswith('py'):
elif not f.endswith("py"):
check_manifest(f)
10 changes: 0 additions & 10 deletions deps/idom_dash.min.js

This file was deleted.

5 changes: 0 additions & 5 deletions deps/idom_dash.min.js.LICENSE.txt

This file was deleted.

1 change: 0 additions & 1 deletion deps/idom_dash.min.js.map

This file was deleted.

5 changes: 0 additions & 5 deletions idom_dash/_imports_.py

This file was deleted.

10 changes: 0 additions & 10 deletions idom_dash/idom_dash.min.js

This file was deleted.

5 changes: 0 additions & 5 deletions idom_dash/idom_dash.min.js.LICENSE.txt

This file was deleted.

1 change: 0 additions & 1 deletion idom_dash/idom_dash.min.js.map

This file was deleted.

6 changes: 3 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!doctype>
<!DOCTYPE >
<html>
<head>
<title>my-dash-component</title>
</head>
<body>
<div id='root'></div>
<script src="/idom_dash/output.js"></script>
<div id="root"></div>
<script src="/reactpy_dash/output.js"></script>
</body>
</html>
10 changes: 0 additions & 10 deletions inst/deps/idom_dash.min.js

This file was deleted.

5 changes: 0 additions & 5 deletions inst/deps/idom_dash.min.js.LICENSE.txt

This file was deleted.

1 change: 0 additions & 1 deletion inst/deps/idom_dash.min.js.map

This file was deleted.

10 changes: 5 additions & 5 deletions man/idomDashComponent.Rd → man/reactPyDashComponent.Rd
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
% Auto-generated: do not edit by hand
\name{idomDashComponent}
\name{reactPyDashComponent}

\alias{idomDashComponent}
\alias{reactPyDashComponent}

\title{IdomDashComponent component}
\title{ReactPyDashComponent component}

\description{
IdomDashComponent allows integration between Dash and IDOM
ReactPyDashComponent allows integration between Dash and ReactPy
}

\usage{
idomDashComponent(viewId=NULL)
reactPyDashComponent(viewId=NULL)
}

\arguments{
Expand Down
21 changes: 21 additions & 0 deletions man/reactpyDashComponent.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
% Auto-generated: do not edit by hand
\name{reactpyDashComponent}

\alias{reactpyDashComponent}

\title{ReactPyDashComponent component}

\description{
ReactPyDashComponent allows integration between Dash and ReactPy
}

\usage{
reactpyDashComponent(viewId=NULL)
}

\arguments{
\item{viewId}{Character. The view ID for this component instance}
}

\value{named list of JSON elements corresponding to React.js properties and their values}

Loading