Skip to content

Commit 23d235c

Browse files
fix: handle missing "company"/"website" keys in afterpython.toml
1 parent 2b5879b commit 23d235c

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

src/afterpython/cli/commands/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def determine_base_path() -> str:
3737

3838
# Read website URL from afterpython.toml
3939
afterpython = read_afterpython()
40-
website_url = str(_from_tomlkit(afterpython["website"]).get("url", ""))
40+
website_url = str(_from_tomlkit(afterpython.get("website", {})).get("url", ""))
4141

4242
# If custom domain (no github.io), no BASE_PATH needed
4343
if "github.io" not in website_url:

src/afterpython/cli/commands/init.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ def init(ctx, yes):
6666

6767
afterpython_path.mkdir(parents=True, exist_ok=True)
6868
static_path.mkdir(parents=True, exist_ok=True)
69-
afterpython_path.joinpath("afterpython.toml").touch()
7069

7170
init_pyproject()
7271

src/afterpython/cli/commands/sync.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ def sync():
5151
project_name = str(pyproject.name)
5252
afterpython = read_afterpython()
5353
github_url = str(pyproject.urls.get("repository", ""))
54-
company_name = str(_from_tomlkit(afterpython["company"]).get("name", ""))
55-
company_url = str(_from_tomlkit(afterpython["company"]).get("url", ""))
56-
website_url = str(_from_tomlkit(afterpython["website"]).get("url", ""))
54+
company_name = str(_from_tomlkit(afterpython.get("company", {})).get("name", ""))
55+
company_url = str(_from_tomlkit(afterpython.get("company", {})).get("url", ""))
56+
website_url = str(_from_tomlkit(afterpython.get("website", {})).get("url", ""))
5757
authors = pyproject.authors
5858
if company_name and company_url:
5959
nav_bar = [{"title": company_name, "url": company_url}]

0 commit comments

Comments
 (0)