init
yousleep-init: start an analysis project that already passes the check.
yousleep-init my-analysis
Writes the files an analysis needs: a complete script that reads the
manifest, selects channels by index and writes the events document; a
Dockerfile and pinned requirements; the configuration the platform reads;
a Makefile with verify, run, record and check targets; and a
README. The project passes make verify as generated, so the first
change an author makes is to the method, not to the packaging.
In a terminal the command asks for each value, with a default that Enter
accepts; the defaults come from the directory name and your git
configuration where they can. --no-input, or a run without a terminal,
takes the flags and the defaults instead, so the command scripts. Every
question has a flag.
Answers
dataclass
¶
Everything the templates need, after prompting or defaults.
values(slug)
¶
Return the template substitutions.
ChannelSpec
dataclass
¶
InitError
¶
Bases: Exception
A reason the project could not be written.
Prompter
¶
Ask in a terminal; take the default otherwise.
__init__(interactive, read=input)
¶
Prompt through read when interactive; otherwise answer with defaults.
ask(question, default, choices=None, check=None)
¶
Return the answer: the default outside a terminal, else what was typed.
confirm(question, default=False)
¶
Return a yes/no answer; the default outside a terminal.
Runner
dataclass
¶
How the generated Makefile runs the tools: the way yousleep-init itself ran.
collect(args, slug, prompter)
¶
Turn flags, prompts and defaults into the answers, in a sensible order.
git_user_name()
¶
Return the author's name as git knows it, when git is installed and configured.
init_git(directory)
¶
Run git init when git exists and the directory is not already in a repository.
installed_version()
¶
Return the installed yousleep-common version to pin, or None for a local install.
A checkout or an editable install (PEP 610 direct_url.json) may be ahead
of what PyPI has, so pinning its version would give a requirements file
that does not resolve. The template then leaves the requirement open.
local_checkout()
¶
Return the checkout directory when this package is a local or editable install.
main(argv=None)
¶
Entry point of yousleep-init.
package_version()
¶
Return the installed package version, for --version.
placeholder_label(analysis_type)
¶
Return the event label the generated script writes, one from the type's family.
render(template, values)
¶
Fill {{ key }} markers; a marker with no value is a bug, not output.
runner()
¶
Return the command lines that reproduce this very invocation.
Under uv (uv run in a checkout, or uvx) the tools run through uv
again: a checkout by uv run --project, a release by uvx pinned to
the version. Otherwise the interpreter running now is the one that has the
package, so python -m with its full path.
slugify(text)
¶
Turn My Analysis v1 into my-analysis-v1, what file and image names need.
write_project(directory, answers, force)
¶
Write every file; return (name, purpose) pairs in the order written.