Skip to content

FEAT: --version CLI flag  #72

Description

@Prakhar54-byte

Additional context
Add any other details or mockups here. Feature Request

**Describe the feature you'd like**                                                                                       
Add a `--version` flag to the `databusclient` CLI so users can quickly check which                                        
version is installed without reading `pip show databusclient`.                                                            
                                                                                                                          
```bash                                                                                                                   
$ databusclient --version                                                                                                 
databusclient, version 0.15                                                                                               

This is standard behaviour for Python CLI tools built with Click — Click provides
built-in support via @click.version_option .

Why is this feature important?

• It's the first thing users check when filing a bug report or asking for support.
• Currently version = "0.15" exists in init.py but is completely
unreachable from the command line. There is no way for a user to confirm which
version they are running without using pip show databusclient .
• It is a standard UX expectation for any CLI tool ( git --version ,
docker --version , rclone --version , etc.).

Proposed implementation
Click provides this out of the box with a single decorator on the app group in
cli.py :

# cli.py                                                                                                                  
import databusclient                                                                                                      
                                                                                                                          
@click.group()                                                                                                            
@click.version_option(version=databusclient.__version__, prog_name="databusclient")                                       
def app():                                                                                                                
    """Databus Client CLI."""                                                                                             
    pass                                                                                                                  

This produces:

$ databusclient --version                                                                                                 
databusclient, version 0.15                                                                                               

No new dependencies are required — click.version_option is already part of Click
which is an existing dependency.

Describe alternatives you've considered

• Reading the version via pip show databusclient — works but is not discoverable
and requires pip to be available in the same environment.
• A separate databusclient version subcommand — unnecessarily verbose compared
to the conventional --version flag.

Additional context
Related: the version string is currently hardcoded in both pyproject.toml and
databusclient/init.py . Ideally version should be derived from the
installed package metadata ( importlib.metadata.version("databusclient") ) so it
stays in sync with the installed version automatically and the duplication is
eliminated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions