define_01_paths

Enumeration of important paths on local file system.

class pywf_internal_proprietary.define_01_paths.PyWfPaths[source]

Namespace class for accessing important paths.

run_command(args: list[str], real_run: bool, cwd: Path | None = None, check: bool = True)[source]

Run a command in a subprocess, also print the command for debug, and optionally change the current working directory.

Parameters:
  • args – The command and its arguments to run.

  • real_run – If True, actually run the command; if False, just print it.

  • cwd – The directory to change to before running the command.

  • check – If True, raise an exception if the command fails.

property dir_home: Path

The user home directory.

Example: ${HOME}

property dir_venv: Path

The virtualenv directory.

Example: ${dir_project_root}/.venv

property dir_venv_bin: Path

The bin folder in virtualenv.

Example: ${dir_project_root}/.venv/bin

get_path_venv_bin_cli(cmd: str) Path[source]

Get the path of a command in virtualenv bin folder.

Example: ${dir_project_root}/.venv/bin/${cmd}

property path_venv_bin_python: Path

The python executable in virtualenv.

Example: ${dir_project_root}/.venv/bin/python

property path_venv_bin_pip: Path

The pip command in virtualenv.

Example: ${dir_project_root}/.venv/bin/pip

property path_venv_bin_pytest: Path

The pytest command in virtualenv.

Example: ${dir_project_root}/.venv/bin/pytest

property path_venv_bin_sphinx_build: Path

The sphinx-build executable in virtualenv.

Example: ${dir_project_root}/.venv/bin/sphinx-build

property path_venv_bin_bin_jupyter: Path

The jupyter executable in virtualenv.

Example: ${dir_project_root}/.venv/bin/jupyter

property path_sys_executable: Path

The current Python interpreter path.

get_path_dynamic_bin_cli(cmd: str) Path[source]

Search multiple locations to get the absolute path of the CLI command. It searches the following locations in order:

  1. the bin folder in virtualenv.

  2. the global Python’s bin folder.

  3. Then use the raw command name (string) as the path.

Example: ${dir_project_root}/.venv/bin/${cmd} or ${global_python_bin}/${cmd}

property path_bin_virtualenv: Path

The virtualenv CLI command path.

Example: ${dir_project_root}/.venv/bin/virtualenv

property path_bin_poetry: Path

The poetry CLI command path.

Example: ${dir_project_root}/.venv/bin/poetry

property path_bin_uv: Path

The poetry CLI command path.

Example: ${dir_project_root}/.venv/bin/uv

property path_bin_twine: Path

The twine CLI command path.

Example: ${dir_project_root}/.venv/bin/twine

property dir_python_lib: Path

The current Python library directory.

Example: ${dir_project_root}/${package_name}

property path_version_py: Path

Path to the _version.py file where the package version is defined.

Example: ${dir_project_root}/${package_name}/_version.py

property dir_tests: Path

Unit test folder.

Example: ${dir_project_root}/tests

property dir_tests_int: Path

Integration test folder.

Example: ${dir_project_root}/tests_int

property dir_tests_load: Path

Load test folder.

Example: ${dir_project_root}/tests_load

property dir_htmlcov: Path

The code coverage test results HTML output folder.

Example: ${dir_project_root}/htmlcov

property path_htmlcov_index_html: Path

The code coverage test results HTML file.

Example: ${dir_project_root}/htmlcov/index.html

property dir_sphinx_doc: Path

Sphinx docs folder.

Example: ${dir_project_root}/docs

property dir_sphinx_doc_source: Path

Sphinx docs source code folder.

Example: ${dir_project_root}/docs/source

property dir_sphinx_doc_source_conf_py: Path

Sphinx docs conf.py file path.

Example: ${dir_project_root}/docs/source/conf.py

property dir_sphinx_doc_source_python_lib: Path

The generated Python library API reference Sphinx docs folder.

Example: ${dir_project_root}/docs/source/${package_name}

property dir_sphinx_doc_build: Path

The temp Sphinx doc build folder.

Example: ``${dir_project_root}/docs/build

property dir_sphinx_doc_build_html: Path

The built Sphinx doc build HTML folder.

Example: ``${dir_project_root}/docs/build/html

property path_sphinx_doc_build_index_html: Path

The built Sphinx doc site entry HTML file path.

Example: ``${dir_project_root}/docs/build/html/index.html or README.html

property path_requirements: Path

The requirements.txt file path.

Example: ${dir_project_root}/requirements.txt

property path_requirements_dev: Path

The requirements-dev.txt file path.

Example: ${dir_project_root}/requirements-dev.txt

property path_requirements_test: Path

The requirements-test.txt file path.

Example: ${dir_project_root}/requirements-test.txt

property path_requirements_doc: Path

The requirements-doc.txt file path.

Example: ${dir_project_root}/requirements-doc.txt

property path_requirements_automation: Path

The requirements-automation.txt file path.

Example: ${dir_project_root}/requirements-automation.txt

property path_poetry_lock: Path

The poetry.lock file path.

Example: ${dir_project_root}/poetry.lock

property path_poetry_lock_hash_json: Path

The poetry-lock-hash.json file path. It is the cache of the poetry.lock file hash.

Example: ${dir_project_root}/poetry-lock-hash.json

property path_pyproject_toml: Path

The pyproject.toml file path.

Example: ${dir_project_root}/pyproject.toml

property dir_build: Path

The build folder for Python or artifacts build.

Example: ${dir_project_root}/build

property dir_dist: Path

The dist folder for Python package distribution (.whl file).

Example: ${dir_project_root}/dist

property path_bin_aws: Path

The AWS CLI executable path.

Example: ${dir_project_root}/.venv/bin/aws

property dir_node_modules: Path
property path_bin_wrangler: Path

The Cloudflare wrangler CLI command path.

Suggestion:

mkdir ${HOME}/.npm-tools
cd ${HOME}/.npm-tools
npm install wrangler --save-dev