Skip to content

Commit 9bae1c3

Browse files
committed
submissions/sessions work
1 parent def9098 commit 9bae1c3

File tree

8 files changed

+31
-67
lines changed

8 files changed

+31
-67
lines changed

Makefile

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,3 @@
1-
# Variables for the project
2-
# =========================
3-
CONFERENCE ?= ep2025
4-
DATA_DIR ?= ./data/public/$(CONFERENCE)/
5-
6-
# Variables for remote host
7-
# =========================
8-
VPS_USER ?= static_content_user
9-
VPS_HOST ?= static.europython.eu
10-
VPS_PATH ?= /home/$(VPS_USER)/content/static/programme/$(CONFERENCE)/releases
11-
REMOTE_CMD=ssh $(VPS_USER)@$(VPS_HOST)
12-
13-
# Variables for deploy
14-
# ====================
15-
TIMESTAMP ?= $(shell date +%Y%m%d%H%M%S)
16-
FORCE_DEPLOY ?= false
17-
181
# Optional arguments
192
# ==================
203
EXCLUDE ?=
@@ -23,16 +6,7 @@ WARN_DUPES ?= false
236
# Convert EXCLUDE space-separated list to repeated --exclude flags
247
EXCLUDE_FLAGS = $(foreach item,$(EXCLUDE),--exclude $(item))
258

26-
dev:
27-
uv sync --dev
28-
29-
deps/upgrade:
30-
uv lock --upgrade
31-
32-
deps/install:
33-
uv sync
34-
35-
install: deps/install
9+
all: download transform
3610

3711
download:
3812
python -m src.download $(EXCLUDE_FLAGS)
@@ -44,18 +18,6 @@ else
4418
python -m src.transform $(EXCLUDE_FLAGS)
4519
endif
4620

