Metadata-Version: 2.3
Name: vqu
Version: 0.1.2
Summary: Query and update version numbers across multiple configuration files.
Keywords: version,dotenv,json,toml,xml,yaml,config,configuration,file,management,automation,project,projects,monorepo,cli
Author: Alexis Bergue
License: MIT License
         
         Copyright (c) 2025 Alexis Bergue
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Utilities
Requires-Dist: pydantic>=2.12.5
Requires-Dist: pyyaml>=6.0.3
Requires-Dist: termcolor>=3.2.0
Requires-Python: >=3.10
Project-URL: Issues, https://github.com/alexisbg/vqu/issues
Project-URL: Repository, https://github.com/alexisbg/vqu
Description-Content-Type: text/markdown

# vqu

`vqu` is a command-line tool for querying and updating version numbers across
multiple configuration files in your projects. It allows you to:

- **Query** version information from .env, JSON, TOML, XML, and YAML
  configuration files
- **Compare** versions across different files to ensure consistency
- **Update** version numbers simultaneously in all configured files with a
  single command

`vqu` uses [yq](https://github.com/mikefarah/yq) syntax to locate and extract
version values from your configuration files. This means you can use powerful
query expressions like `.version`, `.project.version`, or
`.metadata[0].version` to precisely target version fields regardless of file
format or nesting depth.

This is particularly useful for monorepos and projects that maintain version
information across multiple configuration formats. Instead of manually updating
each file, `vqu` automates the process and validates that all versions are
consistent.

## Requirements

### System
- [yq](https://github.com/mikefarah/yq?tab=readme-ov-file#install) must be
  installed on your system.

### Python
- `vqu` requires Python 3.10 or later.
- Runs on macOS, Windows, and all Linux distributions.

## Installation
`vqu` can be installed using `pip`:
```
pip install vqu
```

## YAML File Structure

By default, vqu looks for a `.vqu.yaml` configuration file in the current
directory. Here's an example of the configuration structure:

```yaml
projects:
  Project_1:
    version: 0.1.1
    config_files:
      - path: proj1/.env
        format: dotenv
        filters:
          - expression: .VERSION
      - path: proj1/conf.json
        format: json
        filters:
          - expression: .project.version
  Project_2:
    version: 0.1.3
    config_files:
      - path: proj2/conf.yaml
        format: yaml
        filters:
          - expression: .project.version
```

### Schema

**Root level:**
- `projects` - Object containing one or more project definitions. Keys are
  arbitrary project names.

**Project object:**
- `version` (required) - The expected version number for this project
  (e.g., `"0.1.1"`).
- `config_files` (required) - Array of configuration files to manage for this
  project.

**Configuration file object:**
- `path` (required) - Path to the configuration file, relative to the
  `.vqu.yaml` file.
- `format` (required) - File format. Supported formats: `dotenv`, `json`,
  `toml`, `xml`, `yaml`.
- `filters` (required) - Array of filter objects that extract version values
  from this file.

**Filter object:**
- `expression` (required) - A
  [yq query expression](https://mikefarah.gitbook.io/yq) that targets a
  version value in the configuration file (e.g., `.version`,
  `.project.version`, `.[0].version`).

## Example

If you've downloaded or cloned the repository from
[GitHub](https://github.com/alexisbg/vqu), you can try the example
configuration:

```bash
vqu -c ./examples/.vqu.yaml
```

This will output version information for all configured projects with
color-coded status:

<img src="https://github.com/alexisbg/vqu/raw/main/.github/images/vqu_example.webp" alt="vqu example output" width="382" style="width: 382px">

**Color legend:**
- 🟢 Version matches the expected
  project version
- 🟡 Version differs from the
  expected project version
- 🔴 Value not found or invalid version
  format

## Command line usage
```
usage: vqu [project] [options]

Query and update version numbers across multiple configuration files.

positional arguments:
  project               The name of the project to display versions for.

options:
  -c PATH, --config PATH
                        Path to the configuration file (default: .vqu.yaml).
  -u, --update          Write the version numbers in the configuration files.
  -h, --help            Show this help message and exit.
  -v, --version         Show the version and exit.
```

## License
This project is licensed under the terms of the MIT license.
