Skip to content

Commit f0ca6df

Browse files
authored
README.md: Clean up formatting and fix minor errors (#228)
Signed-off-by: Brad Keryan <brad.keryan@ni.com>
1 parent 736b04d commit f0ca6df

3 files changed

Lines changed: 46 additions & 45 deletions

File tree

CONTRIBUTING.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ See [GitHub's official documentation](https://help.github.com/articles/using-pul
2323

2424
## Prerequisites
2525

26-
- Install the [Visual Studio Code](https://code.visualstudio.com/download).
26+
- (Optional) Install [Visual Studio Code](https://code.visualstudio.com/download).
2727
- Install Git.
2828
- Install [Poetry](https://python-poetry.org/docs/#installation).
29-
- Install Python and add it to the PATH. (Recommended Version:3.8)
29+
- Install Python and add it to the `PATH`. For the recommended Python version, see [Dependencies](README.md#dependencies).
3030

3131
## Clone Repo
3232

@@ -38,21 +38,21 @@ git clone https://github.com/ni/measurementlink-python.git
3838

3939
## Initializing the repo with .venv
4040

41-
From the root directory of the repo, initialize the project using the [poetry install](https://python-poetry.org/docs/cli/#install) command. This will set up a .venv with all the required dependencies based on poetry.lock file and pyproject.toml.
41+
From the root directory of the repo, initialize the project using the [`poetry install`](https://python-poetry.org/docs/cli/#install) command. This will set up a virtual environment (`.venv`) with the required dependencies based on the `poetry.lock` file and `pyproject.toml`.
4242

4343
```cmd
44-
poetry init
44+
poetry install
4545
```
4646

4747
## Ensure that the `./.venv` virtual environment is activated
4848

4949
- In the command prompt: `poetry shell`
50-
- In the vscode ([link](https://code.visualstudio.com/docs/python/environments#_select-and-activate-an-environment))
51-
- ALTERNATIVE: run commands with `poetry run`. i.e., `poetry run python measurement.py`
50+
- In VS Code ([link](https://code.visualstudio.com/docs/python/environments#_select-and-activate-an-environment))
51+
- Alternative: run commands with `poetry run`. i.e., `poetry run python measurement.py`
5252

5353
# Adding dependencies
5454

55-
Add dependency package for `ni_measurementlink_service` using [poetry add](https://python-poetry.org/docs/cli/#add) command.
55+
Add dependency package for `ni_measurementlink_service` using the [`poetry add`](https://python-poetry.org/docs/cli/#add) command.
5656

5757
```cmd
5858
poetry add <name_of_dependency>:<version>
@@ -66,7 +66,7 @@ poetry add -D <name_of_dev_dependency>:<version>
6666

6767
# Updating gRPC stubs when a .proto file is modified
6868

69-
The `ni_measurementlink_service\_internal\stubs` directory contains the auto-generated python files based on MeasurementLink protobuf (.proto) files. The file needs to be replaced whenever there is a change to these .proto files:
69+
The `ni_measurementlink_service\_internal\stubs` directory contains the auto-generated Python files based on MeasurementLink protobuf (`.proto`) files. The file needs to be replaced whenever there is a change to these `.proto` files:
7070

7171
- ni/measurementlink/pin_map_context.proto
7272
- ni/measurementlink/discovery/v1/discovery_service.proto
@@ -76,9 +76,9 @@ The `ni_measurementlink_service\_internal\stubs` directory contains the auto-gen
7676
- nidevice_grpc/README.md
7777
- nidevice_grpc/session.proto
7878

79-
The latest .proto files are available in [Azure Repo](https://dev.azure.com/ni/DevCentral/_git/ASW?path=/Source/Protos). From the Azure Repo manually download and overwrite the proto files under the `ni_measurementlink_service\_internal\stubs\proto` folder.
79+
The latest .proto files are available in [Azure Repo](https://dev.azure.com/ni/DevCentral/_git/ASW?path=/Source/Protos). From the Azure Repo manually download and overwrite the `.proto` files under the `ni_measurementlink_service\_internal\stubs\proto` folder.
8080

81-
Run `poetry run python scripts/generate_grpc_stubs.py`. This generates the required *.py file for the listed proto files. The required `grpcio-tools` package is already added as a development dependency in pyproject.toml.
81+
Run `poetry run python scripts/generate_grpc_stubs.py`. This generates the required `.py` files for the listed `.proto` files. The required `grpcio-tools` package is already added as a development dependency in pyproject.toml.
8282

8383
# Lint and Build Code
8484

@@ -100,7 +100,7 @@ Running this command from the repo's root directory will generate the tar.gz fil
100100

101101
# Testing
102102

103-
`ni-measurementlink-service` includes tests under the directory `tests\` that exercises the python and grpc modules. The GitHub CI run these tests for PRs targeting the main branch. It is recommended that during development you run the tests locally before creating a PR.
103+
`ni-measurementlink-service` includes regression tests under the `tests/` directory. The GitHub CI runs these tests for PRs targeting the main branch. It is recommended that during development you run the tests locally before creating a PR.
104104

105105
In order to run the `ni-measurementlink-service` tests locally:
106106

@@ -113,7 +113,7 @@ In order to run the `ni-measurementlink-service` tests locally:
113113
(.venv) PS D:\TAF\measurementlink-python> poetry run pytest -v
114114
```
115115
116-
## Using VS code Test Explorer extension(UI)
116+
## Using VS Code Test Explorer extension (UI)
117117
118118
Install and configure the `Python Test Explorer for Visual Studio Code` extension to execute/debug the tests using UI. For more details related to the extension, refer [here](https://marketplace.visualstudio.com/items?itemName=LittleFoxTeam.vscode-python-test-adapter).
119119

README.md

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
- [Create a batch file that runs a python measurement](#create-a-batch-file-that-runs-a-python-measurement)
1414
- [Create Executable for Python Scripts](#create-executable-for-python-scripts)
1515
- [API References](#api-references)
16-
- [Appendix: Managing Measurement as Python Package(Project)](#appendix-managing-measurement-as-python-packageproject)
17-
- [Create and Manage Python Measurement Package using poetry](#create-and-manage-python-measurement-package-using-poetry)
18-
- [Create and Manage Python Measurement Package using venv](#create-and-manage-python-measurement-package-using-venv)
16+
- [Appendix: Managing Measurement as Python Package (Project)](#appendix-managing-measurement-as-python-package-project)
17+
- [Create and Manage Python Measurement Package using Poetry](#create-and-manage-python-measurement-package-using-poetry)
18+
- [Create and Manage Python Measurement Package using `venv`](#create-and-manage-python-measurement-package-using-venv)
1919
- [Create and Manage Python Measurement Package by directly installing `ni-measurementlink-service` as a system-level package](#create-and-manage-python-measurement-package-by-directly-installing-ni-measurementlink-service-as-a-system-level-package)
2020

2121
---
2222

2323
## Introduction
2424

25-
MeasurementLink Support for Python (`ni-measurementlink-service`) is a python framework that enables measurement developers to quickly create python measurements and run them as a service (gRPC).
25+
MeasurementLink Support for Python (`ni-measurementlink-service`) is a Python framework that enables measurement developers to quickly create Python measurements and run them as a service (gRPC).
2626

2727
---
2828

@@ -63,7 +63,7 @@ This section provides instructions to develop custom measurement services in Pyt
6363

6464
### Installation
6565

66-
Make sure the system has the recommended python version is installed. Install MeasurementLink Support for Python using [pip](https://pip.pypa.io/).
66+
Make sure the system has the recommended Python version is installed. Install MeasurementLink Support for Python using [pip](https://pip.pypa.io/).
6767

6868
``` cmd
6969
REM Activate the required virtual environment if any.
@@ -76,7 +76,7 @@ Check if you have installed the expected version of MeasurementLink Support for
7676
pip show ni-measurementlink-service
7777
```
7878

79-
### Developing a minimal python measurement
79+
### Developing a minimal Python measurement
8080

8181
1. Install the `ni-measurementlink-generator` package.
8282

@@ -107,7 +107,7 @@ pip install ni-measurementlink-generator
107107
be placed in a new folder under the current directory
108108
named after the display name without spaces.
109109

110-
3. To customize the created measurement, provide metadata of the measurement's configuration(input parameters) and outputs(output parameters) in `measurement.py`.
110+
3. To customize the created measurement, provide metadata of the measurement's configuration (input parameters) and outputs (output parameters) in `measurement.py`.
111111
1. Use the `configuration()` decorator to provide metadata about the configurations.**The order of the configuration decorator must match with the order of the parameters defined in the function signature.**
112112

113113
``` python
@@ -140,7 +140,7 @@ pip install ni-measurementlink-generator
140140

141141
1. Start the discovery service if not already started.
142142

143-
2. (Optional)Activate related virtual environments. Measurement developers can skip this step if they are not using any [virtual environments](#create-and-manage-python-measurement-package-using-venv) or [poetry-based projects.](#create-and-manage-python-measurement-package-using-poetry)
143+
2. (Optional) Activate related virtual environments. Measurement developers can skip this step if they are not using any [virtual environments](#create-and-manage-python-measurement-package-using-venv) or [poetry-based projects.](#create-and-manage-python-measurement-package-using-poetry)
144144

145145
```cmd
146146
.venv\scripts\activate
@@ -153,11 +153,11 @@ pip install ni-measurementlink-generator
153153
Set-ExecutionPolicy RemoteSigned
154154
```
155155

156-
3. [Run](https://code.visualstudio.com/docs/python/python-tutorial#_run-hello-world)/[Debug](https://code.visualstudio.com/docs/python/debugging#_basic-debugging) the measurement python file.
156+
3. [Run](https://code.visualstudio.com/docs/python/python-tutorial#_run-hello-world)/[Debug](https://code.visualstudio.com/docs/python/debugging#_basic-debugging) the measurement Python file.
157157

158158
4. To stop the running measurement service, press `Enter` in the terminal to properly close the service.
159159

160-
5. (Optional)After the usage of measurement, deactivate the virtual environment. Measurement developers can skip this step if they are not using any [virtual environments](#create-and-manage-python-measurement-package-using-venv) or [poetry-based projects.](#create-and-manage-python-measurement-package-using-poetry)
160+
5. (Optional) After the usage of measurement, deactivate the virtual environment. Measurement developers can skip this step if they are not using any [virtual environments](#create-and-manage-python-measurement-package-using-venv) or [poetry-based projects.](#create-and-manage-python-measurement-package-using-poetry)
161161

162162
```cmd
163163
deactivate
@@ -179,7 +179,7 @@ To statically register a measurement service with the MeasurementLink discovery
179179

180180
Once your measurement service is statically registered, the MeasurementLink discovery service makes it visible in supported NI applications.
181181

182-
### Create a batch file that runs a python measurement
182+
### Create a batch file that runs a Python measurement
183183

184184
The batch file used for static registration is responsible for starting the Python Scripts.
185185

@@ -227,44 +227,45 @@ pyinstaller --onefile --console --add-data "<path_of_the_UI_File>;." --paths .ve
227227

228228
If copying or running a measurement service produces "File not found" or "No such file or directory" errors, make sure to [enable Win32 long paths](#enable-win32-long-paths). If you are unable to enable Win32 long paths, consider deploying the measurement service to a directory with a shorter path.
229229

230-
## Appendix: Managing Measurement as Python Package(Project)
230+
## Appendix: Managing Measurement as Python Package (Project)
231231

232-
Measurement and its related files can be maintained as a python package. The basic components of any Python Measurement Package are:
232+
Measurement and its related files can be maintained as a Python package. The basic components of any Python measurement package are:
233233

234-
1. Measurement Python Module(.py file)
234+
1. Measurement Python module (`.py` file)
235235
- This file contains all the details related to the measurement and also contains the logic for the measurement execution.
236236
- This file is run to start the measurement as a service.
237237

238238
2. UI File
239-
- UI file for the Measurement. Types of supported UI files are:
240-
- Measurement UI(.measui): created using the **Measurement UI Editor application**.
241-
- LabVIEW UI(.vi)
242-
- The path of this file is configured by `ui_file_path` in `measurement_info` variable definition in Measurement Python Module(.py file).
239+
- UI file for the measurement. Types of supported UI files are:
240+
- Measurement UI (`.measui`): created using the **Measurement UI Editor application**.
241+
- LabVIEW UI (`.vi`)
242+
- The path of this file is configured by `ui_file_path` in `measurement_info` variable definition in measurement Python module (`.py`).
243243

244-
Python communities have different ways of managing a python package and its dependencies. It is up to the measurement developer, on how they wanted to maintain the package and dependencies. Measurement developers can choose from a few common approaches discussed below based on their requirements.
244+
Python communities have different ways of managing Python packages and their dependencies. It is up to the measurement developer to decide how to maintain the package and dependencies. Measurement developers can choose from a few common approaches discussed below based on their requirements.
245245

246-
### Create and Manage Python Measurement Package using poetry
246+
### Create and Manage Python Measurement Package using Poetry
247247

248-
1. Setting up Poetry(One-time setup)
249-
1. Make sure the system has the recommended python version installed.
248+
1. Install `poetry` (one-time setup)
250249

251-
2. Install the `poetry` using the installation steps given in <https://python-poetry.org/docs/#installation>.
250+
1. Make sure the system has the recommended Python version installed.
252251

253-
2. Create a new python project and add `ni-measurementlink-service` as a dependency to the project.
252+
2. Install `poetry` using the installation steps given in <https://python-poetry.org/docs/#installation>.
253+
254+
2. Create a new Python project and add `ni-measurementlink-service` as a dependency to the project.
254255

255256
1. Open a command prompt, and change the working directory to the directory of your choice where you want to create the project.
256257

257258
``` cmd
258259
cd <path_of_directory_of_your_choice>
259260
```
260261

261-
2. Create a python package(project) using the poetry new command. Poetry will create boilerplate files and folders that are commonly needed for a python project.
262+
2. Create a Python package (project) using the `poetry new` command. Poetry will create boilerplate files and folders that are commonly needed for a Python project.
262263

263264
``` cmd
264265
poetry new <name_of_the_project>
265266
```
266267

267-
3. Add the `ni-measurementlink-service` package as a dependency using the [poetry add command](https://python-poetry.org/docs/cli/#add).
268+
3. Add the `ni-measurementlink-service` package as a dependency using the [`poetry add`](https://python-poetry.org/docs/cli/#add) command.
268269

269270
``` cmd
270271
cd <name_of_the_project>
@@ -273,7 +274,7 @@ Python communities have different ways of managing a python package and its depe
273274

274275
4. The virtual environment will be auto-created by poetry.
275276

276-
5. Create measurement modules as described in ["Developing a minimal python measurement"](#developing-a-minimal-python-measurement)
277+
5. Create measurement modules as described in ["Developing a minimal Python measurement"](#developing-a-minimal-python-measurement)
277278
- Any additional dependencies required by measurement can be added using [add command](https://python-poetry.org/docs/cli/#add).
278279

279280
``` cmd
@@ -282,9 +283,9 @@ Python communities have different ways of managing a python package and its depe
282283

283284
For detailed info on managing projects using poetry [refer to the official documentation](https://python-poetry.org/docs/cli/).
284285

285-
### Create and Manage Python Measurement Package using venv
286+
### Create and Manage Python Measurement Package using `venv`
286287

287-
1. Make sure the system has the recommended python version installed.
288+
1. Make sure the system has the recommended Python version installed.
288289

289290
2. Open a command prompt, and change the working directory to the directory of your choice where you want to create a project.
290291

@@ -313,14 +314,14 @@ For detailed info on managing projects using poetry [refer to the official docum
313314
pip install ni-measurementlink-service
314315
```
315316

316-
6. Create measurement modules as described in ["Developing a minimal python measurement"](#developing-a-minimal-python-measurement)
317+
6. Create measurement modules as described in ["Developing a minimal Python measurement"](#developing-a-minimal-python-measurement)
317318
- Any additional dependencies required by measurement can be added pip install.
318319

319320
``` cmd
320321
pip install <dependency_package_name>
321322
```
322323

323-
For detailed info on managing projects with a virtual environment [refer to the official documentation](https://docs.python.org/3/tutorial/venv.html).
324+
For detailed info on managing projects with a virtual environment, refer to the [official documentation](https://docs.python.org/3/tutorial/venv.html).
324325

325326
### Create and Manage Python Measurement Package by directly installing `ni-measurementlink-service` as a system-level package
326327

@@ -332,6 +333,6 @@ Measurement developers can also install `ni-measurementlink-service` as a system
332333
pip install ni-measurementlink-service
333334
```
334335

335-
2. Create measurement modules as described in ["Developing a minimal python measurement"](#developing-a-minimal-python-measurement)
336+
2. Create measurement modules as described in ["Developing a minimal Python measurement"](#developing-a-minimal-python-measurement)
336337

337338
---

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For more details about a specific example, see the `README.md` file included wit
1818

1919
The example measurements are *Poetry-based* projects. Follow the steps below to set up an example measurement:
2020

21-
1. Install `poetry`. Refer to <https://python-poetry.org/docs/#installation> for information on installing poetry.
21+
1. Install `poetry`. Refer to <https://python-poetry.org/docs/#installation> for information on installing Poetry.
2222

2323
2. Open a command prompt and change the working directory to the directory of the example measurement you want to work with.
2424

0 commit comments

Comments
 (0)