Skip to content

Commit b325cf2

Browse files
authored
Add configuration files for code quality and documentation (#30)
* Add configuration files for code quality and documentation - Introduced `.flake8` for linting configuration with specific rules and ignored errors. - Updated `.pre-commit-config.yaml` to include additional hooks for code formatting, linting, and security checks. - Added `CONTRIBUTING.md` to outline contribution guidelines and best practices for the project. - Created a `Makefile` for streamlined development tasks, including testing, linting, and formatting commands. - Established Sphinx documentation structure with initial files for API reference, user guide, and installation instructions. - Enhanced logging capabilities in the `logging.py` module for better traceability and structured logging. - Configured Dependabot for automated dependency updates in the project. These changes improve code quality, enhance developer experience, and establish a solid foundation for project documentation. * Remove redundant CI jobs for code quality and documentation from GitHub Actions workflow. This streamlines the CI process by focusing on essential testing tasks, improving efficiency and maintainability. * Bug Fix * Release v0.1.16: Update version and enhance documentation - Bumped version to 0.1.16 in `pyproject.toml` and `__init__.py`. - Updated changelog with new version entry. - Modified documentation to reflect changes in configuration and usage examples. These updates improve version tracking and provide clearer guidance for users on the latest features and configurations. * Update CI workflow condition for integration tests - Modified the condition for running integration tests to ensure they only execute for non-draft pull requests, enhancing the accuracy of test results during the CI process. This change improves the reliability of integration testing in the CI pipeline.
1 parent 98b8c5d commit b325cf2

File tree

20 files changed

+4409
-52
lines changed

20 files changed

+4409
-52
lines changed

.cursor/coding-standards.mdc

Lines changed: 170 additions & 0 deletions
Large diffs are not rendered by default.

.flake8

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[flake8]
2+
max-line-length = 88
3+
extend-ignore = E203,W503,D100,D104
4+
per-file-ignores =
5+
tests/*:D103,S101,S106
6+
__init__.py:F401
7+
docstring-convention = google

.github/dependabot.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Dependabot configuration for automated dependency updates
2+
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
3+
4+
version: 2
5+
updates:
6+
# Python dependencies
7+
- package-ecosystem: "pip"
8+
directory: "/"
9+
schedule:
10+
interval: "weekly"
11+
day: "monday"
12+
time: "09:00"
13+
timezone: "UTC"
14+
open-pull-requests-limit: 10
15+
reviewers:
16+
- "promptix-maintainers"
17+
assignees:
18+
- "promptix-maintainers"
19+
commit-message:
20+
prefix: "deps"
21+
prefix-development: "deps-dev"
22+
include: "scope"
23+
labels:
24+
- "dependencies"
25+
- "automated"
26+
groups:
27+
# Group development dependencies together
28+
development-dependencies:
29+
patterns:
30+
- "pytest*"
31+
- "black"
32+
- "isort"
33+
- "flake8*"
34+
- "mypy"
35+
- "bandit"
36+
- "safety"
37+
- "pre-commit"
38+
- "sphinx*"
39+
update-types:
40+
- "minor"
41+
- "patch"
42+
# Group core dependencies
43+
core-dependencies:
44+
patterns:
45+
- "streamlit"
46+
- "jinja2"
47+
- "pyyaml"
48+
- "jsonschema"
49+
- "python-dotenv"
50+
ignore:
51+
# Ignore major version updates for core dependencies (manual review required)
52+
- dependency-name: "streamlit"
53+
update-types: ["version-update:semver-major"]
54+
- dependency-name: "jinja2"
55+
update-types: ["version-update:semver-major"]
56+
allow:
57+
# Allow all dependency types
58+
- dependency-type: "direct"
59+
- dependency-type: "indirect"
60+
- dependency-type: "development"
61+
62+
# GitHub Actions dependencies
63+
- package-ecosystem: "github-actions"
64+
directory: "/"
65+
schedule:
66+
interval: "weekly"
67+
day: "monday"
68+
time: "10:00"
69+
timezone: "UTC"
70+
open-pull-requests-limit: 5
71+
reviewers:
72+
- "promptix-maintainers"
73+
commit-message:
74+
prefix: "ci"
75+
include: "scope"
76+
labels:
77+
- "github-actions"
78+
- "automated"
79+
groups:
80+
github-actions:
81+
patterns:
82+
- "*"
83+
update-types:
84+
- "minor"
85+
- "patch"
86+
87+
# Docker dependencies (if we add Docker in the future)
88+
# - package-ecosystem: "docker"
89+
# directory: "/"
90+
# schedule:
91+
# interval: "weekly"
92+
# open-pull-requests-limit: 3
93+
# reviewers:
94+
# - "promptix-maintainers"
95+
# commit-message:
96+
# prefix: "docker"
97+
# labels:
98+
# - "docker"
99+
# - "automated"

.github/workflows/ci.yml

Lines changed: 105 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,43 @@ on:
44
push:
55
branches:
66
- main
7+
- develop
78
pull_request:
89
branches:
910
- main
11+
- develop
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
1016

1117
jobs:
18+
19+
# Testing Matrix
1220
test:
13-
runs-on: ubuntu-latest
21+
name: Tests (Python ${{ matrix.python-version }})
22+
runs-on: ${{ matrix.os }}
1423
strategy:
24+
fail-fast: false
1525
matrix:
16-
python-version: ["3.9", "3.10", "3.11"]
26+
python-version: ["3.9", "3.10", "3.11", "3.12"]
27+
os: [ubuntu-latest, windows-latest, macos-latest]
28+
exclude:
29+
# Reduce matrix size for faster CI
30+
- os: windows-latest
31+
python-version: "3.9"
32+
- os: macos-latest
33+
python-version: "3.9"
1734

1835
steps:
19-
- uses: actions/checkout@v3
36+
- name: Checkout code
37+
uses: actions/checkout@v4
2038

2139
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v4
40+
uses: actions/setup-python@v5
2341
with:
2442
python-version: ${{ matrix.python-version }}
43+
cache: 'pip'
2544

2645
- name: Install dependencies
2746
run: |
@@ -33,16 +52,94 @@ jobs:
3352
run: |
3453
pip install -e . || echo "Editable install failed, will use PYTHONPATH"
3554
36-
- name: Run tests
55+
- name: Run tests with coverage
3756
env:
3857
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
3958
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
4059
PYTHONPATH: ${{ github.workspace }}/src
4160
run: |
42-
pytest --cov=promptix --cov-report=xml
61+
pytest --cov=promptix --cov-report=xml --cov-report=term-missing -v
4362
4463
- name: Upload coverage to Codecov
45-
uses: codecov/codecov-action@v3
64+
if: matrix.python-version == '3.11' && matrix.os == 'ubuntu-latest'
65+
uses: codecov/codecov-action@v4
4666
with:
4767
file: ./coverage.xml
48-
fail_ci_if_error: false
68+
fail_ci_if_error: false
69+
verbose: true
70+
71+
# Performance Testing
72+
performance:
73+
name: Performance Tests
74+
runs-on: ubuntu-latest
75+
76+
steps:
77+
- name: Checkout code
78+
uses: actions/checkout@v4
79+
80+
- name: Set up Python
81+
uses: actions/setup-python@v5
82+
with:
83+
python-version: "3.11"
84+
cache: 'pip'
85+
86+
- name: Install dependencies
87+
run: |
88+
python -m pip install --upgrade pip
89+
pip install -e ".[dev]"
90+
91+
- name: Run performance tests
92+
run: |
93+
pytest tests/test_performance.py -v --tb=short
94+
continue-on-error: true
95+
96+
# Integration Tests
97+
integration:
98+
name: Integration Tests
99+
runs-on: ubuntu-latest
100+
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
101+
102+
steps:
103+
- name: Checkout code
104+
uses: actions/checkout@v4
105+
106+
- name: Set up Python
107+
uses: actions/setup-python@v5
108+
with:
109+
python-version: "3.11"
110+
cache: 'pip'
111+
112+
- name: Install dependencies
113+
run: |
114+
python -m pip install --upgrade pip
115+
pip install -e ".[dev]"
116+
117+
- name: Run integration tests
118+
env:
119+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
120+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
121+
PYTHONPATH: ${{ github.workspace }}/src
122+
run: |
123+
pytest -m integration -v --tb=short
124+
continue-on-error: true
125+
126+
# Final Status Check
127+
ci-success:
128+
name: CI Success
129+
runs-on: ubuntu-latest
130+
needs: [test]
131+
if: always()
132+
133+
steps:
134+
- name: Check all jobs status
135+
run: |
136+
if [[ "${{ needs.quality.result }}" == "failure" || "${{ needs.test.result }}" == "failure" ]]; then
137+
echo "CI failed due to quality or test failures"
138+
exit 1
139+
elif [[ "${{ needs.docs.result }}" == "failure" ]]; then
140+
echo "CI completed but documentation build failed"
141+
exit 0
142+
else
143+
echo "CI passed successfully"
144+
exit 0
145+
fi

0 commit comments

Comments
 (0)