You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The refreshed Python module boilerplate (#354) adds a {module_name}.config module that contains pathlib.Path instances to various project directories. These paths depend on the project module being installed as editable in order to resolve correctly.
Someone following the golden path while using a CCDS-generated project should end up with an editable installation. However, it's possible for someone to not do so. Some possible mitigations:
Detect if not an editable install, warn users
Set paths a different way intelligently if not an editable install
Some prototype code for achieving this that was ultimately removed from #354
# Check if the package is installed as editabledef_is_editable():
# https://peps.python.org/pep-0660/#frontend-requirementstry:
dist=importlib.metadata.distribution("{{ cookiecutter.module_name }}")
direct_url_data=dist.read_text("direct_url.json")
ifdirect_url_dataisNone:
returnFalsereturnjson.loads(direct_url_data).get("dir_info", {}).get("editable", False)
exceptimportlib.metadata.PackageNotFoundError:
returnFalseIS_EDITABLE=_is_editable()
# Determine PROJ_ROOT pathifos.getenv("PROJ_ROOT"):
logger.debug("Reading PROJ_ROOT from environment variable.")
PROJ_ROOT=Path(os.getenv("PROJ_ROOT"))
elifIS_EDITABLE:
logger.debug("Setting PROJ_ROOT relative to editable package.")
PROJ_ROOT=Path(__file__).resolve().parents[1]
else:
logger.debug("Using current working directory as PROJ_ROOT.")
PROJ_ROOT=Path.cwd()
The refreshed Python module boilerplate (#354) adds a
{module_name}.config
module that containspathlib.Path
instances to various project directories. These paths depend on the project module being installed as editable in order to resolve correctly.Someone following the golden path while using a CCDS-generated project should end up with an editable installation. However, it's possible for someone to not do so. Some possible mitigations:
Some prototype code for achieving this that was ultimately removed from #354
Some more discussion here: #354 (comment)
The text was updated successfully, but these errors were encountered: