# nitor-vault

Python vault implementation.

See the [root readme](../README.md) for more information.

## Dependencies

Python dependencies are specified in [pyproject.toml](./pyproject.toml).
The `requirements.txt` file is generated by pip compile and should not be modified manually.

Use the provided shell script to update the requirements file.
First install [uv](https://github.com/astral-sh/uv) (recommended),
or alternatively `pip-tools` using [pipx](https://github.com/pypa/pipx).
Then run:

```shell
./compile-requirements.sh
# See help
./compile-requirements.sh -h
```

## Development

uv is the recommended way to handle virtual environments for development.

Create a venv and install all dependencies:

```shell
uv sync --all-extras
```

You can then run commands directly with the venv using `uv run`,
or activate the venv manually first.
The uv default venv location is `.venv`.

```shell
source .venv/bin/activate
# or Windows
.venv\Scripts\activate
```

The vault CLI can be run without installing using:

```shell
uv run python n_vault/cli.py
# or with venv activated
python3 n_vault/cli.py
```

Or install inside venv with:

```shell
# With uv
uv pip install .
# Normal venv
python -m pip install .
```

After installing, you will have `vault` available in path.

## Release

Use the provided shell script.
Note that you need to have a venv with the extra dependencies installed active when running the script.

```shell
./release.sh
# See help
./release.sh -h
```

## Code formatting and linting

Code formatting and linting with [ruff](https://github.com/charliermarsh/ruff).

These are configured with a custom line length limit of 120.
The configs can be found in [pyproject.toml](./pyproject.toml).

Usage:

```shell
ruff format
ruff check --fix
```

These can also be integrated to IDEs / editors or run as a pre-commit hook.
See the documentation for the [Ruff extension](https://github.com/astral-sh/ruff-vscode) for VS Code.

Using with [pre-commit](https://pre-commit.com/) (run from repo root):

```shell
# setup to be run automatically on git commit
pre-commit install

# run manually
pre-commit run --all-files
```
