Skip to content

dash-generate-components creates __init__.py in wrong directory #111

Open

Description

@jo47011

Hi,

I've created a new dash-component-boilerplate no changes made.

When calling dash-generate-components as below the __init__.py is created in the toplevel directory.

dash-generate-components ./src/lib/components xxx_frontend -p package-info.json

Thus running python usage.py results in

AttributeError: module 'xxx_frontend' has no attribute 'XxxFrontend'

When I mannually move the __init__.py to the xxx_frontend folder it works.

Downloaded the latest dash-component-boilerplate version as of today.

Thanks a lot for any help.

For completeness here is the content of the toplevel directory:

-rwxrwxrwx 1 user user    445 Nov 12 07:53 .babelrc
-rwxrwxrwx 1 user user     31 Nov 12 07:53 .eslintignore
-rwxrwxrwx 1 user user   3545 Nov 12 07:53 .eslintrc
-rwxrwxrwx 1 user user   4890 Nov 12 07:53 .gitignore
drwxrwxrwx 1 user user   4096 Nov 12 10:45 .idea
-rwxrwxrwx 1 user user    307 Nov 12 07:53 .npmignore
-rwxrwxrwx 1 user user    110 Nov 12 07:53 .prettierrc
-rwxrwxrwx 1 user user  17355 Nov 12 07:53 .pylintrc
-rwxrwxrwx 1 user user    225 Nov 12 07:53 CONTRIBUTING.md
-rwxrwxrwx 1 user user      0 Nov 12 07:53 LICENSE
-rwxrwxrwx 1 user user    228 Nov 12 07:53 MANIFEST.in
-rwxrwxrwx 1 user user   3572 Nov 12 07:53 README.md
-rwxrwxrwx 1 user user   1273 Nov 12 07:53 __init__.py
-rwxrwxrwx 1 user user     78 Nov 12 07:53 _imports_.py
-rwxrwxrwx 1 user user   1722 Nov 12 07:53 _validate_init.py
drwxrwxrwx 1 user user   4096 Nov 12 10:28 xxx_frontend
drwxrwxrwx 1 user user   4096 Nov 12 08:30 xxx_frontend.egg-info
-rwxrwxrwx 1 user user    210 Nov 12 07:53 index.html
drwxrwxrwx 1 user user   4096 Nov 12 08:40 node_modules
-rwxrwxrwx 1 user user 436598 Nov 12 08:06 package-lock.json
-rwxrwxrwx 1 user user   1656 Nov 12 08:26 package.json
-rwxrwxrwx 1 user user    152 Nov 12 07:53 pytest.ini
-rwxrwxrwx 1 user user     58 Nov 12 07:53 requirements.txt
-rwxrwxrwx 1 user user   3343 Nov 12 07:53 review_checklist.md
-rwxrwxrwx 1 user user    533 Nov 12 07:53 setup.py
drwxrwxrwx 1 user user   4096 Nov 12 09:26 src
drwxrwxrwx 1 user user   4096 Nov 12 07:53 tests
-rwxrwxrwx 1 user user    535 Nov 12 07:53 usage.py
-rwxrwxrwx 1 user user   2215 Nov 12 07:53 webpack.config.js
-rwxrwxrwx 1 user user    366 Nov 12 07:53 webpack.serve.config.js

Note: even this is a unix listing I am running the software in Windows 10.

Activity

  1. xhluca commented on Jan 25, 2021

    @xhluca

    Did you use cookiecutter to create your component, and made sure to be inside path/to/your/project/xxx_frontend? Note that there's a folder xxx_frontend and also xxx_frontend/xxx_frontend which can be confusing.

    I just used the cookiecutter to create my project and tried running dash-generate-components inside Windows 10's terminal. My init file was in the correct directly and I was able to run usage.py without any problem.

    Here's what my terminal looks like:

    C:\Users\xhlu\dev>cd my_dash_component
    
    C:\Users\xhlu\dev\my_dash_component>venv\Scripts\activate
    
    (venv) C:\Users\xhlu\dev\my_dash_component>dash-generate-components ./src/lib/components my_dash_component -p package-info.json
    Generated MyDashComponent.py
    
    (venv) C:\Users\xhlu\dev\my_dash_component>dir
    
     Directory of C:\Users\xhlu\dev\my_dash_component
    
    01/25/2021  03:35 PM    <DIR>          .
    01/25/2021  03:35 PM    <DIR>          ..
    01/25/2021  03:33 PM               445 .babelrc
    01/25/2021  03:33 PM                31 .eslintignore
    01/25/2021  03:33 PM             3,545 .eslintrc
    01/25/2021  03:33 PM             4,890 .gitignore
    01/25/2021  03:33 PM               307 .npmignore
    01/25/2021  03:33 PM               110 .prettierrc
    01/25/2021  03:33 PM            17,355 .pylintrc
    01/25/2021  03:35 PM               545 .Rbuildignore
    01/25/2021  03:33 PM               225 CONTRIBUTING.md
    01/25/2021  03:35 PM    <DIR>          deps
    01/25/2021  03:35 PM               251 DESCRIPTION
    01/25/2021  03:33 PM               214 index.html
    01/25/2021  03:35 PM    <DIR>          inst
    01/25/2021  03:33 PM                 0 LICENSE
    01/25/2021  03:35 PM    <DIR>          man
    01/25/2021  03:33 PM               252 MANIFEST.in
    01/25/2021  03:35 PM    <DIR>          my_dash_component
    01/25/2021  03:35 PM                66 NAMESPACE
    01/25/2021  03:35 PM    <DIR>          node_modules
    01/25/2021  03:35 PM           440,089 package-lock.json
    01/25/2021  03:35 PM             1,687 package.json
    01/25/2021  03:35 PM               238 Project.toml
    01/25/2021  03:33 PM               152 pytest.ini
    01/25/2021  03:35 PM    <DIR>          R
    01/25/2021  03:33 PM             3,772 README.md
    01/25/2021  03:33 PM                58 requirements.txt
    01/25/2021  03:33 PM             3,343 review_checklist.md
    01/25/2021  03:33 PM               533 setup.py
    01/25/2021  03:35 PM    <DIR>          src
    01/25/2021  03:33 PM    <DIR>          tests
    01/25/2021  03:33 PM               546 usage.py
    01/25/2021  03:33 PM    <DIR>          venv
    01/25/2021  03:33 PM             2,215 webpack.config.js
    01/25/2021  03:33 PM               366 webpack.serve.config.js
    01/25/2021  03:33 PM             1,726 _validate_init.py
                  26 File(s)        482,961 bytes
                  11 Dir(s)  665,871,785,984 bytes free
    
    (venv) C:\Users\xhlu\dev\my_dash_component>python usage.py
    Dash is running on http://127.0.0.1:8050/
    
     * Serving Flask app "usage" (lazy loading)
     * Environment: production
       WARNING: This is a development server. Do not use it in a production deployment.
       Use a production WSGI server instead.
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions