Skip to content

Commit a5cfe3e

Browse files
committed
feat: comprehensive package enhancements and infrastructure
1 parent 24a0bc3 commit a5cfe3e

25 files changed

+2229
-155
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
**Describe the bug** A clear and concise description of what the bug is.
10+
11+
**To Reproduce** Steps to reproduce the behavior:
12+
13+
1. Install package '...'
14+
2. Run code '...'
15+
3. See error
16+
17+
**Expected behavior** A clear and concise description of what you expected to happen.
18+
19+
**Environment:**
20+
21+
- OS: [e.g. Ubuntu 22.04, Windows 11]
22+
- Python version: [e.g. 3.10.8]
23+
- Package version: [e.g. 0.1.1]
24+
25+
**Additional context** Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: '[FEATURE] '
5+
labels: 'enhancement'
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Description
2+
3+
<!-- Describe the changes in this PR -->
4+
5+
# Type of change
6+
7+
- [ ] Bug fix (non-breaking change which fixes an issue)
8+
- [ ] New feature (non-breaking change which adds functionality)
9+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
10+
- [ ] Documentation update
11+
12+
# Checklist
13+
14+
- [ ] My code follows the style guidelines of this project
15+
- [ ] I have performed a self-review of my own code
16+
- [ ] I have commented my code, particularly in hard-to-understand areas
17+
- [ ] I have made corresponding changes to the documentation
18+
- [ ] My changes generate no new warnings
19+
- [ ] I have added tests that prove my fix is effective or that my feature works
20+
- [ ] New and existing unit tests pass locally with my changes
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Dependency Scanning
2+
3+
on:
4+
schedule:
5+
- cron: '0 9 * * 5' # Run at 9:00 UTC every Friday
6+
push:
7+
paths:
8+
- 'pyproject.toml'
9+
pull_request:
10+
paths:
11+
- 'pyproject.toml'
12+
workflow_dispatch: # Allow manual triggering
13+
14+
jobs:
15+
scan:
16+
name: Security Scan
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.12'
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install poetry safety
32+
poetry export -f requirements.txt --without-hashes -o requirements.txt
33+
34+
- name: Run safety check
35+
run: |
36+
safety check -r requirements.txt --full-report
37+
38+
- name: Check for outdated dependencies
39+
run: |
40+
pip install pip-audit
41+
pip-audit -r requirements.txt || true # Don't fail workflow on findings
42+
43+
- name: Cache results
44+
uses: actions/cache@v3
45+
with:
46+
path: |
47+
~/.cache/pip
48+
.audit-results
49+
key: ${{ runner.os }}-dependency-scan-${{ hashFiles('pyproject.toml') }}
50+
restore-keys: |
51+
${{ runner.os }}-dependency-scan-${{ hashFiles('pyproject.toml') }}

.github/workflows/import-check.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Import check
2+
3+
on:
4+
push:
5+
branches: [ "main", "develop" ]
6+
paths:
7+
- "**/*.py"
8+
- "pyproject.toml"
9+
- "scripts/check_imports_vs_pyproject.py"
10+
pull_request:
11+
paths:
12+
- "**/*.py"
13+
- "pyproject.toml"
14+
- "scripts/check_imports_vs_pyproject.py"
15+
16+
jobs:
17+
check:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.12"
24+
- name: Install deps
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install tomlkit packaging
28+
- name: Check imports vs pyproject
29+
run: |
30+
python scripts/check_imports_vs_pyproject.py --fail-on missing --format text

.github/workflows/test.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
python-version: ["3.10", "3.11", "3.12"]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install Poetry
27+
run: |
28+
curl -sSL https://install.python-poetry.org | python3 -
29+
echo "$HOME/.local/bin" >> $GITHUB_PATH
30+
31+
- name: Install dependencies
32+
run: |
33+
poetry install
34+
35+
- name: Run tests with coverage
36+
run: |
37+
poetry run pytest --cov=my_python_package --cov-report=xml
38+
39+
- name: Upload coverage to Codecov
40+
uses: codecov/codecov-action@v4
41+
with:
42+
file: ./coverage.xml
43+
fail_ci_if_error: false
44+
token: ${{ secrets.CODECOV_TOKEN }}
45+
verbose: true

.pre-commit-config.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-toml
9+
- id: check-added-large-files
10+
11+
- repo: https://github.com/astral-sh/ruff-pre-commit
12+
rev: v0.3.0
13+
hooks:
14+
- id: ruff
15+
args: [--fix]
16+
- id: ruff-format
17+
18+
- repo: https://github.com/pre-commit/mirrors-mypy
19+
rev: v1.9.0
20+
hooks:
21+
- id: mypy
22+
additional_dependencies: [types-all]

