You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[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
+
3
14
## Getting Started
4
15
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.
6
17
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.
10
22
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. 
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.
12
32
13
33
### Check Your Changes
14
34
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.
16
36
17
37
```sh
18
38
poetry run pytest -v tests/
19
39
20
40
poetry run mypy --strict cwms/
21
41
```
22
42
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
+
23
50
### Code Style
24
51
25
52
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
38
65
poetry run pre-commit run --all-files
39
66
```
40
67
41
-
[black]: https://black.readthedocs.io/en/stable/
42
-
[isort]: https://pycqa.github.io/isort/index.html
43
-
[poetry]: https://python-poetry.org/docs/
44
68
45
69
### Commiting to main and releases
46
70
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`.
0 commit comments