47-
all: download transform
48-
49-
ifeq ($(FORCE_DEPLOY), true)
50-
deploy: TARGET = $(VPS_PATH)/$(TIMESTAMP)
51-
deploy:
52-
@echo "\n\n**** Deploying branch '$(CONFERENCE)' to $(TARGET)...\n\n"
53-
$(REMOTE_CMD) "mkdir -p $(TARGET)"
54-
rsync -avz --delete $(DATA_DIR) $(VPS_USER)@$(VPS_HOST):$(TARGET)
55-
$(REMOTE_CMD) "cd $(VPS_PATH) && ln -snf $(TIMESTAMP) current"
56-
@echo "\n\n**** Deployment complete.\n\n"
57-
endif
58-
5921
test:
6022
uv run pytest
6123

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[project]
22
name = "programapi"
3-
version = "2025.4.5"
3+
version = "2025.10.14"
44
description = "Programme API for EuroPython"
55
readme = "README.md"
6-
requires-python = ">=3.12"
6+
requires-python = ">=3.12,<3.14"
77
classifiers = [
88
"Programming Language :: Python :: 3 :: Only",
99
"Programming Language :: Python :: 3.12",

src/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66

77
class Config:
8-
event = "europython-2025"
9-
event_dir_name = "ep2025"
8+
event = "pyladiescon-2025"
9+
event_dir_name = "plc25"
1010
api_version = "v1"
1111

1212
project_root = Path(__file__).resolve().parents[1]

src/download.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@
2727
base_url = f"https://pretalx.com/api/events/{Config.event}/"
2828
schedule_url = (
2929
base_url
30-
+ "schedules/latest?expand="
31-
+ "slots,slots.submission,slots.submission.submission_type,slots.submission.track,slots.room"
30+
+ "schedules/latest?lang=en&expand="
31+
+ "slots,slots.submission,slots.submission.submission_type,slots.submission.track,slots.room,slots.submission.content_locale"
3232
)
3333

3434
# Build resource list dynamically based on exclusions
3535
resources = [
36-
"submissions?state=confirmed&expand=answers.question,submission_type,track,slots.room,resources",
37-
"speakers?expand=answers.question",
36+
"submissions?state=confirmed&lang=en&expand=answers.question,submission_type,track,slots.room,resources,content_locale",
37+
"speakers?lang=en&expand=answers.question",
3838
]
3939

4040
if "youtube" not in exclude:

src/misc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ class SpeakerQuestion:
1212

1313

1414
class SubmissionQuestion:
15+
talk_topic = "Talk topic"
1516
outline = "Outline"
1617
tweet = "Abstract as a short post (150 character max)"
1718
delivery = "My presentation can be delivered in-person"
18-
level = "Expected audience expertise"
19+
level = "Level"
20+
language = "Language"
1921

2022

2123
class SubmissionState(Enum):

src/models/europython.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ class EuroPythonSpeaker(BaseModel):
3535

3636
@computed_field
3737
def website_url(self) -> str:
38-
return (
39-
f"https://ep{Config.event.split('-')[1]}.europython.eu/speaker/{self.slug}"
40-
)
38+
return f"https://{Config.event.split('-')[1]}.conference.pyladies.com/speaker/{self.slug}"
4139

4240
@model_validator(mode="before")
4341
@classmethod
@@ -312,6 +310,7 @@ class EuroPythonSession(BaseModel):
312310
duration: str = ""
313311
level: str = ""
314312
delivery: str = ""
313+
language: str = ""
315314
resources: list[dict[str, str | None]] | None = None
316315
room: str | None = None
317316
start: datetime | None = None
@@ -334,17 +333,19 @@ def handle_poster_room(cls, value) -> str | None:
334333

335334
@computed_field
336335
def website_url(self) -> str:
337-
return (
338-
f"https://ep{Config.event.split('-')[1]}.europython.eu/session/{self.slug}"
339-
)
336+
return f"https://{Config.event.split('-')[1]}.conference.pyladies.com/session/{self.slug}"
340337

341338
@model_validator(mode="before")
342339
@classmethod
343340
def extract_answers(cls, values) -> dict:
344341
answers = [PretalxAnswer.model_validate(ans) for ans in values["answers"]]
345342

346343
for answer in answers:
347-
# TODO if we need any other questions
344+
if answer.question_text == SubmissionQuestion.talk_topic and not values.get(
345+
"track"
346+
):
347+
values["track"] = answer.answer_text
348+
348349
if answer.question_text == SubmissionQuestion.tweet:
349350
values["tweet"] = answer.answer_text
350351

src/models/pretalx.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class PretalxAnswer(BaseModel):
1616
@model_validator(mode="before")
1717
@classmethod
1818
def extract(cls, values) -> dict:
19-
values["question_text"] = values["question"]["question"]["en"]
19+
values["question_text"] = values["question"]["question"]
2020
values["answer_text"] = values["answer"]
2121
values["answer_file"] = values["answer_file"]
2222
values["submission_id"] = values["submission"]
@@ -31,9 +31,9 @@ class PretalxSlot(BaseModel):
3131

3232
@field_validator("room", mode="before")
3333
@classmethod
34-
def handle_localized(cls, v) -> str | None:
34+
def handle_dict(cls, v) -> str | None:
3535
if isinstance(v, dict):
36-
return v["name"].get("en")
36+
return v["name"]
3737
return v
3838

3939

@@ -63,6 +63,8 @@ class PretalxSubmission(BaseModel):
6363
state: SubmissionState
6464
abstract: str = ""
6565
duration: str = ""
66+
content_locale: str = Field(exclude=True)
67+
language: str = ""
6668
resources: list[dict[str, str | None]] | None = None
6769
answers: list[PretalxAnswer]
6870
slots: list[PretalxSlot] = Field(default_factory=list, exclude=True)
@@ -75,9 +77,9 @@ class PretalxSubmission(BaseModel):
7577

7678
@field_validator("submission_type", "track", mode="before")
7779
@classmethod
78-
def handle_localized(cls, v) -> str | None:
80+
def handle_dict(cls, v) -> str | None:
7981
if isinstance(v, dict):
80-
return v["name"].get("en")
82+
return v["name"]
8183
return v
8284

8385
@field_validator("duration", mode="before")
@@ -95,6 +97,8 @@ def handle_resources(cls, v) -> list[dict[str, str]] | None:
9597
@model_validator(mode="before")
9698
@classmethod
9799
def process_values(cls, values) -> dict:
100+
values["language"] = values["content_locale"]
101+
98102
# Transform resource information
99103
if raw_resources := values.get("resources"):
100104
resources = [
@@ -129,13 +133,6 @@ class PretalxScheduleBreak(BaseModel):
129133
end: datetime
130134
description: dict[str, str] | str
131135

132-
@field_validator("description", mode="before")
133-
@classmethod
134-
def handle_localized(cls, v) -> str | Any:
135-
if isinstance(v, dict):
136-
return v.get("en")
137-
return v
138-
139136
@model_validator(mode="before")
140137
@classmethod
141138
def set_slot_info(cls, values) -> dict:

src/utils/transform.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def pretalx_submissions_to_europython_sessions(
4242
session_type=submission.submission_type,
4343
slug=session_code_to_slug[submission.code],
4444
track=submission.track,
45+
language=submission.language,
4546
abstract=submission.abstract,
4647
duration=submission.duration,
4748
resources=submission.resources,
@@ -140,6 +141,7 @@ def pretalx_schedule_to_europython_schedule(
140141
track=session.track,
141142
tweet=session.tweet,
142143
level=session.level,
144+
language=session.language,
143145
total_duration=int(session.duration),
144146
rooms=[session.room],
145147
start=start_time,

0 commit comments

Comments
 (0)