Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update show #502

Merged
merged 5 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "tach"
version = "0.19.1"
version = "0.19.2"
edition = "2021"

[lib]
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/commands.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ If you use the [pre-commit framework](https://github.com/pre-commit/pre-commit),
```yaml
repos:
- repo: https://github.com/gauge-sh/tach-pre-commit
rev: v0.19.1 # change this to the latest tag!
rev: v0.19.2 # change this to the latest tag!
hooks:
- id: tach
```
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "tach"
version = "0.19.1"
version = "0.19.2"
authors = [
{ name = "Caelean Barnes", email = "[email protected]" },
{ name = "Evan Doyle", email = "[email protected]" },
Expand Down
2 changes: 1 addition & 1 deletion python/tach/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from __future__ import annotations

__version__: str = "0.19.1"
__version__: str = "0.19.2"

__all__ = ["__version__"]
6 changes: 5 additions & 1 deletion python/tach/constants/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
from __future__ import annotations

import os

PACKAGE_NAME: str = "tach"
TOOL_NAME: str = "tach"
CONFIG_FILE_NAME: str = TOOL_NAME
PACKAGE_FILE_NAME: str = "package"
ROOT_MODULE_SENTINEL_TAG: str = "<root>"

DEFAULT_EXCLUDE_PATHS = ["tests", "docs", ".*__pycache__", ".*egg-info"]

GAUGE_API_BASE_URL: str = os.getenv("GAUGE_API_BASE_URL", "https://app.gauge.sh")

__all__ = [
"PACKAGE_NAME",
"TOOL_NAME",
"CONFIG_FILE_NAME",
"PACKAGE_FILE_NAME",
"ROOT_MODULE_SENTINEL_TAG",
"DEFAULT_EXCLUDE_PATHS",
"GAUGE_API_BASE_URL",
]
2 changes: 1 addition & 1 deletion python/tach/modularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from tach import filesystem as fs
from tach.colors import BCOLORS
from tach.constants import GAUGE_API_BASE_URL
from tach.errors import TachClosedBetaError, TachError
from tach.extension import (
CheckDiagnostics,
Expand Down Expand Up @@ -53,7 +54,6 @@ def upload_report_to_gauge(


GAUGE_API_KEY = os.getenv("GAUGE_API_KEY", "")
GAUGE_API_BASE_URL = os.getenv("GAUGE_API_BASE_URL", "https://app.gauge.sh")
GAUGE_UPLOAD_URL = f"{GAUGE_API_BASE_URL}/api/client/tach-upload/1.3"


Expand Down
10 changes: 4 additions & 6 deletions python/tach/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from urllib import error, request

from tach import filesystem as fs
from tach.constants import GAUGE_API_BASE_URL
from tach.extension import DependencyConfig, ModuleConfig, ProjectConfig

if TYPE_CHECKING:
Expand All @@ -15,9 +16,6 @@
import pydot # type: ignore


TACH_SHOW_URL = "https://show.gauge.sh"


def generate_show_url(
project_root: Path,
project_config: ProjectConfig,
Expand All @@ -30,7 +28,7 @@ def generate_show_url(
json_data = project_config.model_dump_json()
json_bytes = json_data.encode("utf-8")
req = request.Request(
f"{TACH_SHOW_URL}/api/core/0.6.5/graph/",
f"{GAUGE_API_BASE_URL}/api/show/graph/1.3",
data=json_bytes,
headers={"Content-Type": "application/json"},
)
Expand All @@ -40,8 +38,8 @@ def generate_show_url(
with request.urlopen(req) as response:
response_data = response.read().decode("utf-8")
response_json = json.loads(response_data)
url = response_json.get("uid")
return f"{TACH_SHOW_URL}?uid={url}"
uid = response_json.get("uid")
return f"{GAUGE_API_BASE_URL}/show?uid={uid}"
except (UnicodeDecodeError, JSONDecodeError, error.URLError) as e:
print(f"Error: {e}")
return None
Expand Down
1 change: 1 addition & 0 deletions tach.toml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ expose = [
"PACKAGE_FILE_NAME",
"ROOT_MODULE_SENTINEL_TAG",
"DEFAULT_EXCLUDE_PATHS",
"GAUGE_API_BASE_URL"
]
from = [
"tach.constants",
Expand Down