Read as str no bytes

+handle when project_name is None (fails, basically)
This commit is contained in:
Thiago Moretto
2024-08-29 15:17:51 -03:00
parent c8c0a89dc6
commit cda1900b14
2 changed files with 6 additions and 2 deletions

View File

@@ -66,11 +66,11 @@ def get_git_remote_url() -> str | None:
return None
def get_project_name(pyproject_path: str = "pyproject.toml"):
def get_project_name(pyproject_path: str = "pyproject.toml") -> str | None:
"""Get the project name from the pyproject.toml file."""
try:
# Read the pyproject.toml file
with open(pyproject_path, "rb") as f:
with open(pyproject_path, "r") as f:
pyproject_content = parse_toml(f.read())
# Extract the project name