Skip to content

Commit dbe5253

Browse files
authored
Merge pull request #7 from Validus-Risk-Management/optional-pip-config
0.3: Optional pip configuration
2 parents bbfaa31 + 88b621d commit dbe5253

5 files changed

Lines changed: 243 additions & 299 deletions

File tree

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ partifact login myrepo --profile myprofile
5050
partifact login myrepo --role myrole
5151
```
5252

53+
If you would also like to configure `global.index-url` in the `pip` config,
54+
you can do so through the `--configure-pip` flag.
55+
56+
```shell
57+
partifact login myrepo --profile myprofile --configure-pip
58+
```
59+
5360
# Known issues
5461

5562
1. The `CodeArtifact` token seems to exceed the maximum length allowed in Windows Credential Manager, resulting

partifact/main.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from typing import Optional
22

33
import typer
4+
from typing_extensions import Annotated
45

56
from partifact.auth_token import get_token
67
from partifact.config import Configuration
@@ -9,19 +10,28 @@
910
app = typer.Typer()
1011

1112
profile_option = typer.Option(
12-
None, help="The AWS profile to use when getting the CodeArtifact token."
13+
"--profile",
14+
"-p",
15+
help="The AWS profile to use when getting the CodeArtifact token.",
1316
)
1417

1518
role_option = typer.Option(
16-
None, help="The AWS role to use when getting the CodeArtifact token."
19+
"--role", "-r", help="The AWS role to use when getting the CodeArtifact token."
20+
)
21+
22+
should_configure_pip_option = typer.Option(
23+
"--configure-pip",
24+
"-c",
25+
help="Set global.index-url for pip in addition to configuring poetry.",
1726
)
1827

1928

2029
@app.command()
2130
def login(
2231
repository: str,
23-
profile: Optional[str] = profile_option,
24-
role: Optional[str] = role_option,
32+
profile: Annotated[Optional[str], profile_option] = None,
33+
role: Annotated[Optional[str], role_option] = None,
34+
should_configure_pip: Annotated[bool, should_configure_pip_option] = False,
2535
) -> None:
2636
"""Log into CodeArtifact.
2737
@@ -30,7 +40,8 @@ def login(
3040
config = Configuration.load(repository, profile, role)
3141
token = get_token(config)
3242

33-
configure_pip(config, token)
43+
if should_configure_pip:
44+
configure_pip(config, token)
3445
configure_poetry(repository, token)
3546

3647

0 commit comments

Comments
 (0)