pypas-cli 0.4.2__tar.gz → 0.4.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pypas_cli-0.4.2/src/pypas_cli.egg-info → pypas_cli-0.4.3}/PKG-INFO +1 -1
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/pyproject.toml +1 -1
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas/lib/sysutils.py +32 -3
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas/main.py +2 -5
- {pypas_cli-0.4.2 → pypas_cli-0.4.3/src/pypas_cli.egg-info}/PKG-INFO +1 -1
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/LICENSE +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/README.md +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/setup.cfg +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas/__init__.py +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas/lib/auth.py +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas/lib/config.py +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas/lib/console.py +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas/lib/decorators.py +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas/lib/exercise.py +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas/lib/monads.py +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas/lib/network.py +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas/settings.py +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas_cli.egg-info/SOURCES.txt +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas_cli.egg-info/dependency_links.txt +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas_cli.egg-info/entry_points.txt +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas_cli.egg-info/requires.txt +0 -0
- {pypas_cli-0.4.2 → pypas_cli-0.4.3}/src/pypas_cli.egg-info/top_level.txt +0 -0
|
@@ -73,10 +73,17 @@ def get_package_data(package: str = 'pypas-cli') -> dict[str, str]:
|
|
|
73
73
|
return {}
|
|
74
74
|
|
|
75
75
|
|
|
76
|
-
def
|
|
76
|
+
def show_package_info(package: str = 'pypas-cli') -> None:
|
|
77
77
|
if data := get_package_data(package):
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
console.print(
|
|
79
|
+
dedent(f"""\
|
|
80
|
+
Package: {data.get('name')}
|
|
81
|
+
Version: [note]{data.get('version')}[/note]
|
|
82
|
+
Path: {data.get('location')}\
|
|
83
|
+
""")
|
|
84
|
+
)
|
|
85
|
+
else:
|
|
86
|
+
console.error(f"Package '{package}' is not yet installed")
|
|
80
87
|
|
|
81
88
|
|
|
82
89
|
def get_latest_package_version(package: str = 'pypas-cli') -> str | None:
|
|
@@ -152,3 +159,25 @@ def unzip(zip_path: Path, extract_to: Path | None = None) -> Path:
|
|
|
152
159
|
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
|
|
153
160
|
zip_ref.extractall(extract_to)
|
|
154
161
|
return extract_to
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def handle_upgrade_pypas():
|
|
165
|
+
latest_version = get_latest_package_version()
|
|
166
|
+
package_data = get_package_data()
|
|
167
|
+
current_version = package_data.get('version')
|
|
168
|
+
# current_version = '0.0.0' # Temporary hardcoded version for testing
|
|
169
|
+
if latest_version and current_version:
|
|
170
|
+
if latest_version != current_version:
|
|
171
|
+
if upgrade_pypas():
|
|
172
|
+
console.success(
|
|
173
|
+
f'Upgraded pypas-cli from [note]v{current_version}[/note] to [note]v{latest_version}[/note]'
|
|
174
|
+
)
|
|
175
|
+
else:
|
|
176
|
+
console.error('Error upgrading pypas')
|
|
177
|
+
else:
|
|
178
|
+
console.success(
|
|
179
|
+
f"You're on the latest version of pypas-cli: [note]v{current_version}[/note]",
|
|
180
|
+
emphasis=False,
|
|
181
|
+
)
|
|
182
|
+
else:
|
|
183
|
+
console.error('Could not determine pypas-cli version information')
|
|
@@ -27,7 +27,7 @@ def default(
|
|
|
27
27
|
):
|
|
28
28
|
if version:
|
|
29
29
|
sysutils.handle_package_version()
|
|
30
|
-
|
|
30
|
+
sysutils.show_package_info()
|
|
31
31
|
# https://typer.tiangolo.com/tutorial/commands/context/#exclusive-executable-callback
|
|
32
32
|
elif ctx.invoked_subcommand is None:
|
|
33
33
|
typer.echo(ctx.get_help())
|
|
@@ -94,10 +94,7 @@ def auth(token: str = typer.Argument(help='Access token')):
|
|
|
94
94
|
@app.command()
|
|
95
95
|
def upgrade():
|
|
96
96
|
"""Upgrade pypas-cli from PyPI."""
|
|
97
|
-
|
|
98
|
-
print(sysutils.get_package_info())
|
|
99
|
-
else:
|
|
100
|
-
console.error('Error upgrading pypas')
|
|
97
|
+
sysutils.handle_upgrade_pypas()
|
|
101
98
|
|
|
102
99
|
|
|
103
100
|
@app.command()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|