Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

Commit

Permalink
chore: move libcst requirement to extras (#50)
Browse files Browse the repository at this point in the history
The package uses libcst only for the optional 1.0 -> 2.0 fixer script, so it should not be a hard runtime requirement.

This avoids apps using the package pulling in `pyyaml`, `typing-inspect` and `typing-extensions` too, which is a big win in my books.
  • Loading branch information
akx committed Jan 25, 2021
1 parent 29746e1 commit 0cc82e4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion UPGRADING.md
Expand Up @@ -20,7 +20,7 @@ Methods expect request objects. We provide a script that will convert most commo
* Install the library

```py
python3 -m pip install google-cloud-iam
python3 -m pip install google-cloud-iam[fixup]
```

* The script `fixup_credentials_v1_keywords.py` is shipped with the library. It expects an input directory (with the code to convert) and an empty destination directory.
Expand Down
2 changes: 1 addition & 1 deletion docs/UPGRADING.md
Expand Up @@ -20,7 +20,7 @@ Methods expect request objects. We provide a script that will convert most commo
* Install the library

```py
python3 -m pip install google-cloud-iam
python3 -m pip install google-cloud-iam[fixup]
```

* The script `fixup_credentials_v1_keywords.py` is shipped with the library. It expects an input directory (with the code to convert) and an empty destination directory.
Expand Down
7 changes: 6 additions & 1 deletion scripts/fixup_credentials_v1_keywords.py
Expand Up @@ -18,11 +18,16 @@

import argparse
import os
import libcst as cst
import pathlib
import sys
from typing import (Any, Callable, Dict, List, Sequence, Tuple)

try:
import libcst as cst
except ImportError:
print("*** Could not import libcst! Did you install the google-cloud-iam package with the `[fixup]` extra?")
raise


def partition(
predicate: Callable[[Any], bool],
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -30,7 +30,6 @@
dependencies = [
"google-api-core[grpc] >= 1.22.0, < 2.0.0dev",
"proto-plus >= 0.4.0",
"libcst >= 0.2.5",
]

package_root = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -74,6 +73,7 @@
packages=packages,
namespace_packages=namespaces,
install_requires=dependencies,
extras_require={"fixup": ["libcst >= 0.2.5"]},
python_requires=">=3.6",
scripts=["scripts/fixup_credentials_v1_keywords.py"],
include_package_data=True,
Expand Down

0 comments on commit 0cc82e4

Please sign in to comment.