API (autodoc)
Generated from the package’s docstrings (Google style). For the bigger picture, read Architecture first.
Configuration
Centralized runtime configuration in two disjoint tiers.
App config (
config/.env, gitignored, machine-local): the single jobjob instance — secrets, local paths, output IDs, and the profile registry.Profile config (
<profile-repo>/config/.profile, committed): the active profile’s applicant identity and resume template.
The two key sets are disjoint (APP_KEYS / PROFILE_KEYS) with no
fallback between them; load_settings validates that neither file carries the
other’s keys. The entry point calls load_settings once and passes concrete
values each function needs — feature modules never import Settings.
- NOTE: the google credential/token env-var names are owned by
jobjob.loader.auth and re-used here so they are defined in exactly one place.
- class jobjob.config.GoogleSettings(credentials_file: Path | None = None, token_file: Path | None = None, template_id: str | None = None)[source]
Bases:
objectGoogle Drive/Docs credential + template settings.
- credentials_file
OAuth client-secrets JSON path.
- Type:
pathlib.Path | None
- token_file
Pickled-token path.
- Type:
pathlib.Path | None
- class jobjob.config.Settings(applicant: Applicant, model: str = 'claude-sonnet-4-6', anthropic_api_key: str | None = None, anthropic_base_url: str | None = None, cache_enabled: bool = True, google: GoogleSettings = <factory>, applications_input_dir: Path = PosixPath('data'), applications_output_dir: Path | None = None, applications_output_drive_id: str | None = None, enrichment_input_dir: Path = PosixPath('data'), enrichment_output_sheet_id: str | None = None, profile_name: str | None = None, profile_dir: Path | None = None, industry: str | None = None)[source]
Bases:
objectAggregated runtime settings (built once at the entry point).
Inputs/outputs are modeled per component (Applications = apply, Enrichment = enrich). Inputs are local-only for now.
- applicant
Applicant identity.
- Type:
jobjob.structure.applicant.Applicant
- anthropic_base_url
Optional override for the Anthropic API base URL. Point it at a Claude-compatible proxy (e.g. one forwarding to a free Gemini key) to run without a paid Anthropic key. None uses the SDK default.
- Type:
str | None
- google
Google credential + resume-template settings.
- applications_input_dir
Local root holding
jobs/,profiles/andcompleted/for the apply flow — where a processed JD moves on completion.- Type:
- applications_output_dir
Local synced Google Drive applications mirror; when set, the completed-applications list is read from here instead of Drive.
- Type:
pathlib.Path | None
- enrichment_input_dir
Local input root for the enrich flow; defaults to
applications_input_dirwhen its own key is unset.- Type:
- jobjob.config.load_settings(app_config: Path = PosixPath('config/.env')) Settings[source]
Load settings from the app config plus the active profile config.
Sources
app_config(machine-local), resolves the active profile from the registry it declares, then sources that profile’sconfig/.profile. The two key sets are validated as disjoint.load_dotenvis a no-op on a missing file, so the ambient environment is used as-is when a file is absent.- Parameters:
app_config – Path to the app
config/.env. Defaults toconfig/.env.- Returns:
A populated Settings.
- Raises:
ValueError – If a configured active profile dir is missing, or the two configs violate the zero-overlap rule.
Profiles and content
Profile registry resolution.
A profile is a separate git repo holding one content set (highlights,
reference docs, and a committed config/.profile). The app config registers
profiles by path and names the active one:
JOBJOB_PROFILE_LOCAL="/path/to/your/profile"
JOBJOB_ACTIVE_PROFILE="local"
This module is intentionally dependency-light (os + pathlib) so both
jobjob.config and jobjob.loader.location can import it without a cycle.
It reads os.environ (populated by load_dotenv of the app config), so the
active-profile lookup reflects whatever the app config most recently sourced.
- class jobjob.loader.profiles.Profile(name: str, path: Path, read_only: bool, owned: bool)[source]
Bases:
objectA registered (or bundled) profile with its state resolved once at load time.
- path
The profile directory.
- Type:
- read_only
True if this is the bundled example (lives in the read-only package
static/exampleand may only be duplicated).- Type:
- jobjob.loader.profiles.active_profile_name() str | None[source]
Return the active profile name (lowercased), or None if unset.
- jobjob.loader.profiles.all_profiles() dict[str, Path][source]
Return the registered profiles plus the bundled
exampleprofile.The registry (
list_profiles) is the user-managed source of truth; the read-onlyexampleis injected here so it is always switchable for reference without polluting the user’s config. An explicitJOBJOB_PROFILE_EXAMPLEregistry entry overrides the bundled location.
- jobjob.loader.profiles.build_profiles(profiles_base: Path | None = None) dict[str, Profile][source]
Resolve every profile (registry + bundled example) into
Profileobjects.read_onlyandownedare computed once here so callers carry the flags instead of recomputing predicates.profiles_baseis the homeprofiles/dir (used to decideowned); when None, no profile is considered owned.- Parameters:
profiles_base – The
<home>/profilesdir, or None if unknown.- Returns:
{name: Profile}for the bundled example plus all registered profiles.
- jobjob.loader.profiles.bundled_example_dir() Path | None[source]
Return the bundled example profile dir (
static/example), or None.Computed directly from this file’s location (
<root>/jobjob/loader/profiles.py→<root>/static/example) so this module stays import-light (no dependency onloader.location). The example lives in its own subdir — isolated from any otherstatic/assets — and doubles as the no-active-profile fallback. Returns None when the dir is absent (e.g. a stripped install), so callers can simply skip the example.
- jobjob.loader.profiles.list_profiles() dict[str, Path][source]
Return the registered profiles as
{name: repo_path}(names lowercased).Reads
JOBJOB_PROFILE_<NAME>=<path>entries from the environment. The active-profile pointer (JOBJOB_ACTIVE_PROFILE) is not a registry entry.
- jobjob.loader.profiles.profile_config_file(profile_dir: Path) Path[source]
Return the path to a profile repo’s committed config (
config/.profile).
- jobjob.loader.profiles.read_env_keys(path: Path) set[str][source]
Return the set of
KEYnames assigned in a dotenv-format file.Blank lines, comments, and lines without
=are ignored. Used to validate that app and profile configs hold disjoint key sets.
- jobjob.loader.profiles.resolve_active_profile_dir() Path | None[source]
Return the active profile’s repo path, or None when none is configured.
Returns the registered path even if it does not yet exist on disk — callers decide whether a missing dir is an error (config load) or a fallback signal (content resolution).
Create a blank-but-valid jobjob profile from a built-in skeleton.
A new profile starts empty — no Tila Mer (or any other) example content — but
structurally complete: the content TOMLs parse and load to empty sets, the reference
dirs exist, and config/.profile is present (blank). The user fills it in via the
Static Content / Profile pages or by importing a résumé (see jobjob.ingest).
Kept here (next to loadcontent/location) so the exact [tool.*] shapes the
loaders expect stay co-located with the code that reads them.
- jobjob.loader.skeleton.create_blank_profile(dest: Path) Path[source]
Write a blank-but-valid profile tree at
destand return it.Creates
content/{highlights,skills,templates,experience}.toml,reference/{background.md,writing_style.md,cover_letters/,stars/}, andconfig/.profile. Parent dirs are created as needed; existing files are left untouched (idempotent), so re-running never clobbers user edits.- Parameters:
dest – The profile directory to populate.
- Returns:
dest.
Resource file location management.
Resolves content, reference, and prompt resources against the active
profile repo (<profile>/<name>) when one is configured, falling back to the
bundled example profile (static/example/<name>) so tests and a fresh clone
work without a profile. Prompts override per-file but default to the bundled
jobjob versions.
- NOTE: resource getters are intentionally NOT cached — resolution depends on the
active profile (
os.environ), which can change at runtime on a profile switch.get_root_dir/get_static_dir/example getters are profile- independent and stay cached.
- jobjob.loader.location.get_content_dir() Path[source]
Return the content dir: the active profile’s
content/if present, elsestatic/content.- Raises:
FileNotFoundError if neither exists. –
- jobjob.loader.location.get_content_path(stem: str) Path[source]
Return the content file for
stemfrom the resolved content dir.- Raises:
ValueError if file stem not found. –
- jobjob.loader.location.get_prompt_dir() Path[source]
Return the prompt dir: the active profile’s
prompt/if present, else the bundledjobjob/prompts.
- jobjob.loader.location.get_prompt_path(stem: str) Path[source]
Return the prompt file for
stem.A profile may override individual prompts in its
prompt/dir; any prompt it does not provide falls back to the bundledjobjob/promptsdefault.- Raises:
ValueError if file stem not found in the profile override or the default. –
- jobjob.loader.location.get_reference_dir() Path[source]
Return the reference dir: the active profile’s
reference/if present, elsestatic/reference.- Raises:
FileNotFoundError if neither exists. –
- jobjob.loader.location.get_root_dir() Path[source]
Return the jobjob project root (the dir containing the
jobjobpackage).Anchored on this file’s location (
<root>/jobjob/loader/location.py) rather than searching the path for"jobjob"— robust when the checkout/site-packages dir is itself namedjobjob.
- jobjob.loader.location.get_static_dir() Path[source]
Return path to default static dir at project root.
- Raises:
FileNotFoundError if default dir does not exist. –
- jobjob.loader.location.package_prompt_dir() Path[source]
Public accessor for the bundled default prompt dir (
jobjob/prompts).The prompts editor needs the bundled default explicitly (to show it and to reset an override), independent of any active-profile override resolution.
Load credential highlights and skills from the static TOML content files.
- jobjob.loader.loadcontent.load_experience(path: Path | None = None) ExperienceSet[source]
Load the structured work history from
content/experience.toml.- NOTE: experience is an optional content file (it postdates the other content,
and a fresh/imported profile may not have it yet), so a missing file returns an empty set rather than raising — unlike highlights/skills.
- Parameters:
path – Override path to the TOML file. Defaults to the static content path.
- Returns:
A populated ExperienceSet (empty when no file is present).
- jobjob.loader.loadcontent.load_highlights(path: Path | None = None) HighlightSet[source]
Load the highlight set from
static/content/highlights.toml.- Parameters:
path – Override path to the TOML file. Defaults to the static content path.
- Returns:
A populated HighlightSet.
- jobjob.loader.loadcontent.load_skills(path: Path | None = None, logger: Logger | None = None) SkillSet[source]
Load the skill set from
static/content/skills.toml.- Parameters:
path – Override path to the TOML file. Defaults to the static content path.
logger – Optional logger for injection.
- Returns:
A populated SkillSet.
- jobjob.loader.loadcontent.load_templates(path: Path | None = None, fallback_doc_id: str | None = None) TemplateSet[source]
Load resume templates from
static/content/templates.toml.- NOTE: when the TOML is absent and
fallback_doc_idis given, returns a single “default” template using that id (backward-compatible with a single
RESUME_TEMPLATE_ID).
- Parameters:
path – Override path to the TOML file. Defaults to the static content path.
fallback_doc_id – A single Google Doc id to use when no TOML is present.
- Returns:
A TemplateSet (possibly empty if neither source is available).
- NOTE: when the TOML is absent and
Domain models
Credential highlight blocks and their selection metadata.
- class jobjob.structure.highlight.Highlight(context: str, text: str, keywords: tuple[str, ...]=<factory>, enabled: bool = True, topic: str = '')[source]
Bases:
objectA single pre-written credential block.
- class jobjob.structure.highlight.HighlightSet(highlights: tuple[Highlight, ...], default_number: int = 6, max_characters: int = 900, min_characters: int = 600)[source]
Bases:
objectA collection of highlights plus selection defaults.
- highlights
All loaded highlights (enabled and disabled).
- Type:
- jobjob.structure.highlight.make_highlight_set(highlights: Iterable[Highlight], default_number: int | None = None, max_characters: int | None = None, min_characters: int | None = None) HighlightSet[source]
Build a HighlightSet from an iterable of highlights.
- NOTE: selection defaults live only on
HighlightSet; passing None for any keeps that field’s default (so the value is declared in exactly one place).
- Parameters:
highlights – The highlights.
default_number – Override for the default selection count.
max_characters – Override for the max total character count.
min_characters – Override for the min total character count.
- Returns:
A HighlightSet.
- NOTE: selection defaults live only on
Skill entries and their selection metadata.
- class jobjob.structure.skill.Skill(label: str, text: str, keywords: tuple[str, ...]=<factory>, canonical_id: str | None = None, categories: dict[str, float]=<factory>)[source]
Bases:
objectA single skill entry.
- class jobjob.structure.skill.SkillSet(skills: tuple[Skill, ...], default_number: int = 12)[source]
Bases:
objectA collection of skills plus selection defaults.
- skills
All loaded skills.
- Type:
- jobjob.structure.skill.make_skill_set(skills: Iterable[Skill], default_number: int | None = None) SkillSet[source]
Build a SkillSet from an iterable of skills.
- NOTE: the selection default lives only on
SkillSet; passing None keeps that field’s default (declared in one place).
- Parameters:
skills – The skills.
default_number – Override for the default selection count.
- Returns:
A SkillSet.
- NOTE: the selection default lives only on
Resume template variations (archetypes).
- class jobjob.structure.template.ResumeSection(heading: str, section: str, enabled: bool = True)[source]
Bases:
objectAn editable region of a resume template, located by its heading.
- section
How the section is filled —
SECTION_OBJECTIVE(model-rewritten paragraph) orSECTION_HIGHLIGHTS(bullets replaced with selected highlights, verbatim).- Type:
- class jobjob.structure.template.ResumeTemplate(name: str, archetype: str, doc_id: str, keywords: tuple[str, ...]=<factory>, description: str | None = None, sections: tuple[~jobjob.structure.template.ResumeSection, ...]=<factory>)[source]
Bases:
objectA resume template tailored to a role archetype.
- sections
Editable sections located by heading and tailored per
section.- Type:
- class jobjob.structure.template.TemplateSet(templates: tuple[ResumeTemplate, ...], default: str | None = None)[source]
Bases:
objectA collection of resume templates plus the default selection.
- templates
All available templates.
- by_name(name: str) ResumeTemplate | None[source]
Return the template with
name, or None.
- default_template() ResumeTemplate | None[source]
Return the default template (falls back to the first available).
- require(name: str) ResumeTemplate[source]
Return the template with
nameor raise.- Raises:
KeyError – If no template has that name.
- jobjob.structure.template.make_template_set(templates: Iterable[ResumeTemplate], default: str | None = None, sections: Iterable[ResumeSection] = ()) TemplateSet[source]
Build a TemplateSet from an iterable of templates.
- NOTE:
sectionsare shared template structure (the resumes share headings); they are attached to every template that does not already define its own.
- NOTE:
Workflow
Orchestrate the end-to-end application workflow.
Sequential model calls share one cached context prefix (highlights, STARs,
background, cover-letter examples, writing style, and — in Drive mode — the
customized resume). The offline path (skip_drive=True) produces local
artifacts and is fully exercised by tests; the Drive path adds Google I/O.
Drive folder per application (YYYY-MM-DD - Company - Role) contains exactly:
the README (Google Doc), the JD (JD_<Company>_<Role>.pdf), the resume (the
customized Google Doc), and the cover letter (Google Doc).
- exception jobjob.apply.workflow.OverwriteConflict(folder_name: str)[source]
Bases:
ExceptionA fresh apply would overwrite an existing application folder.
Raised when processing a new JD whose target
Company - Rolefolder already exists and the caller did not opt into overwriting. The webapp surfaces this so the user can relaunch with override (acknowledge) or clear the queued JD.- folder_name
The conflicting
Company - Rolefolder name.
- jobjob.apply.workflow.apply_inputs(input_path: ~pathlib.Path, query_service: ~jobjob.ailib.session.AIClient, applicant: ~jobjob.structure.applicant.Applicant, output_dir: ~pathlib.Path | None = None, skip_drive: bool = False, use_cache: bool = True, template_id: str | None = None, template_name: str | None = None, parent_id: str | None = None, data_dir: ~pathlib.Path | None = None, allow_overwrite: bool = False, archive_on_conflict: bool = False, industry: str | None = None, applications_output_dir: ~pathlib.Path | None = None, entity_dir: ~pathlib.Path | None = None, logger: ~logging.Logger | None = None, _credentials_loader: ~collections.abc.Callable[[...], ~typing.Any] = <function get_google_credentials>, _classify: ~collections.abc.Callable[[...], str] = <function classify_file>) dict[source]
Run the application workflow for every JD at
input_path(file or dir).A single file is processed directly. For a directory, each entry is classified and only job descriptions are processed; non-JD files (LinkedIn profiles, anything unsupported) are skipped with a log line — apply’s half of the shared single-input-directory. Processing continues past a per-file error.
Each JD in a directory gets its own
output_dir/<jd-stem>subdirectory when noapplications_output_diris configured — the legacy/offline fallback, since in that caserun_application_workflowwrites local artifacts flat intooutput_dirand would otherwise clobber the previous JD’s files. Whenapplications_output_diris set (the mainstream case), each JD resolves its own<Company - Role>entity folder instead, so no subdir is needed.- Parameters:
input_path – A job-description PDF, or a directory of mixed inputs.
query_service – AIClient driving the workflow (and classifying ambiguous files).
applicant – Applicant identity.
output_dir – Local output root. Per-JD subdirs are created under it in dir mode.
skip_drive – Skip Google Drive/Docs operations.
use_cache – Whether model calls consult/populate the response cache.
template_id – Resume-template Google Doc id.
template_name – Force a resume template (else auto-detected).
parent_id – Applications-root Drive folder id.
data_dir – Root holding
completed/; when set (and notskip_drive), a successfully-applied JD is moved into<data_dir>/completed/jobs/.allow_overwrite – Forwarded to
run_application_workflow.archive_on_conflict – Forwarded to
run_application_workflow.industry – Optional domain/industry context for the active profile, forwarded to the resume-objective prompt.
applications_output_dir – Local Drive-mirror root; forwarded so each JD’s identity and artifacts persist into
<root>/<Company - Role>rather than the ephemeral output dir.entity_dir – Explicit persistent identity folder (a single-application re-run targeting an existing/renamed folder). In directory mode leave it None so each JD resolves its own folder under
applications_output_dir.logger – Optional logger for injection.
_credentials_loader – Injection point for Google credentials (testing).
_classify – Injection point for the file classifier (testing).
- Returns:
{processed, skipped, failed, items: [{name, status, ...}]}.- Return type:
Summary dict
- Raises:
FileNotFoundError – If
input_pathdoes not exist.
- jobjob.apply.workflow.build_cached_context(highlight_set: HighlightSet, reference: ReferenceDocs, resume_text: str | None = None) str[source]
Assemble the stable, cached system context shared across all calls.
- NOTE: order matters for prompt caching — stable content first; the resume
(added in Drive mode) goes last as it is the most volatile prefix piece.
- Parameters:
highlight_set – All available highlights.
reference – Loaded reference documents.
resume_text – Customized resume text, if available.
- Returns:
The cached-context string.
- jobjob.apply.workflow.move_completed_jd(src: Path, data_dir: Path, folder_name: str, logger: Logger | None = None) Path[source]
Move a processed JD into
<data_dir>/completed/jobs/<folder_name><ext>.Called on a successful application so the JD leaves the input area — the same behavior for the CLI and the webapp. Renamed to match the Drive folder.
- Parameters:
src – The processed job-description file.
data_dir – Root holding
jobs//completed/.folder_name – Drive application folder name (
YYYY-MM-DD - Company - Role).logger – Optional logger for injection.
- Returns:
The new path.
- jobjob.apply.workflow.run_application_workflow(job_description_pdf: ~pathlib.Path, *, query_service: ~jobjob.ailib.session.AIClient, applicant: ~jobjob.structure.applicant.Applicant, output_dir: ~pathlib.Path | None = None, skip_drive: bool = False, highlight_set: ~jobjob.structure.highlight.HighlightSet | None = None, reference: ~jobjob.structure.reference.ReferenceDocs | None = None, use_cache: bool = True, template_id: str | None = None, template_name: str | None = None, parent_id: str | None = None, reuse_folder_id: str | None = None, allow_overwrite: bool = False, archive_on_conflict: bool = False, industry: str | None = None, applications_output_dir: ~pathlib.Path | None = None, entity_dir: ~pathlib.Path | None = None, logger: ~logging.Logger | None = None, _credentials_loader: ~collections.abc.Callable[[...], ~typing.Any] = <function get_google_credentials>, _drive_builder: ~collections.abc.Callable[[...], ~typing.Any] = <function build_drive_service>, _docs_builder: ~collections.abc.Callable[[...], ~typing.Any] = <function build_docs_service>) dict[source]
Run the full application workflow and return a results dict.
- Parameters:
job_description_pdf – Path to the job-description PDF.
query_service – AIClient (callable + cached context + usage).
applicant – Applicant identity (for cover-letter headers).
output_dir – Local output directory. Used as-is only as a last-resort fallback (legacy/offline: no
applications_output_dirand noentity_dirconfigured); defaults to a fresh temp directory in that case. Superseded by the entity-folder resolution below.skip_drive – If True, skip all Google Drive/Docs operations.
highlight_set – Highlights. Loaded from static content if None.
reference – Reference docs. Loaded from static reference if None.
use_cache – Whether the model calls consult/populate the response cache.
template_id – Fallback resume-template Google Doc id when no templates.toml.
template_name – Explicit template name; if None the archetype is auto-detected.
parent_id – Applications-root folder id (Drive mode).
reuse_folder_id – Existing Drive folder id to update in place (re-process mode).
allow_overwrite – Proceed past a name collision with an existing execution (Drive folder and/or local entity folder) instead of raising
OverwriteConflict. Overwrite-in-place stays the default flow.archive_on_conflict – When
allow_overwriteis set and a prior execution is found at the resolved entity folder (Drive and/or local), move its current root artifacts intoarchive/<timestamp>/first instead of overwriting them in place. Ignored when there is no prior execution.industry – Optional domain/industry context for the active profile, passed to the resume-objective prompt so the company is described accurately.
applications_output_dir – Root of the local Drive-mirror of application folders. A build materializes
<root>/<Company - Role>under it and places all of this execution’s artifacts there (identity files and local artifacts alike) — the single entity folder design D7/D2 describe. Superseded byentity_dirwhen given.entity_dir – Explicit persistent entity folder, overriding the resolution from
applications_output_dir. Used by a re-run of a possibly-renamed application to target the existing folder so its entity_id is reused and no overwrite guard applies (this is the local-path equivalent ofreuse_folder_id).logger – Optional logger for injection.
_credentials_loader – Injection point for Google credentials (testing).
_drive_builder – Injection point for the Drive service builder (testing).
_docs_builder – Injection point for the Docs service builder (testing).
- Returns:
A dict of produced paths/ids, job info, and token usage.
- Raises:
OverwriteConflict – A fresh (non-reuse) build resolves to an entity folder (Drive and/or the local mirror) that already holds a prior execution, and neither
allow_overwriteis set.