Skip to content

Commit

Permalink
Refactor generators and improve configuration handling (#25)
Browse files Browse the repository at this point in the history
* Refactor and enhance project structure and documentation.

    - Removed unused `.env.example` files from `docs/`.
    - Introduced `CODE_OF_CONDUCT.md` and `CONTRIBUTING.md` for better community engagement.
    - Consolidated example configurations into the `examples/` directory for clarity.
    - Updated `.gitignore` to account for changes in example paths.
    - Improved `dotenv` and `markdown` generators with clearer documentation and functionality.
    - Enhanced README with detailed usage instructions and streamlined structure.
    - Adjusted `pyproject.toml` to reflect updated example paths and settings.
    - Refined CLI help descriptions for a better user experience.
    - Added default generator initialization in `Exporter`.
    - Updated Markdown documentation to better highlight features and formatting.

* Revert .gitignore to reflect the general Sphinx build directory.

    - Replaced `examples/_build/` with `docs/_build/` in the `.gitignore` file.

* Refactor the generators and improve error handling.

    - Introduce `DOTENV_MODE_MAP` and `DOTENV_MODE_MAP_DEFAULT` for mode mapping in `dotenv.py`.
    - Consolidate file processing logic into `_process_region` in `markdown.py` with improved error handling.
    - Add a warning mechanism for generator initialization failures in `exporter.py`.
    - Extract constants `INDENT_CHAR` and `HEADER_UNDERLINE_CHAR` for better configurability in `simple.py`.
    - Update documentation in `CONTRIBUTING.md`, `CODE_OF_CONDUCT.md`, and `README.md` for clarity and consistency.
  • Loading branch information
jag-k authored Feb 18, 2025
1 parent ceeeecc commit 10c3d59
Show file tree
Hide file tree
Showing 18 changed files with 665 additions and 135 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120

[{*.yml,*.yaml,*.json,*.md}]
[{*.yml,*.yaml,*.json}]
indent_size = 2
max_line_length = off

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,4 @@ mongo/

# Hatch version control from /~https://github.com/ofek/hatch-vcs
pydantic_settings_export/version.py
.aider*
127 changes: 127 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Code of Conduct for pydantic-settings-export

## Project Context

This is a personal project developed and maintained during personal time.
While we strive for quality and responsiveness, specific resolution timelines can't be guaranteed.

## Communication & Contributions

### Primary Communication Channel

GitHub Issues are **required** as the first point of contact for:

- Bug reports
- Feature requests
- Documentation improvements
- General questions

### Secondary Contact Methods

Only after creating an issue, contributors may use:

- GitHub anonymous email: `30597878+jag-k@users.noreply.github.com`
- Other contact methods listed on the maintainer's GitHub profile

## Development Priorities

1. Bug fixes
2. Features from Roadmap:
- Issues with the closest milestone
- General milestone issues
- General issues with label `bug` or `feature request`
- Features listed in README.md
3. New feature proposals

## Contribution Guidelines

### Issue Creation

All contributions must start with a GitHub issue to:
- Track the proposed changes
- Discuss implementation details
- Document decisions

### Branch Naming Convention

- Format: `<domain>/<issue-number>-<short-description>`
- Domains:
- `fix/` for bug fixes
- `feature/` for new features
- Example: `feature/6-inject-config-to-markdown`

### Pull Requests Requirements

1. Must reference an existing issue
2. Must pass GitHub Actions checks
3. Must include changelog in PR description

### CI/CD Process

The project uses GitHub Actions for:

- Code linting
- Testing
- Building
- Publishing to PyPI (triggered by tags)

Version numbering:

- GitHub tags/releases: prefixed with `v` (e.g., `v1.0.0`)
- PyPI versions: no prefix (e.g., `1.0.0`)

## Documentation Structure

- Primary documentation maintained in GitHub Wiki
- README.md contains essential information and roadmap
- Milestones track planned development
- PR descriptions serve as changelog entries

## Platform Guidelines

### GitHub Interactions

Use [GitHub Issues][gh-issues] or [GitHub Discussions][gh-discussions] for:

- Feature brainstorming
- Documentation questions
- Roadmap suggestions

### PyPI Considerations

- Package versions follow [SemVer](https://semver.org)
- Security reports should use GitHub Issues
- Package publishing is automated through GitHub Actions

## Enforcement

### GitHub-Specific Sanctions

- Repository access revocation
- Issue/PR commenting restrictions
- Forking restrictions for severe cases

### PyPI Security

Malicious package versions will be:

1. Reported to [PyPI Security](mailto:security@pypi.org)
2. Yanked within 24 hours of confirmation
3. Documented in GitHub Issues

## Adaptations

This Code of Conduct combines elements from:

- [Contributor Covenant 2.1](https://www.contributor-covenant.org)
- [GitHub Community Guidelines](https://docs.github.com/en/site-policy/github-terms/github-community-guidelines)

---

**Version**: 1.0 \
**Effective Date**: Immediately upon merging \
**Project Wiki**: [General docs][gh-wiki]

[gh-issues]: /~https://github.com/jag-k/pydantic-settings-export/issues
[gh-discussions]: /~https://github.com/jag-k/pydantic-settings-export/discussions
[gh-wiki]: /~https://github.com/jag-k/pydantic-settings-export/wiki
100 changes: 100 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Contributing to pydantic-settings-export

Thank you for your interest in contributing to pydantic-settings-export!
This document provides guidelines and instructions for contributing.

## Development Setup

1. **Clone the repository**
```bash
git clone /~https://github.com/jag-k/pydantic-settings-export.git
cd pydantic-settings-export
```

2. **Set up a development environment**
```bash
# Using pip
pip install -e ".[dev,tests]"

# Install pre-commit hooks
pre-commit install
```

## Development Process

### Code Style

We use several tools to maintain code quality:

- **Ruff** for linting and formatting
- **MyPy** for type checking
- **pre-commit** for automated checks

Configuration for these tools is in `pyproject.toml`.

### Making Changes

1. Create a new branch:
```bash
git checkout -b feature/your-feature-name
```

2. Make your changes and ensure all tests pass:
```bash
pytest
```

3. Update documentation if needed:
```bash
pydantic-settings-export --generator markdown
```

4. Commit your changes:
```bash
git add .
git commit -m "feat: your descriptive commit message"
```

We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification.

### Pull Request Process

1. Update the README.md if needed
2. Update documentation if you're adding/changing features
3. Add tests for new functionality
4. Ensure that all checks pass
5. Submit your PR with a clear description

## Testing

Run tests with pytest:
```bash
pytest
```

Add new tests in the `tests/` directory, following existing patterns.

## Documentation

- Update relevant documentation to [GitHub Wiki](/~https://github.com/jag-k/pydantic-settings-export/wiki)
- Keep docstrings up to date
- Add examples for new features

## Release Process

The release process is only made by maintainers:
- [@jag-k](/~https://github.com/jag-k)

1. Create a new git tag by running `git tag -a v1.0.0 -m "Release v1.0.0"`
2. CI will automatically publish to PyPI and create a GitHub release

## Getting Help

- Open an [issue](/~https://github.com/jag-k/pydantic-settings-export/issues)
- Start a [discussion](/~https://github.com/jag-k/pydantic-settings-export/discussions)
- Ask questions in existing issues/discussions

## Code of Conduct

Please note that this project is released with a [Code of Conduct](CODE_OF_CONDUCT.md).
By participating in this project, you agree to abide by its terms.
Loading

0 comments on commit 10c3d59

Please sign in to comment.