Skip to content

Commit 3a118d2

Browse files
committed
feat: add MIT license and pre-commit configuration
- Add MIT License file with Unstract Team copyright - Add comprehensive pre-commit configuration with: - Ruff for linting and formatting - MyPy for type checking - Bandit for security scanning - Standard hooks for code quality - Update pyproject.toml with bandit configuration - Update README.md development setup to use uv and include pre-commit - Install and configure pre-commit hooks This ensures consistent code quality and proper licensing for the project.
1 parent 583053a commit 3a118d2

File tree

9 files changed

+150
-32
lines changed

9 files changed

+150
-32
lines changed

.github/RELEASE.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The workflow follows semantic versioning:
4646
### What Happens During Release
4747

4848
1. **Version Update**: Updates `__version__` in `src/apihub_client/__init__.py`
49-
2. **Git Operations**:
49+
2. **Git Operations**:
5050
- Commits version change to main branch
5151
- Creates and pushes git tag (e.g., `v1.2.3`)
5252
3. **Quality Checks**:
@@ -67,8 +67,9 @@ And these repository variables:
6767
- `PUSH_TO_MAIN_APP_ID`: GitHub App ID (can be same as secret)
6868

6969
**PyPI Setup**: This workflow uses PyPI Trusted Publishers with `uv publish` for secure publishing. You need to:
70+
7071
1. Configure the GitHub repository as a trusted publisher on PyPI
71-
2. Set up the trusted publisher for the `apihub-python-client` package
72+
2. Set up the trusted publisher for the `apihub-python-client` package
7273
3. No API tokens required - `uv publish` automatically handles OIDC authentication
7374

7475
## Manual Release Workflow
@@ -114,21 +115,25 @@ The `publish-on-release.yml` workflow runs when you manually create a release th
114115
### Common Issues
115116

116117
**Workflow fails at version bump:**
118+
117119
- Check that the current version in `__init__.py` follows semantic versioning
118120
- Ensure the main branch is up to date
119121

120122
**Tests fail during release:**
123+
121124
- Check the latest test results on main branch
122125
- Fix failing tests before attempting release
123126

124127
**PyPI publish fails:**
125-
- Verify PyPI Trusted Publisher is configured correctly
128+
129+
- Verify PyPI Trusted Publisher is configured correctly
126130
- Check if version already exists on PyPI
127131
- Ensure package builds successfully locally with `uv build`
128132
- Verify the repository and workflow file match the trusted publisher configuration
129133
- Check that `uv publish` has proper OIDC token access (requires `id-token: write` permission)
130134

131135
**Permission errors:**
136+
132137
- Verify GitHub App has necessary permissions
133138
- Check that secrets and variables are properly configured
134139

@@ -180,6 +185,7 @@ To configure PyPI Trusted Publishers:
180185
- **Environment name**: Leave empty (unless using GitHub environments)
181186
3. **Save the configuration**
182187

183-
For more details, see:
188+
For more details, see:
189+
184190
- https://docs.pypi.org/trusted-publishers/
185-
- https://docs.astral.sh/uv/guides/publish/#trusted-publishing
191+
- https://docs.astral.sh/uv/guides/publish/#trusted-publishing

.pre-commit-config.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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-added-large-files
9+
- id: check-case-conflict
10+
- id: check-merge-conflict
11+
- id: check-toml
12+
- id: debug-statements
13+
- id: mixed-line-ending
14+
15+
- repo: https://github.com/astral-sh/ruff-pre-commit
16+
rev: v0.1.15
17+
hooks:
18+
- id: ruff
19+
args: [--fix]
20+
- id: ruff-format
21+
22+
- repo: https://github.com/pre-commit/mirrors-mypy
23+
rev: v1.8.0
24+
hooks:
25+
- id: mypy
26+
additional_dependencies:
27+
- types-requests
28+
- pydantic
29+
- typing-extensions
30+
- pytest
31+
- requests-mock
32+
args:
33+
[
34+
--ignore-missing-imports,
35+
--no-strict-optional,
36+
--allow-untyped-defs,
37+
--disable-error-code=no-any-return,
38+
]
39+
exclude: ^test/
40+
41+
- repo: https://github.com/PyCQA/bandit
42+
rev: 1.7.5
43+
hooks:
44+
- id: bandit
45+
args: [-c, pyproject.toml]
46+
additional_dependencies: ["bandit[toml]"]
47+
48+
- repo: https://github.com/pre-commit/mirrors-prettier
49+
rev: v3.1.0
50+
hooks:
51+
- id: prettier
52+
types_or: [yaml, markdown, json]
53+
exclude: ^(uv\.lock|\.coverage)$
54+
55+
ci:
56+
autofix_commit_msg: |
57+
[pre-commit.ci] auto fixes from pre-commit hooks
58+
59+
for more information, see https://pre-commit.ci
60+
autofix_prs: true
61+
autoupdate_branch: ""
62+
autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate"
63+
autoupdate_schedule: weekly
64+
skip: []
65+
submodules: false

CLAUDE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ This document contains critical information about working with this codebase. Fo
55
## Core Development Rules
66

77
1. Package Management
8+
89
- ONLY use uv, NEVER pip
910
- Installation: `uv add package`
1011
- Running tools: `uv run tool`
1112
- Upgrading: `uv add --dev package --upgrade-package package`
1213
- FORBIDDEN: `uv pip install`, `@latest` syntax
1314

1415
2. Code Quality
16+
1517
- Type hints required for all code
1618
- Functions must be focused and small
1719
- Follow existing patterns exactly
@@ -23,7 +25,6 @@ This document contains critical information about working with this codebase. Fo
2325
- New features require tests
2426
- Bug fixes require regression tests
2527

26-
2728
## Python Tools
2829

2930
## Code Formatting
@@ -44,6 +45,7 @@ This document contains critical information about working with this codebase. Fo
4445
## Error Resolution
4546

4647
2. Common Issues
48+
4749
- Line length:
4850
- Break strings with parentheses
4951
- Multi-line function calls

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Unstract Team
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)