xcookie.builders.common_ci module

xcookie.builders.common_ci.get_pyproject_optional_dependency_keys(self)[source]

Return optional-dependency keys declared in pyproject.toml.

Compatibility wrapper around xcookie.builders.ci_plan.

xcookie.builders.common_ci.filter_pyproject_extras(self, desired_extras)[source]

Return desired_extras filtered down to extras declared by pyproject.

Compatibility wrapper around xcookie.builders.ci_plan.

xcookie.builders.common_ci.format_pyproject_install_target(extras, target='.', editable=False)[source]

Build a pip install target, omitting brackets when extras are empty.

Compatibility wrapper around xcookie.builders.ci_plan.

xcookie.builders.common_ci.make_ci_plan(self)[source]

Return the shared provider-neutral CI plan for this applier.

xcookie.builders.common_ci.make_typecheck_parts(self, plan: CIPlan | None = None)[source]

Return a list of shell commands to run type checkers.

By default this will run both mypy and ty (in that order). The returned value is a list of command strings so callers can adapt it to either GitHub Actions (run string) or GitLab CI (script list).

xcookie.builders.common_ci.make_build_sdist_parts(self, wheelhouse_dpath='wheelhouse')[source]
xcookie.builders.common_ci.make_build_wheel_parts(self, wheelhouse_dpath='wheelhouse')[source]
xcookie.builders.common_ci.make_install_and_test_wheel_parts(self, wheelhouse_dpath, special_install_lines, workspace_dname, custom_before_test_lines=[], custom_after_test_commands=[])[source]

Builds the YAML common between github actions and gitlab CI to install and tests python packages.

References

https://stackoverflow.com/questions/42019184/python-how-can-i-get-the-version-number-from-a-whl-file

xcookie.builders.common_ci.make_windows_msvc_bash_path_commands() → list[str][source]

Prioritize the selected MSVC linker inside Git Bash on Windows.

Git Bash prepends its own usr/bin directory, which contains an unrelated link.exe. Rust-backed Python packages then invoke that program instead of Microsoft’s linker when they must build from source.

ilammy/msvc-dev-cmd already puts the selected compiler directory on PATH. cl.exe has no Git-Bash name collision, so locate it after Bash starts and prepend its directory. This follows the toolchain chosen by the action without coupling generated workflows to its private architecture environment variables.

xcookie.builders.common_ci.get_supported_platform_info(self)[source]

CommandLine

xdoctest -m /home/joncrall/code/xcookie/xcookie/builders/common_ci.py get_supported_platform_info
xdoctest -m xcookie.builders.common_ci get_supported_platform_info

Example

>>> from xcookie.builders.github_actions import *  # NOQA
>>> from xcookie.builders.common_ci import *  # NOQA
>>> from xcookie.main import XCookieConfig
>>> from xcookie.main import TemplateApplier
>>> config = XCookieConfig(tags=['purepy'], remote_group='Org', repo_name='Repo')
>>> self = TemplateApplier(config)
>>> supported_platform_info = get_supported_platform_info(self)
>>> import ubelt as ub
>>> print(f'supported_platform_info = {ub.urepr(supported_platform_info, nl=2)}')
xcookie.builders.common_ci._py_shell_command(code: str) → str[source]

Return a shell-safe python -c command.

xcookie.builders.common_ci.make_project_version_getter(self) → str[source]

Return a shell command that prints the project version.

Historically generated deploy jobs imported setup.VERSION. That is invalid for pyproject-only repositories. When setup.py is disabled, statically parse __version__ from the package __init__ module instead of importing the project package or its runtime dependencies.

xcookie.builders.common_ci.make_project_version_assignment(self, variable: str = 'VERSION', export: bool = False) → str[source]

Return a shell assignment for the current project version.