CHANGELOG.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [Unreleased]
8+
9+
### Added
10+
11+
- Command-line interface with multiple commands
12+
- Enhanced greeting functions with various options
13+
- Documentation generation script
14+
- Docker and docker-compose setup
15+
- Makefile for common development tasks
16+
- GitHub workflows for testing and CI
17+
- Pre-commit hooks configuration
18+
19+
### Changed
20+
21+
- Improved project structure and documentation
22+
- Updated dependency management to use Poetry groups
23+
24+
## [0.1.1] - 2025-08-14
25+
26+
### Added
27+
28+
- Initial package structure
29+
- Basic hello function
30+
- Testing setup with pytest
31+
- Automated dependency management scripts
32+
33+
### Changed
34+
35+
- Updated pyproject.toml to use modern Poetry configuration
36+
37+
## [0.1.0] - 2025-08-01
38+
39+
### Added
40+
41+
- Initial release
42+
- Basic project structure
43+
- MIT License
44+
45+
[0.1.0]: https://github.com/DiogoRibeiro7/my_python_package/releases/tag/v0.1.0
46+
[0.1.1]: https://github.com/DiogoRibeiro7/my_python_package/compare/v0.1.0...v0.1.1
47+
[unreleased]: https://github.com/DiogoRibeiro7/my_python_package/compare/v0.1.1...HEAD

CONTRIBUTING.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Contributing to my_python_package
2+
3+
Thank you for considering contributing to my_python_package! This document provides guidelines and instructions for contributing.
4+
5+
## Code of Conduct
6+
7+
Please be respectful and considerate of others when contributing to this project. We aim to foster an inclusive and welcoming community.
8+
9+
## How to Contribute
10+
11+
### Reporting Bugs
12+
13+
If you find a bug, please create an issue using the bug report template. Include:
14+
15+
1. A clear title and description
16+
2. Steps to reproduce the behavior
17+
3. Expected behavior
18+
4. Actual behavior
19+
5. Environment details (OS, Python version, package version)
20+
21+
### Suggesting Enhancements
22+
23+
For feature requests, please use the feature request template. Include:
24+
25+
1. A clear title and description
26+
2. Why this feature would be useful
27+
3. Any potential implementation details
28+
29+
### Pull Requests
30+
31+
1. Fork the repository
32+
2. Create a new branch (`git checkout -b feature/amazing-feature`)
33+
3. Make your changes
34+
4. Run tests (`make test`)
35+
5. Commit your changes (`git commit -m 'Add amazing feature'`)
36+
6. Push to the branch (`git push origin feature/amazing-feature`)
37+
7. Open a Pull Request
38+
39+
## Development Setup
40+
41+
### Local Environment
42+
43+
1. Clone the repository:
44+
```bash
45+
git clone https://github.com/DiogoRibeiro7/my_python_package.git
46+
cd my_python_package
47+
```
48+
49+
2. Install dependencies with Poetry:
50+
```bash
51+
poetry install
52+
```
53+
54+
3. Set up pre-commit hooks:
55+
```bash
56+
pre-commit install
57+
```
58+
59+
### Using Docker
60+
61+
Alternatively, you can use Docker:
62+
63+
```bash
64+
docker-compose up app # Run the application
65+
docker-compose up test # Run tests
66+
docker-compose up lint # Run linting
67+
docker-compose up type-check # Run type checking
68+
```
69+
70+
## Development Workflow
71+
72+
1. Make sure your code passes all checks:
73+
```bash
74+
make lint
75+
make type-check
76+
make test
77+
```
78+
79+
2. Update documentation if needed:
80+
```bash
81+
python scripts/generate_docs.py
82+
```
83+
84+
3. Update the CHANGELOG.md with your changes under the [Unreleased] section
85+
86+
## Coding Standards
87+
88+
- Follow PEP 8 style guidelines
89+
- Include docstrings for all functions, classes, and modules
90+
- Add type hints to all function parameters and return values
91+
- Write tests for all new functionality
92+
- Ensure test coverage is maintained or improved
93+
94+
## Commit Messages
95+
96+
Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification:
97+
98+
- `feat:` - A new feature
99+
- `fix:` - A bug fix
100+
- `docs:` - Documentation changes
101+
- `style:` - Changes that do not affect code logic
102+
- `refactor:` - Code changes that neither fix a bug nor add a feature
103+
- `perf:` - Performance improvements
104+
- `test:` - Adding or correcting tests
105+
- `build:` - Changes to build system or dependencies
106+
- `ci:` - Changes to CI configuration
107+
- `chore:` - Other changes that don't modify source or test files
108+
109+
## Release Process
110+
111+
1. Update version number in pyproject.toml
112+
2. Update CHANGELOG.md with release date
113+
3. Create a tag with the version number
114+
4. Push the tag to GitHub
115+
5. Build and publish to PyPI:
116+
```bash
117+
make publish
118+
```
119+
120+
## Questions?
121+
122+
If you have any questions, feel free to open an issue or contact the maintainers.
123+
124+
Thank you for contributing!

0 commit comments

Comments
 (0)