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

12 listener install #13

Merged
merged 6 commits into from
Nov 16, 2022
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
37 changes: 27 additions & 10 deletions .github/workflows/deploy-pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ defaults:
env:
LANG: en_US.utf-8
LC_ALL: en_US.utf-8
PYTHON_VERSION: '3.8'
# Will only deploy to pypi if this matches the
# ${{ $github.repository }} variable
DEPLOY_REPOSITORY: "VOLTTRON/volttron-listener"
PYTHON_VERSION: '3.10'
PROJECT_NAME: volttron-listener
RUNS_ON: ubuntu-22.04

jobs:

bump_version:
runs-on: ubuntu-20.04
environment: test_env
runs-on: ubuntu-22.04
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
Expand Down Expand Up @@ -52,12 +52,29 @@ jobs:
virtualenvs-in-project: true
installer-parallel: true

#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/[email protected]
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install library
run: |
poetry install --no-interaction --without dev
poetry install --no-interaction

#----------------------------------------------
# bump version number for patch
Expand All @@ -68,9 +85,9 @@ jobs:
# we need to remove the v from the begining of the tag.
if ! $(git tag -l "v*" = ''); then
# uses -V which is version sort to keep it monotonically increasing.
current_tag=$(git tag -l "v*" | sort --reverse -V |sed -n 1p)
current_tag=$(git tag -l "v*" | grep --invert-match '-' | sort --reverse -V | sed -n 1p)
else
current_tag=v0.3.0
current_tag=v0.4.0
fi

current_tag=${current_tag#?}
Expand Down Expand Up @@ -104,7 +121,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish pre-release to pypi
if: github.repository == ${{ env.DEPLOY_REPOSITORY }}
if: github.repository == 'eclipse-volttron/volttron-listener'
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish # -r test-pypi
poetry publish
77 changes: 46 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,78 @@
![Passing?](https://github.com/VOLTTRON/volttron-utils/actions/workflows/run-tests.yml/badge.svg)
![Passing?](https://github.com/eclipse-volttron/volttron-listener/actions/workflows/run-tests.yml/badge.svg)

VOLTTRON™ is an open source platform for distributed sensing and control. The platform provides services for collecting and storing data from buildings and devices and provides an environment for developing applications which interact with that data.

This repository contains utility classes and functions used in [volttron-client](https://github.com/VOLTTRON/volttron-client) and [volttron-server](https://github.com/VOLTTRON/volttron-server).
The volttron-listener agent prints all message traffic across a VOLTTRON bus to standard out.

## Requirements

VOLTTRON is transitioning to using poetry as its base development and deployment environment. Please
[install poetry](https://python-poetry.org/docs/#installation) before continuing.
- Python >= 3.8

## Installation

The volttron-utils package requires python >=3.6.2,<4.0 in order to run properly. The volttron-utils package is available from pypi To install into the current python environment use:
Create and activate a virtual environment.

```bash
user@path$ pip install volttron-utils
```shell
python -m venv env
source env/bin/activate
```

## Development
Installing volttron-listener requires a running volttron instance.

```shell
pip install volttron

# Start platform with output going to volttron.log
volttron -vv -l volttron.log &
```

To install development tools including pytest run
Install and start the volttron-listener.

```bash
user@path$ poetry install
```shell
vctl install volttron-listener --start
```

### Configuration
View the status of the installed agent

Its generally preferred to have the python environments created within the project directory. Execute
```shell
vctl status
```

## Development

Developing on this agent requires poetry 1.2.2 or greater be used. One can install it from https://python-poetry.org/docs/#installation. The VOLTTRON team prefers to have the python environments created within the project directory. Execute
this command to make that behavior the default.

```bash
user@path$ poetry config virtualenvs.in-project true
```shell
poetry config virtualenvs.in-project true
```

Clone the repository.

```shell
git clone https://github.com/eclipse-volttron/volttron-listener
```

Change to the repository directory and use poetry install to setup the environment.

```shell
cd volttron-listener
poetry install
```

### Building Wheel

To build a wheel from this project execute the following:

```bash
user@path$ poetry build
```shell
poetry build
```

The wheel and source distribution will be located in the ```./dist/``` directory.

### Bumping version number of project

To bump the version number of volttron-utils execute one of the following.
To bump the version number of the project execute one of the following.

```bash
```shell
# patch, minor, major, prepatch, preminor, premajor, prerelease

# use patch
Expand All @@ -64,16 +88,7 @@ user@path$ poetry version prepatch
Bumping version from 0.2.0 to 0.2.1-alpha.0
```

### Deployment to pypi

A github action has been created to allow for pushing the wheel to pypi. The requirement for it is to create a tag using v*.*.* for the version of the file. This can be done on a release basis or by pushing a local tag to github. To push a local tag to github in the correct format use the following.

```bash
user@path$ git tag v0.0.1
user@path$ git push origin v0.0.1
```

# Disclamer Notice
# Disclaimer Notice

This material was prepared as an account of work sponsored by an agency of the
United States Government. Neither the United States Government nor the United
Expand Down
58 changes: 0 additions & 58 deletions conftest.py

This file was deleted.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "volttron-listener"
version = "0.4.0"
version = "0.5.0"
description = "None"
authors = ["Craig Allwardt <[email protected]>"]
license = "Apache License 2.0"
Expand All @@ -19,7 +19,7 @@ classifiers = [
]
[tool.poetry.dependencies]
python = ">=3.8,<4.0"
volttron = "^10.0.1a28"
volttron = "^10.0.1a33"

[tool.poetry.group.dev.dependencies]
# formatting, quality, tests
Expand All @@ -34,7 +34,7 @@ mypy = "^0.942"
coverage = "^6.3.2"
Sphinx = "^4.5.0"
sphinx-rtd-theme = "^1.0.0"
volttron-testing = "^0.3.1a7"
volttron-testing = "^0.3.1a10"

[tool.yapfignore]
ignore_patterns = [
Expand Down
3 changes: 2 additions & 1 deletion src/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import gevent
from volttrontesting import PlatformWrapper
from volttron.client.known_identities import CONTROL


def test_startup_instance(volttron_instance: PlatformWrapper):
Expand All @@ -54,7 +55,7 @@ def test_startup_instance(volttron_instance: PlatformWrapper):
listening.callback.reset_mock()

assert listening.core.identity
agent_identity = listening.vip.rpc.call('control', 'agent_vip_identity', auuid).get(timeout=10)
agent_identity = listening.vip.rpc.call(CONTROL, 'agent_vip_identity', auuid).get(timeout=10)
listening.vip.pubsub.subscribe(peer='pubsub',
prefix='heartbeat/{}'.format(agent_identity),
callback=listening.callback)
Expand Down