Update Developer setup authored by Steinar Hjellvik's avatar Steinar Hjellvik
## Prerequisites ## Prerequisites
Before starting, install the following tools: Before starting, install the following tools:
- Python 3.8 or later - Python 3.12 or later
- Pip package manager - Pip package manager
For more information on these tools, see the public documentation on For more information on these tools, see the public documentation on
[Python](https://www.python.org/downloads/) or [Python](https://www.python.org/downloads/) or
[Pip](https://pip.pypa.io/en/stable/installing/) [Pip](https://pip.pypa.io/en/stable/installing/)
Development can be done on Windows, macOS, and Linux. Development can be done on Windows, macOS, and Linux.
## Installation ## Installation
From the root of your cloned repo, generate a virtual environment with a From the root of your cloned repo, generate a virtual environment with a
specific version of python. specific version of python.
Windows Windows
```bash ```bash
python -m venv .env python -m venv .env
.env\Scripts\activate.bat .env\Scripts\activate.bat
``` ```
Linux / MacOS Linux / MacOS
```bash ```bash
python3 -m venv .env python3 -m venv .env
. ./.env/bin/activate . ./.env/bin/activate
``` ```
(Optional) If you want to be able to make changes to the osdu-sdk that is used for communication with the OSDU API's then this should also be installed in developer mode. If you omit this step then you will use the published version of the sdk referenced in setup.py Next install the main cli package in developer mode along with any necessary development packages.
```bash ```bash
pip install -e ..\osdu-sdk-python pip install -e ".[dev]"
pip install -r requirements-dev.txt ```
```
You should now be able to run the command line.
Next install the main cli package in developer mode along with any necessary development packages.
```bash
```bash osdu
pip install -e . ```
pip install -r requirements-dev.txt
``` ## Validation
You should now be able to run the command line. You can run local validation including testing and linting using the provided scripts.
```bash Windows
osdu ```bash
``` scripts\verify.bat
```
## Validation
Linux / MacOS
You can run local validation including testing and linting using the provided scripts. ```bash
./scripts/verify
Windows ```
```bash
scripts\verify.bat The above can take the following optional arguments to just run specific portions of the validation:
``` * lint
* tests
Linux / MacOS * format
```bash
./scripts/verify e.g.
``` ```bash
./scripts/verify lint
The above can take the following optional arguments to just run specific portions of the validation: ```
* lint
* tests To run a more fuller validation across all supported python versions run tox.
* format ```bash
tox
e.g. ```
```bash
./scripts/verify lint If needed, configure the paths to the relevant python installations for tox as follows.
``` ```bash
set TOX_DISCOVER=C:\Applications\miniconda3\envs\py39\python.exe
To run a more fuller validation across all supported python versions run tox. ```
```bash
tox ## VS Code Extensions
```
If you are using VS Code, it is recommended you install two extensions
If needed, configure the paths to the relevant python installations for tox as follows. (`ext install <name>`):
```bash
set TOX_DISCOVER=C:\Applications\miniconda3\envs\py39\python.exe - [python](https://marketplace.visualstudio.com/items?itemName=donjayamanne.python)
``` - [code-spell-checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker)
## VS Code Extensions Keep the project dictionary up to date by adding exclusions when running spell
check.
If you are using VS Code, it is recommended you install two extensions
(`ext install <name>`): For different virtual environments, it is also important to update the workspace
Python interpreter. Select an interpreter by running the `Python: Select
- [python](https://marketplace.visualstudio.com/items?itemName=donjayamanne.python) Workspace Interpreter` command.
- [code-spell-checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker)
## Conventions
Keep the project dictionary up to date by adding exclusions when running spell
check. Before submitting any pull requests for merging, be sure to review the
requirements and suggestions outlined in the [[coding conventions|Conventions]] documentation.
For different virtual environments, it is also important to update the workspace
Python interpreter. Select an interpreter by running the `Python: Select
Workspace Interpreter` command.
## Conventions
Before submitting any pull requests for merging, be sure to review the
requirements and suggestions outlined in the [[coding conventions|Conventions]] documentation.