Skip to content

Add integration scaffolding script#26777

Merged
balloob merged 3 commits into
devfrom
scaffold
Sep 21, 2019
Merged

Add integration scaffolding script#26777
balloob merged 3 commits into
devfrom
scaffold

Conversation

@balloob
Copy link
Copy Markdown
Member

@balloob balloob commented Sep 20, 2019

Description:

Inspired by home-assistant/architecture#289

Add a script to scaffold a new integration that includes a manifest, config flow and tests for that config flow. No one should ever be able to complain that it is too difficult to write a new integration. Output of running python3 -m script.scaffold:

Creating a new integration for Home Assistant.

What is the domain?
> paulus

What is the name of your integration?
> Paulus Hub

What is your GitHub handle?
> @balloob

What PyPI package and version do you depend on? Leave blank for none.
> aioballoob==1.0.3

Generating the paulus integration...
Writing homeassistant/components/paulus/error.py
Writing homeassistant/components/paulus/__init__.py
Writing homeassistant/components/paulus/manifest.json
Writing homeassistant/components/paulus/strings.json
Writing homeassistant/components/paulus/const.py
Writing homeassistant/components/paulus/config_flow.py
Writing tests/components/paulus/__init__.py
Writing tests/components/paulus/test_config_flow.py

Running hassfest to pick up new codeowner and config flow.
Warning: mobile_app references integration cloud but it's not a dependency
Warning: proxy references integration camera but it's not a dependency
Warning: auth references integration onboarding but it's not a dependency
Warning: cast references integration cloud but it's not a dependency
Warning: google_assistant references integration camera but it's not a dependency
Warning: onboarding references integration person but it's not a dependency
Warning: owntracks references integration cloud but it's not a dependency
Integrations: 878
Invalid integrations: 0

Running tests
$ py.test tests/components/paulus
Test session starts (platform: darwin, Python 3.7.4, pytest 5.1.1, pytest-sugar 0.9.2)
rootdir: /Users/paulus/dev/hass/home-assistant, inifile: setup.cfg
plugins: sugar-0.9.2, timeout-1.3.3, cov-2.7.1, aiohttp-0.3.0, requests-mock-1.6.0
collecting ...
 tests/components/paulus/test_config_flow.py ✓✓✓                                    100% ██████████

Results (0.20s):
       3 passed

Successfully created the paulus integration!

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

@probot-home-assistant probot-home-assistant Bot added the small-pr PRs with less than 30 lines. label Sep 20, 2019
Comment thread script/scaffold/__main__.py Outdated
@balloob
Copy link
Copy Markdown
Member Author

balloob commented Sep 21, 2019

@lock lock Bot locked and limited conversation to collaborators Sep 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed small-pr PRs with less than 30 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants