Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
e321184
Update SonarCloud configuration and coverage report paths.
discreteds Aug 25, 2024
0f82a3b
Docstring updates (#17)
discreteds Sep 5, 2024
5219aa8
Add post-init reinit, and improved settings parameter init (#18)
discreteds Sep 21, 2024
b8aea8d
Merge remote-tracking branch 'origin/develop' into develop
discreteds Sep 21, 2024
88153a3
fix: update settings_functions to handle default value for settings_c…
discreteds Oct 2, 2024
34e2aab
chore: update .gitignore file
discreteds Oct 2, 2024
6ee5920
feat: Add function to clone and checkout repositories
discreteds Oct 5, 2024
1a1606e
```
discreteds Feb 11, 2025
ee84de7
MAJOR Refactoring of Settings (#20)
discreteds Feb 11, 2025
dc3fe25
```
discreteds Feb 11, 2025
48ce143
``` (#21)
discreteds Feb 12, 2025
08f843e
feat: implement GPG authentication settings (#22)
discreteds Feb 13, 2025
aa34a19
```
discreteds Feb 16, 2025
dc4c1af
```
discreteds Feb 28, 2025
aa292d1
```
discreteds Mar 11, 2025
b4d4e2b
```
discreteds Mar 11, 2025
57e1a77
```
discreteds Mar 27, 2025
afd98ff
Adds initial project documentation and configuration
discreteds Apr 22, 2025
fb4f502
Updates version and adds CalVer badge
discreteds Apr 22, 2025
6b25a59
Fixed bug in tests
discreteds Apr 23, 2025
de73ae4
update to dummy s3 config
discreteds Apr 23, 2025
c404d6e
Ruff Linting fixes
discreteds Apr 23, 2025
2887d62
remove conda yaml
discreteds Apr 24, 2025
26c3ba0
update actions for release
discreteds Apr 25, 2025
1254d1a
Merge branch 'main' into develop
discreteds Apr 30, 2025
f1a1d36
release/25.5.0
discreteds May 1, 2025
7b32819
Merge branch 'main' into develop
discreteds May 15, 2025
2ce6b2b
Updates SBOM generation and adds wheel publishing
discreteds May 15, 2025
ef8e700
🧪 Comprehensive test refactoring and code improvements (#27)
discreteds Aug 22, 2025
70cbd5e
📝 Add comprehensive decorator refactoring documentation
discreteds Aug 28, 2025
6a608b6
✨ Implement @mountainash_settings decorator for Pydantic BaseSettings
discreteds Aug 29, 2025
9401b4a
✅ Add comprehensive test suite for @mountainash_settings decorator
discreteds Aug 29, 2025
17ed9fb
📝 Add decorator project documentation and working example
discreteds Aug 29, 2025
eb41b5e
📚 Expand JIT security pattern and ecosystem analysis documentation
discreteds Aug 29, 2025
2bf45e1
🧪 Fix and clean up decorator test failures
discreteds Sep 2, 2025
f01cd10
✅ Add comprehensive decorator vs subclass parity tests with file-base…
discreteds Sep 2, 2025
628861c
📚 Add comprehensive decorator usage examples and patterns
discreteds Sep 2, 2025
24be6c0
✨ Complete Phase 2 decorator implementation with all advanced features
discreteds Sep 2, 2025
96d4771
🐛 Fix runtime override behavior in get_settings function
discreteds Sep 2, 2025
9b7ccb0
📝 Complete comprehensive decorator refactoring documentation
discreteds Sep 2, 2025
bfff06d
📝 Remove decorator pattern from documentation
discreteds Sep 3, 2025
384a0cf
🔥 Remove decorator import from package exports
discreteds Sep 3, 2025
d37c1d1
🗑️ Remove deprecated decorator implementation and tests
discreteds Sep 3, 2025
4f7a139
♻️ Clean up decorator-related code references
discreteds Sep 3, 2025
ed6aa69
♻️ Update examples to use MountainAshBaseSettings pattern
discreteds Sep 3, 2025
33a662f
updates
discreteds Sep 28, 2025
5ba347f
🐛 Fix circular import issues using TYPE_CHECKING and lazy imports
discreteds Oct 3, 2025
352fe0f
🐛 Fix cache key and config file sorting bugs
discreteds Oct 3, 2025
89ca9d6
♻️ Refactor test infrastructure with centralized fixtures
discreteds Oct 3, 2025
8ded4b6
✅ Add comprehensive test coverage for core modules
discreteds Oct 3, 2025
1a37bc0
🗑️ Remove deprecated and obsolete test files
discreteds Oct 3, 2025
850c562
🔖 Bump version to 25.8.0
discreteds Oct 8, 2025
9a9014a
✨ Add support for dotfiles in FileTypeRegistry
discreteds Oct 8, 2025
ea53027
✅ Add comprehensive test coverage for dotfile support
discreteds Oct 8, 2025
88aef73
Merge branch 'main' into release/25.8.0
discreteds Oct 8, 2025
880d93b
🧹 Apply QC fixes from testing
discreteds Oct 8, 2025
1bacfac
🐛 Fix SBOM generation by upgrading hatch to 1.14.2
discreteds Oct 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions .github/config/mountainash_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

# Private Package Dependencies
dependencies:
- name: mountainash-constants
org-name: mountainash-io
# - name: mountainash-data
# org-name: mountainash-io
# - name: mountainash-settings
# org-name: mountainash-io
# - name: mountainash-utils-dataclasses
# org-name: mountainash-io
# - name: mountainash-utils-factoryclasses
# org-name: mountainash-io
# - name: mountainash-utils-files
# org-name: mountainash-io
# - name: mountainash-utils-hamilton
# org-name: mountainash-io
- name: mountainash-utils-os
org-name: mountainash-io
# - name: mountainash-utils-rules
# org-name: mountainash-io
# - name: mountainash-utils-ssh
# org-name: mountainash-io
- name: mountainash-constants
org-name: mountainash-io
# - name: mountainash-data
# org-name: mountainash-io
# - name: mountainash-settings
# org-name: mountainash-io
# - name: mountainash-utils-dataclasses
# org-name: mountainash-io
# - name: mountainash-utils-factoryclasses
# org-name: mountainash-io
# - name: mountainash-utils-files
# org-name: mountainash-io
# - name: mountainash-utils-hamilton
# org-name: mountainash-io
- name: mountainash-utils-os
org-name: mountainash-io
# - name: mountainash-utils-rules
# org-name: mountainash-io
# - name: mountainash-utils-ssh
# org-name: mountainash-io
2 changes: 1 addition & 1 deletion .github/workflows/build-and-release-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
- name: Python Dependencies
run: |
pip install hatchling==1.25.0
pip install hatch==1.12.0
pip install hatch==1.14.2

# Checkout Mountain Ash Dependencies
- name: Load Dependencies
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,11 @@ htmlcov/

#Sonarlint settings
.vscode/
.sonarlint/
.sonarlint/

#Rye
**.**lock

#testing artifacts
junit.*
coverage.*
8 changes: 8 additions & 0 deletions .mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"mcpServers": {
"Ref": {
"type": "http",
"url": "https://api.ref.tools/mcp?apiKey=ref-1e5337e10347816cc4fc"
}
}
}
188 changes: 187 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,138 @@

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

mountainash-settings is a Python package for advanced configuration management with support for multiple file formats, authentication providers, and secret management. It provides a unified interface for loading settings from environment variables, configuration files (YAML, TOML, JSON), and various secret management systems.

## Architecture

### Core Components

- **MountainAshBaseSettings**: Extended BaseSettings class with template support, multiple file format handling, and settings caching
- **SettingsParameters**: Dataclass for configuration parameters, validation, and smart caching with runtime override support
- **SettingsManager**: Caching layer for settings instances with namespace support and hash-based instance management
- **Authentication System**: Modular authentication for databases, storage, and secrets
- **Settings Cache**: Efficient caching with LRU cache integration and structural parameter differentiation

### Package Structure

```
src/mountainash_settings/
├── __init__.py # Main package exports
├── __version__.py # Version information
├── settings/
│ ├── base/
│ │ └── base_settings.py # MountainAshBaseSettings core class
│ ├── app/
│ │ ├── app_settings.py # Application-specific settings
│ │ └── app_settings_templates.py # Template configurations
│ └── auth/ # Authentication modules
│ ├── database/ # Database authentication
│ ├── encryption/ # GPG encryption support
│ ├── secrets/ # Secret management providers
│ └── storage/ # Storage authentication
├── settings_cache/ # Settings caching system with get_settings function
├── settings_parameters/ # Parameter handling, validation, and smart merging
```

## MountainAshBaseSettings Architecture

### Primary Interface

MountainAshBaseSettings is the primary interface for using mountainash-settings. It extends standard Pydantic BaseSettings with advanced configuration management features.

#### Basic Usage Pattern
```python
from pydantic import Field
from mountainash_settings import MountainAshBaseSettings

class AppSettings(MountainAshBaseSettings):
debug: bool = Field(default=False)
app_name: str = Field(default="MyApp")
log_file: str = Field(default="logs/{app_name}.log") # Template support
```

#### Core Features
- **Template Support**: Dynamic field substitution using other field values
- **Multi-Format Configuration**: Support for YAML, TOML, JSON configuration files
- **Smart Caching**: Efficient instance caching with hash-based invalidation
- **Authentication Integration**: Built-in support for database, storage, and secret management authentication
- **Runtime Override Support**: Apply runtime parameters without affecting cache

#### Advanced Configuration
```python
from mountainash_settings import SettingsParameters, get_settings

# Create parameters for complex configurations
params = SettingsParameters.create(
namespace="production",
config_files=["config.yaml"],
settings_class=AppSettings,
host="prod-server.com"
)

# Use with get_settings function for dynamic resolution
settings = get_settings(settings_parameters=params)
```

### Key Architectural Benefits

1. **SettingsParameters Integration**: Comprehensive parameter handling and validation
2. **Smart Caching**: Hash-based caching with structural vs runtime parameter separation
3. **Template Resolution**: Dynamic template processing with field substitution
4. **Authentication System**: Modular authentication for various providers
5. **Multi-Source Configuration**: Environment variables, configuration files, and secret management
6. **Namespace Support**: Isolation and organization of different configuration contexts

## Build/Test/Lint Commands
- Build: `hatch build`
- Lint: `hatch run ruff:check` or `hatch run ruff:fix` to auto-fix
- Tests: `hatch run test:test` or `hatch run test:cov` for coverage
- Single test: `pytest tests/path/to/test_file.py::TestClass::test_function -v`
- Type check: `hatch run mypy:check`

## Dependencies

### Core Dependencies
- pydantic==2.9.2 - Data validation and settings management
- pydantic-settings==2.6.1 - Settings management with multiple sources
- universal_pathlib==0.2.2 - Universal filesystem path handling
- pyaml - YAML configuration file support

### Authentication Dependencies
- Various cloud provider SDKs (AWS, Azure, GCP) for secret management
- Database drivers for authentication configuration
- Storage provider libraries for file system authentication

### Development Dependencies
- pytest==8.3.5
- pytest-check, pytest-cov, pytest-mock
- ruff==0.3.7
- mypy==1.10.1
- radon==6.0.1

## GitHub Actions Workflows

### Testing
- **python-run-pytest**: Runs comprehensive test suite on pull requests, supports Python 3.12
- **python-run-ruff**: Code linting and formatting checks
- **python-run-radon**: Complexity analysis and code quality metrics

### Release Process
- **build-and-release-package**: Automated release workflow
- **main-release-build-dependencies**: Dependency validation for main branch
- **main-release-branch-validation**: Branch protection and validation
- Supports production, RC, and beta releases
- Generates SBOMs (Software Bill of Materials)
- Creates releases in GitHub and mountainash-wheels repository

### Branch Strategy
- `main`: Production releases (only release/* and hotfix/* branches)
- `develop`: Development and RC releases
- `feature/*`, `bugfix/*`, `hotfix/*`: Feature branches
- Protected branches require code owner approval

## Code Style Guidelines
- Formatting: Uses ruff for formatting and linting
- Imports: Standard lib first, third-party next, project imports last
Expand All @@ -17,4 +142,65 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
- Error handling: Use ValueError for validation errors, custom exceptions for specific cases
- Documentation: Use Google-style docstrings for classes and methods
- Organization: Follow modular design with clear separation of concerns
- Testing: Create unit tests with appropriate markers (unit, integration, performance)
- Testing: Create unit tests with appropriate markers (unit, integration, performance)

## Development Environments

### Hatch Environments
- `default`: Local development
- `test`: Local testing with extended pytest plugins
- `test_github`: GitHub Actions testing
- `build_github`: GitHub Actions building
- `ruff`: Linting and formatting
- `radon`: Complexity analysis
- `mypy`: Type checking

## Testing Structure

### Test Organization
```
tests/
├── config/ # Test configuration files
│ ├── simple_base.yaml # Base configuration for file-based tests
│ └── simple_production.yaml # Production configuration for file-based tests
├── test_base_settings.py # Core MountainAshBaseSettings functionality
├── test_config_files.py # Configuration file handling
├── test_settings_manager.py # Settings caching and management
└── test_settings_utils.py # Utility functions
```

### Configuration Files
- Environment files for testing different configurations
- Supports prefix-based environment variable testing
- Integration tests for various auth providers

## Documentation

### Available Documentation
- `README.md` - Package overview and usage
- `CONTRIBUTING.md` - Contribution guidelines
- `TESTING.md` - Testing guidelines and procedures

### Configuration Examples
- `config/` directory contains example configurations for:
- Database authentication (BigQuery, Redshift, Snowflake, PostgreSQL, MySQL, etc.)
- Storage authentication (S3, Azure Blob, GCS, MinIO, etc.)
- Network storage (FTP, SFTP, NFS, SMB)

### Code Examples
- `examples/` directory contains comprehensive usage examples:
- Basic MountainAshBaseSettings usage with all features
- SettingsParameters merging patterns
- Runtime type resolution patterns
- Enterprise configuration scenarios

## Versioning Strategy

Uses CalVer (Calendar Versioning) with semantic versioning:
- Format: `YYYY.MM.MICRO`
- Release candidate: `YYYY.MM.0`
- Production: `YYYY.MM.1`
- Patches: `YYYY.MM.X`

## License
MIT License
104 changes: 8 additions & 96 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,100 +1,12 @@
Business Source License 1.1
Proprietary Software License

Parameters
Copyright (c) 2025 Mountain Ash Solutions Pty. Ltd. All rights reserved.

Licensor: Mountain Ash Credit Data Pty. Ltd.
Licensed Work: mountainash-settings
The Licensed Work is (c) Mountain Ash Credit Data Pty. Ltd
Additional Use Grant: You may make use of the Licensed Work, provided that
you may not use the Licensed Work for a SAAS Service.
All rights reserved. This software is proprietary and confidential.
Unauthorized copying, distribution, or use is prohibited.

SAAS means you provided hosting product as a service to
any customers.
Authorized use of this software is governed by the terms and conditions set forth in
the Master Service Agreement and Software as a Service Agreement
between Mountain Ash Solutions Pty. Ltd. and the authorized user.

Change Date: After release version + 4 years later

Change License: Apache License, Version 2.0

For more detail about SAAS, you may visit:

https://en.wikipedia.org/wiki/Software_as_a_service

Notice

The Business Source License (this document, or the “License”) is not an Open
Source license. However, the Licensed Work will eventually be made available
under an Open Source License, as stated in this License.

License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
“Business Source License” is a trademark of MariaDB Corporation Ab.

-----------------------------------------------------------------------------

Business Source License 1.1

Terms

The Licensor hereby grants you the right to copy, modify, create derivative
works, redistribute, and make non-production use of the Licensed Work. The
Licensor may make an Additional Use Grant, above, permitting limited
production use.

Effective on the Change Date, or the fourth anniversary of the first publicly
available distribution of a specific version of the Licensed Work under this
License, whichever comes first, the Licensor hereby grants you rights under
the terms of the Change License, and the rights granted in the paragraph
above terminate.

If your use of the Licensed Work does not comply with the requirements
currently in effect as described in this License, you must purchase a
commercial license from the Licensor, its affiliated entities, or authorized
resellers, or you must refrain from using the Licensed Work.

All copies of the original and modified Licensed Work, and derivative works
of the Licensed Work, are subject to this License. This License applies
separately for each version of the Licensed Work and the Change Date may vary
for each version of the Licensed Work released by Licensor.

You must conspicuously display this License on each original or modified copy
of the Licensed Work. If you receive the Licensed Work in original or
modified form from a third party, the terms and conditions set forth in this
License apply to your use of that work.

Any use of the Licensed Work in violation of this License will automatically
terminate your rights under this License for the current and all other
versions of the Licensed Work.

This License does not grant you any right in any trademark or logo of
Licensor or its affiliates (provided that you may use a trademark or logo of
Licensor as expressly required by this License).

TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
TITLE.

MariaDB hereby grants you permission to use this License’s text to license
your works, and to refer to it using the trademark “Business Source License”,
as long as you comply with the Covenants of Licensor below.

Covenants of Licensor

In consideration of the right to use this License’s text and the “Business
Source License” name and trademark, Licensor covenants to MariaDB, and to all
other recipients of the licensed work to be provided by Licensor:

1. To specify as the Change License the GPL Version 2.0 or any later version,
or a license that is compatible with GPL Version 2.0 or a later version,
where “compatible” means that software provided under the Change License can
be included in a program with software provided under GPL Version 2.0 or a
later version. Licensor may specify additional Change Licenses without
limitation.

2. To either: (a) specify an additional grant of rights to use that does not
impose any additional restriction on the right granted in this License, as
the Additional Use Grant; or (b) insert the text “None”.

3. To specify a Change Date.

4. Not to modify this License in any other way.
For licensing information, contact: info@mountainash.io
Loading
Loading