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

Merge 0.7.0 release into Main #69

Merged
merged 15 commits into from
Jun 28, 2024
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
48 changes: 24 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ jobs:
uses: pre-commit/[email protected]
with:
extra_args: --all-files
tests:
name: Run tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.3.1"

- name: Run tests with poetry and pytest
run: |
poetry install
poetry run pytest
# tests:
# name: Run tests
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version: ["3.8", "3.9", "3.10", "3.11"]
# steps:
# - name: Checkout code
# uses: actions/checkout@v2

# - name: Install Python
# uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}

# - name: Install poetry
# uses: abatilo/[email protected]
# with:
# poetry-version: "1.3.1"

# - name: Run tests with poetry and pytest
# run: |
# poetry install
# poetry run pytest
13 changes: 9 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install poetry
uses: abatilo/actions-poetry@v2.0.0
uses: abatilo/actions-poetry@v3
with:
poetry-version: "1.3.1"
poetry-version: 1.8.3

- name: Start Alfalfa
uses: NREL/alfalfa-action@v1
Expand All @@ -36,6 +36,11 @@ jobs:
compose-file-ref: "develop"
worker-scale: 2

- name: Wait for web API
uses: iFaxity/[email protected]
with:
resource: http://localhost

- name: Run tests with poetry and pytest
run: |
poetry install
Expand Down
42 changes: 19 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The purpose of this repository is to provide a standalone client for use with the Alfalfa application. It additionally includes a Historian to quickly/easily enable saving of results from Alfalfa simulations.

# Usage
## Usage

This repo is packaged and hosted on [PyPI here](https://pypi.org/project/alfalfa-client/).

Expand All @@ -11,45 +11,41 @@ pip install alfalfa-client
```

```python
import alfalfa_client.alfalfa_client as ac
import alfalfa_client.historian as ah
from alfalfa_client.alfalfa_client import AlfalfaClient

client = ac.AlfalfaClient
historian = ah.Historian
client = AlfalfaClient("http://localhost")
```

# Setup and Testing
Additional documentation for the functions of `alfalfa-client` can be found [here](https://nrel.github.io/alfalfa-client/).

This repository is setup to use:
## Development

Prerequisites:

- [pyenv](https://github.com/pyenv/pyenv#installation) for managing python versions
- [poetry](https://python-poetry.org/docs/#installation) for managing environment
- [pre-commit](https://pre-commit.com/#install) for managing code styling
- tox for running tests in isolated build environments. See the expected python versions in [tox.ini](./tox.ini)

Assuming poetry is installed and the necessary python versions are installed, the following should exit cleanly:
Cloning and Installing:

```bash
git clone https://github.com/NREL/alfalfa-client.git
cd alfalfa-client
poetry run tox
poetry install
```

This may take some time resolving on the initial run, but subsequent runs should be faster.

See [this gist](https://gist.github.com/corymosiman12/26fb682df2d36b5c9155f344eccbe404) for additional info.

# History
Running Tests:
All `alfalfa-client` tests currently require a running instance of [Alfalfa](https://github.com/NREL/alfalfa) with at least 2 workers.

- The implemented client is previously referred to as Boptest, from the alfalfa/client/boptest.py implementation. It has been ported as a standalone package for easier usage across projects.
```bash
poetry run pytest -m integration
```

# Releasing
## Releasing

1. Merge all branches into develop, make sure tests pass
1. Finish merging PRs into develop
1. Confirm all tests pass
1. Update the version (assume version is 0.1.2): `poetry version 0.1.2`
1. Update the version test file (i.e. my-repo/tests/test_version.py) to match the above version
1. Make sure tests pass: `poetry run tox`
1. Merge develop into main (previously, master), make sure tests pass
1. Create PR to merge version update
1. Rebase develop onto main, make sure tests pass
1. Create a tag: `git tag 0.1.2`
1. Build: `poetry build`
1. Publish `poetry publish` (this will push to pypi)
Expand Down
5 changes: 0 additions & 5 deletions alfalfa_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,4 @@
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ****************************************************************************************************


import pkg_resources

from alfalfa_client.alfalfa_client import AlfalfaClient

__version__ = pkg_resources.get_distribution('alfalfa-client').version
Loading
Loading