Metadata-Version: 2.4
Name: dependency-metrics
Version: 0.1.3
Summary: Python tool to track outdated dependencies.
Author-email: Dimagi <dev@dimagi.com>
Maintainer-email: Dimagi <dev@dimagi.com>
License: Copyright (c) 2023, Dimagi Inc., and individual contributors.
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
            * Redistributions of source code must retain the above copyright
              notice, this list of conditions and the following disclaimer.
            * Redistributions in binary form must reproduce the above copyright
              notice, this list of conditions and the following disclaimer in the
              documentation and/or other materials provided with the distribution.
            * Neither the name Dimagi, nor the names of its contributors, may be used
              to endorse or promote products derived from this software without
              specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
        ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
        WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL DIMAGI INC. BE LIABLE FOR ANY
        DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
        (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
        LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
        ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: repository, https://github.com/dimagi/dependency-metrics
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Requires-Dist: sh>=2.0.0
Provides-Extra: test
Requires-Dist: freezegun; extra == "test"
Requires-Dist: nose2; extra == "test"
Dynamic: license-file

## Welcome to dependency-metrics ##

### Summary
A command line tool to analyze and monitor how up-to-date dependencies of a project are. For more detail, see the [Usage](#usage) section below.

#### Supported Package Managers
- pip or uv
- yarn

#### Supported Application Monitoring Platforms
- DataDog


### Usage
Run the `metrics` tool from within the repository you wish to generate metrics for.

#### Default behavior

All that is needed is the package manager you want to generate metrics for, and `metrics` will output a table detailing
how out-of-date each dependency is.

```commandline
$ metrics pip
Behind   Package                      Latest       Version
0.1.0    my-depedency                 1.1.0        1.0.0
2.0.0    my-other-dependency          3.2.1        1.2.3
```

#### --stats option

Use the `--stats` option to generate a simple dictionary that displays the total number of outdated dependencies, as well as a breakdown detailing the number of outdated dependencies for each version type.

```commandline
$ metrics pip --stats
Total: 5
Outdated: 2
Multi-Major: 1
Major: 0
Minor: 1
Patch: 0
Unknown: 0
```

#### --send option

> **NOTE:**  Additional setup is required to successfully post stats to a supported backend. See [platform setup](#application-monitoring-platform-setup) for further information.

Use the `--send` option to post the same metrisc generated by `--stats` to an application monitoring platform.

```commandline
$ metrics pip --send
```

### Application Monitoring Platform Setup
This is required to make use of the `--send` option, enabling the ability to send generated stats to a backend of your choice.

#### DataDog
Set the `DATADOG_API_KEY` and `DATADOG_APP_KEY` environment variables in the environment you will run `metrics <package_manager> --send` from.

### Development

#### Requirements

```commandline
pip install -e .  # installs dependencies defined in pyproject.toml
pip install -e .[test]  # installs test dependencies -- '.[test]' if using zsh
```

#### Tests
Must install test dependencies first. See [requirements](#requirements) above.

```commandline
nose2  # runs all tests
nose2 dot.path.to.file.class.or.test  # runs specific test
```

### Publishing to PyPI

To publish a new release on [pypi.org](https://pypi.org/p/dependency-metrics/):

- Update `__version__` in [dependency_metrics/_\_init__.py](dependency_metrics/__init__.py).
- Create and push a git tag with the new version number.
  ```sh
  git tag vX.Y.Z
  git push --tags
  ```
- Wait for the [pypi.yml workflow](https://github.com/dimagi/dependency-metrics/actions/workflows/pypi.yml)
  to build and publish the new release.

A dev release is published on [test.pypi.org](https://test.pypi.org/p/dependency-metrics/)
on each new push or merge to main. A dev release may also be published
on-demand for any branch with
[workflow dispatch](https://github.com/dimagi/dependency-metrics/actions/workflows/pypi.yml).
