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

Improve setup #37075

Merged
merged 3 commits into from
Jun 25, 2020
Merged
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
3 changes: 2 additions & 1 deletion script/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ set -e
cd "$(dirname "$0")/.."

echo "Installing development dependencies..."
python3 -m pip install tox colorlog pre-commit $(grep mypy requirements_test.txt)
python3 -m pip install wheel --constraint homeassistant/package_constraints.txt
python3 -m pip install tox colorlog pre-commit $(grep mypy requirements_test.txt) --constraint homeassistant/package_constraints.txt
19 changes: 17 additions & 2 deletions script/setup
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
#!/bin/sh
#!/bin/bash
# Setups the repository.

# Stop on errors
set -e

cd "$(dirname "$0")/.."

mkdir -p config

python3 -m venv venv
source venv/bin/activate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to document that if the developer wants to maintain another environment the developer can't use this script?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean with maintain another environment? Like have one virtual env that mixes both HA deps and deps of another project? That isn't supported. For installing external deps, people should do pip3 install -e /path/to/project

Copy link
Member

@MartinHjelmare MartinHjelmare Jun 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I mean use another venv tool and venv location. Eg I use virtualenv and virtualenvwrapper to manage my venvs. So this script won't be compatible with that setup.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that those users should look into the script and figure out it's just pip3 install -e .. venv is official part of Python and should be the preferred venv.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we can also add support for an ENV var to skip the virtual env.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just check for $VIRTUAL_ENV being set, and abort if not. It should cover most bases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that is a thing, yes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is set by activate script. May not be set if a binary is run directly in venv, but that should be case we need to care about.


script/bootstrap

pre-commit install
pip install -e .
pip install -e . --constraint homeassistant/package_constraints.txt

hass --script ensure_config -c config

echo "
logger:
default: info
logs:
homeassistant.components.cloud: debug
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding debug logging for a single integration to show how it works.

" >> config/configuration.yaml