Skip to content

Commit a4980e5

Browse files
authored
Merge branch 'HydrologicEngineeringCenter:main' into endpoint/turbine-changes
2 parents ecf9a3e + 4bec81f commit a4980e5

File tree

6 files changed

+42
-14
lines changed

6 files changed

+42
-14
lines changed

.github/workflows/pypi-deploy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
python-version: '3.x'
2121

2222
- name: Install Poetry
23-
uses: abatilo/actions-poetry@v3
23+
uses: abatilo/actions-poetry@v4
2424

2525
- name: Cache Virtual Environment
2626
uses: actions/cache@v4

.github/workflows/test-deploy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
python-version: '3.x'
2828

2929
- name: Install Poetry
30-
uses: abatilo/actions-poetry@v3
30+
uses: abatilo/actions-poetry@v4
3131

3232
- name: Cache Virtual Environment
3333
uses: actions/cache@v4

.github/workflows/testing.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
# Unlike the code-check workflow, this job requires the dev dependencies to be
2020
# installed to make sure we have the necessary, tools, stub files, etc.
2121
- name: Install Poetry
22-
uses: abatilo/actions-poetry@v3
22+
uses: abatilo/actions-poetry@v4
2323

2424
- name: Cache Virtual Environment
2525
uses: actions/cache@v4

CONTRIBUTING.md

+35-11
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,52 @@
11
# Contributing to cwms-python
22

3+
For the Contributors/Maintainers of cwms-python
4+
5+
cwms-python uses:
6+
7+
- [Poetry](https://python-poetry.org/docs/) for package and dependency management.
8+
- [pytest](https://pypi.org/project/pytest/) for testing of python functions as they are made.
9+
- [requests-mock](https://pypi.org/project/requests-mock/) for simulating CDA to provide network-less tests, effectively mocking the requests to CDA.
10+
- [black](https://black.readthedocs.io/en/stable/) for code formatting.
11+
- [isort](https://pycqa.github.io/isort/index.html) - for python imports sorting.
12+
13+
314
## Getting Started
415

5-
In order to set up the development environment you will need to have [poetry][poetry] installed on your computer. You can then install all of the project dependencies by running the following command.
16+
In order to set up the development environment you will need to have [poetry][poetry] installed on your computer.
617

7-
```sh
8-
poetry install
9-
```
18+
1. To install poetry (with python 3.8+) run:
19+
`python -m pip install poetry` or `pip install poetry`
20+
21+
2. You can then install all of the project dependencies by running the following command.
1022

11-
This will create a virtual environment in `.venv/` in the project's root directory.
23+
```sh
24+
poetry install
25+
```
26+
27+
1. In VSCode you will be prompted to "activate venv", click accept on this to switch to this new poetry venv. ![alt text](docs/images/poetry-venv.png)
28+
2. *NOTE: If you do not have your python `Scripts` directory in your path this will fail.
29+
`Scripts` is located in your python install directory, add this to your PATH.*
30+
31+
This will create a virtual environment in `.venv/` in the project's root directory.
1232
1333
### Check Your Changes
1434
15-
Before submitting a pull request, you should verify that all the tests are passing and that the types are correct.
35+
**Before submitting** a pull request (PR), you should verify that all the tests are passing and that the types are correct.
1636
1737
```sh
1838
poetry run pytest -v tests/
1939
2040
poetry run mypy --strict cwms/
2141
```
2242
43+
Run poetry against a single file with:
44+
*\*From the root of the project\**
45+
46+
```sh
47+
poetry run pytest tests/turbines/turbines_test.py`
48+
```
49+
2350
### Code Style
2451
2552
In order for a pull request to be accepted, python code must be formatted using [black][black] and [isort][isort]. YAML files should also be formatted using either Prettier or the provided pre-commit hook. Developer are encouraged to integrate these tools into their workflow. Pre-commit hooks can be installed to automatically validate any code changes, and reformat if necessary.
@@ -38,16 +65,13 @@ poetry run pre-commit run
3865
poetry run pre-commit run --all-files
3966
```
4067
41-
[black]: https://black.readthedocs.io/en/stable/
42-
[isort]: https://pycqa.github.io/isort/index.html
43-
[poetry]: https://python-poetry.org/docs/
4468
4569
### Commiting to main and releases
4670
47-
when creating a pull request to main and you want the build to be pushed to test pypi the verion needs to be updated in pyproject.toml file. For pull requests that are only updating testpypi increase the third number 0.1.2 -> 0.1.3. Releases that will also update to pypi tag a new release in the repo and update the pyproject.toml increasing the minor version 0.1.1 -> 0.2.0.
71+
when creating a pull request to main and you want the build to be pushed to test pypi the verion needs to be updated in pyproject.toml file. For pull requests that are only updating testpypi increase the third number `0.1.2` -> `0.1.3`. Releases that will also update to pypi tag a new release in the repo and update the pyproject.toml increasing the minor version `0.1.1` -> `0.2.0`.
4872
4973
to grab the module from testpypi for testin run
5074
5175
```sh
5276
python3 -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ cwms-python
53-
```
77+
```

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,7 @@ print(json)
7777
Currently, the TimeSeries Profile API may not be fully supported
7878
until a new version of cwms-data-access is released with the updated
7979
endpoint implementation.
80+
81+
## Contributing
82+
83+
Please view the contribution documentation here: [CONTRIBUTING.md]

docs/images/poetry-venv.png

2.48 KB
Loading

0 commit comments

Comments
 (0)