Skip to content

Commit d67ac60

Browse files
committed
Initial Configuration Override
1 parent 9fa9a9c commit d67ac60

File tree

7 files changed

+51
-13
lines changed

7 files changed

+51
-13
lines changed

cppython/core/schema.py

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ def dynamic_data(cls, model: 'PEP621Configuration') -> 'PEP621Configuration':
104104
return model
105105

106106

107-
def _default_install_location() -> Path:
108-
return Path.home() / '.cppython'
109-
110-
111107
class CPPythonData(CPPythonModel, extra='forbid'):
112108
"""Resolved CPPython data with local and global configuration"""
113109

@@ -268,20 +264,40 @@ class CPPythonGlobalConfiguration(CPPythonModel, extra='forbid'):
268264
class CPPythonLocalConfiguration(CPPythonModel, extra='forbid'):
269265
"""Data required by the tool"""
270266

267+
configuration_path: Annotated[
268+
Path | None,
269+
Field(
270+
description='The path to the configuration override file. If present, configuration found in the given'
271+
' directory will be preferred'
272+
),
273+
] = None
274+
271275
install_path: Annotated[
272276
Path,
273277
Field(
274278
alias='install-path',
275-
description='The global install path for the project',
279+
description='The global install path for the project. Provider and generator plugins will be'
280+
' installed here.',
276281
),
277-
] = _default_install_location()
278-
tool_path: Annotated[Path, Field(alias='tool-path', description='The local tooling path for the project')] = Path(
279-
'tool'
280-
)
282+
] = Path.home() / '.cppython'
281283

282-
build_path: Annotated[Path, Field(alias='build-path', description='The local build path for the project')] = Path(
283-
'build'
284-
)
284+
tool_path: Annotated[
285+
Path,
286+
Field(
287+
alias='tool-path',
288+
description='The local tooling path for the project. If the provider or generator need additional file'
289+
' support, this directory will be used',
290+
),
291+
] = Path('tool')
292+
293+
build_path: Annotated[
294+
Path,
295+
Field(
296+
alias='build-path',
297+
description='The local build path for the project. This is where the artifacts of the local C++ build'
298+
' process will be generated.',
299+
),
300+
] = Path('build')
285301

286302
provider: Annotated[ProviderData, Field(description="Provider plugin data associated with 'provider_name")] = (
287303
ProviderData({})

docs/antora.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ version: 0.1.0
33
title: CPPython
44
nav:
55
- modules/ROOT/nav.adoc
6+
- modules/tests/nav.adoc

docs/modules/ROOT/nav.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
.CPPython
2+
* xref:index.adoc[]
13
* xref:configuration.adoc[]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
= Configuration
2+
3+
== Local Configuration
4+
5+
Defined within the `pyproject.toml` file, the local configuration is used to customize the behavior of `cppython` for a specific project. The configuration is defined under the `[tool.cppython]` table.
6+
7+
== Global Configuration
8+
9+
Configuration exists in four places, each with a different default scope. The order of precedence is as follows:
10+
11+
1. Configuration file override provided by the CLI or local `pyproject.toml` file.
12+
2. The local configuration file, `cppython.toml`, in the current working directory.
13+
3. The user level configuration file, `cppython.toml`, in the user's home directory.
14+
4. The global configuration file, `cppython.toml`, in the system configuration directory.
15+
16+
Each configuration file that is found will be merged into the next configuration file found.

docs/modules/ROOT/pages/index.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
= CPPython Website
1+
= Documentation for CPPython

docs/modules/tests/nav.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
.CPPython
2+
* xref:index.adoc[]
13
* xref:fixtures.adoc[]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
= Test Documentation

0 commit comments

Comments
 (0)