Skip to content

Commit

Permalink
improved documentation and logging statements (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Maas authored Sep 4, 2022
1 parent 28959f1 commit bbdc7d2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ a directory and it's subdirectories, and comparing those to the dependencies lis

---

## Installation and usage
## Quickstart

### Installation

__deptry__ can be added to your project with
_deptry_ can be added to your project with

```
poetry add deptry
poetry add --dev deptry
```

Alternatively, it can be installed with `pip install deptry`.

### Prerequisites

In order to check for obsolete imports, __deptry__ should be run directly within the directory that contains the __pyproject.toml__ file, and it requires the environment created with __pyproject.toml__ to be activated.
In order to check for obsolete imports, _deptry_ requires a _pyproject.toml_ file to be present in the directory passed as the first argument, and it requires the corresponding environment to be activated.

### Usage

Expand Down
8 changes: 5 additions & 3 deletions deptry/imports_to_package_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ def convert(self, imported_modules: List[str]) -> List[str]:
for module in imported_modules:
try:
packages.append(metadata(module)["Name"])
logging.debug(f"imported module {module}'s corresponding package name is {metadata(module)['Name']}.")
logging.debug(
f"Corresponding package name for imported module `{module}` is `{metadata(module)['Name']}`."
)
except: # noqa
if module in self._get_stdlib_packages():
logging.debug(f"module {module} is in the Python standard library.")
logging.debug(f"module `{module}` is in the Python standard library.")
elif module in COMMON_PACKAGES_WITHOUT_METADATA.keys():
packages.append(COMMON_PACKAGES_WITHOUT_METADATA[module])
else:
logging.warning(
f"Warning: Failed to find corresponding package name for import {module} in current environment."
f"Warning: Failed to find corresponding package name for import `{module}` in current environment."
)

if len(packages) == 0:
Expand Down
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
_deptry_ is a command line tool to check for unused dependencies in a poetry managed Python project. It does so by scanning the imported modules within all Python files in
a directory and it's subdirectories, and comparing those to the dependencies listed in `pyproject.toml`.

## Installation and usage
## Quickstart

### Installation

_deptry_ can be added to your project with

```
poetry add deptry
poetry add --dev deptry
```

Alternatively, it can be installed with `pip install deptry`.

### Prerequisites

In order to check for obsolete imports, _deptry_ should be run directly within the directory that contains the _pyproject.toml_ file, and it requires the environment created with _pyproject.toml_ to be activated.
In order to check for obsolete imports, _deptry_ requires a _pyproject.toml_ file to be present in the directory passed as the first argument, and it requires the corresponding environment to be activated.

### Usage

Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Prerequisites

In order to check for obsolete imports, _deptry_ should be run directly within the directory that contains the _pyproject.toml_ file, and it requires the environment created with _pyproject.toml_ to be activated.
In order to check for obsolete imports, _deptry_ requires a _pyproject.toml_ file to be present in the directory passed as the first argument, and it requires the corresponding environment to be activated.

## Basic Usage

Expand Down

0 comments on commit bbdc7d2

Please sign in to comment.