wads.project_setup¶
Project setup utilities: name checking, GitHub operations, and orchestration.
This module provides the building blocks for AI-assisted project creation. Each function is independently useful — they can be called from Python, CLI, or a Claude skill.
Key capabilities:
Check package name availability on PyPI and GitHub
Manage name candidate files (pools of potential names)
Create GitHub repositories via the gh CLI
Orchestrate full project creation (repo → populate → commit/push)
Functions
|
Check a package name's validity and availability on PyPI (and optionally npm, GitHub). |
|
Check multiple names for availability (kwargs: |
|
Create a GitHub repository via the |
|
Create misc/docs/ directory with template markdown files. |
Detect the current GitHub username. |
|
|
Return the GitHub repository URL for org/name. |
|
Check if a repository name is available on GitHub. |
|
Check if a package name is unclaimed on the npm registry (HTTP 404 = free). |
|
Check if a package name is unclaimed on PyPI. |
List all name candidate files in the name_candidates directory. |
|
|
Load name candidates from a file or all files in the name_candidates directory. |
|
Return the PyPI project page URL for a package name. |
|
Check if a GitHub repository exists at org/name. |
|
Set up AI agent configuration using opsward, if available. |
|
Orchestrate full project creation. |
- wads.project_setup.check_name_availability(name, *, org=None, npm=False, github=False)[source]¶
Check a package name’s validity and availability on PyPI (and optionally npm, GitHub).
PyPI is always checked. Pass
npm=Truewhen the project also publishes to npm. GitHub is checked only withgithub=True(explicit user request): GitHub calls are rate limited, and PyPI/npm are what decide a package name.- Return type:
- Returns a dict with keys:
name, valid_pep508, pypi_available, pypi_url, npm_available, npm_url, github_available, github_url
(keys of checks that were not run are None)
>>> result = check_name_availability("wads") >>> result["valid_pep508"] True
- wads.project_setup.check_names(names, *, org=None, **kwargs)[source]¶
Check multiple names for availability (kwargs:
npm,github, seecheck_name_availability). Returns a list of result dicts.
- wads.project_setup.create_github_repo(name, *, org=None, description='', public=True, clone=True, clone_dir=None)[source]¶
Create a GitHub repository via the
ghCLI.- Parameters:
name (
str) – Repository name.org (
str|None) – GitHub org or username. Detected if not provided.description (
str) – Repository description.public (
bool) – If True, create a public repo. If False, private.clone (
bool) – If True, clone the repo after creation.clone_dir (
str|None) – Directory to clone into. Defaults to current dir.
- Return type:
- Returns:
The local path to the cloned/created repository.
- Raises:
EnvironmentError – If
ghCLI is not available.CalledProcessError – If repo creation fails.
- wads.project_setup.create_misc_docs(pkg_dir, *, sections=None)[source]¶
Create misc/docs/ directory with template markdown files.
- wads.project_setup.detect_github_username()[source]¶
Detect the current GitHub username.
Tries
gh auth statusfirst, then falls back togit config user.name. Returns None if detection fails.
- wads.project_setup.github_repo_url(name, *, org=None)[source]¶
Return the GitHub repository URL for org/name.
- Return type:
- wads.project_setup.is_available_on_github(name, *, org=None)[source]¶
Check if a repository name is available on GitHub.
Requires the
ghCLI to be installed and authenticated. Returns True if no repo exists at org/name.- Return type:
- wads.project_setup.is_available_on_npm(name, *, timeout=10)[source]¶
Check if a package name is unclaimed on the npm registry (HTTP 404 = free).
Returns None when the registry could not give a definite answer.
>>> is_available_on_npm("zzz-nonexistent-pkg-12345") True
- wads.project_setup.is_available_on_pypi(name)[source]¶
Check if a package name is unclaimed on PyPI.
Returns True if the name is available (no package exists with that name).
- Return type:
>>> is_available_on_pypi("wads") False >>> is_available_on_pypi("zzz_nonexistent_pkg_12345") True
- wads.project_setup.list_name_candidate_files()[source]¶
List all name candidate files in the name_candidates directory.
Name candidate files are plain text files (one name per line). Lines starting with # are comments; blank lines are ignored.
- wads.project_setup.load_name_candidates(filepath=None)[source]¶
Load name candidates from a file or all files in the name_candidates directory.
- wads.project_setup.pypi_project_url(name)[source]¶
Return the PyPI project page URL for a package name.
- Return type:
- wads.project_setup.repo_exists(name, *, org=None)[source]¶
Check if a GitHub repository exists at org/name.
- Return type:
- wads.project_setup.setup_opsward_for_project(pkg_dir)[source]¶
Set up AI agent configuration using opsward, if available.
Returns True if opsward ran successfully, False if not available.
- Return type:
- wads.project_setup.setup_project(name, *, description='', org=None, author=None, license='mit', root_url=None, proj_rootdir=None, create_repo=True, populate=True, create_devdocs=False, setup_opsward=False, verbose=True)[source]¶
Orchestrate full project creation.
Steps (each independently skippable via keyword args):
Validate name
Create GitHub repo (if create_repo)
Populate project files (if populate)
Create misc/docs/ (if create_devdocs)
Run opsward generate (if setup_opsward and opsward is available)
Returns a summary dict with keys: path, steps_completed, warnings.
- Return type: