fastapi-refine 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. fastapi_refine-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +42 -0
  2. fastapi_refine-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +29 -0
  3. fastapi_refine-0.1.0/.github/pull_request_template.md +41 -0
  4. fastapi_refine-0.1.0/.github/workflows/ci.yml +73 -0
  5. fastapi_refine-0.1.0/.github/workflows/publish.yml +30 -0
  6. fastapi_refine-0.1.0/.gitignore +89 -0
  7. fastapi_refine-0.1.0/.python-version +1 -0
  8. fastapi_refine-0.1.0/CHANGELOG.md +22 -0
  9. fastapi_refine-0.1.0/CONTRIBUTING.md +94 -0
  10. fastapi_refine-0.1.0/LICENSE +21 -0
  11. fastapi_refine-0.1.0/MANIFEST.in +5 -0
  12. fastapi_refine-0.1.0/PKG-INFO +282 -0
  13. fastapi_refine-0.1.0/README.md +249 -0
  14. fastapi_refine-0.1.0/examples/README.md +33 -0
  15. fastapi_refine-0.1.0/examples/basic_usage.py +119 -0
  16. fastapi_refine-0.1.0/fastapi_refine/__init__.py +22 -0
  17. fastapi_refine-0.1.0/fastapi_refine/core/__init__.py +27 -0
  18. fastapi_refine-0.1.0/fastapi_refine/core/query.py +187 -0
  19. fastapi_refine-0.1.0/fastapi_refine/core/types.py +63 -0
  20. fastapi_refine-0.1.0/fastapi_refine/dependencies/__init__.py +6 -0
  21. fastapi_refine-0.1.0/fastapi_refine/dependencies/query.py +156 -0
  22. fastapi_refine-0.1.0/fastapi_refine/dependencies/response.py +51 -0
  23. fastapi_refine-0.1.0/fastapi_refine/hooks/__init__.py +6 -0
  24. fastapi_refine-0.1.0/fastapi_refine/hooks/base.py +78 -0
  25. fastapi_refine-0.1.0/fastapi_refine/hooks/builtin.py +93 -0
  26. fastapi_refine-0.1.0/fastapi_refine/py.typed +0 -0
  27. fastapi_refine-0.1.0/fastapi_refine/routers/__init__.py +5 -0
  28. fastapi_refine-0.1.0/fastapi_refine/routers/factory.py +331 -0
  29. fastapi_refine-0.1.0/fastapi_refine/utils/__init__.py +0 -0
  30. fastapi_refine-0.1.0/pyproject.toml +90 -0
  31. fastapi_refine-0.1.0/tests/__init__.py +1 -0
  32. fastapi_refine-0.1.0/tests/conftest.py +16 -0
  33. fastapi_refine-0.1.0/tests/test_query_parsing.py +45 -0
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: Bug Report
3
+ about: Report a bug or unexpected behavior
4
+ title: '[BUG] '
5
+ labels: bug
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Bug Description
10
+ A clear and concise description of what the bug is.
11
+
12
+ ## To Reproduce
13
+ Steps to reproduce the behavior:
14
+ 1. Setup code: '...'
15
+ 2. Run code: '...'
16
+ 3. Observe error: '...'
17
+
18
+ ## Expected Behavior
19
+ A clear and concise description of what you expected to happen.
20
+
21
+ ## Actual Behavior
22
+ What actually happened.
23
+
24
+ ## Minimal Reproducible Example
25
+ ```python
26
+ # Please provide a minimal code example that reproduces the issue
27
+ ```
28
+
29
+ ## Environment
30
+ - Python version: [e.g., 3.11]
31
+ - fastapi-refine version: [e.g., 0.1.0]
32
+ - FastAPI version: [e.g., 0.114.2]
33
+ - SQLModel version: [e.g., 0.0.21]
34
+ - OS: [e.g., Ubuntu 22.04]
35
+
36
+ ## Error Messages
37
+ ```
38
+ Paste any error messages or stack traces here
39
+ ```
40
+
41
+ ## Additional Context
42
+ Add any other context about the problem here.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: Feature Request
3
+ about: Suggest an idea or new feature
4
+ title: '[FEATURE] '
5
+ labels: enhancement
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Is your feature request related to a problem?
10
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11
+
12
+ ## Describe the solution you'd like
13
+ A clear and concise description of what you want to happen.
14
+
15
+ ## Example Usage
16
+ ```python
17
+ # Show how you'd like to use this feature
18
+ ```
19
+
20
+ ## Describe alternatives you've considered
21
+ A clear and concise description of any alternative solutions or features you've considered.
22
+
23
+ ## Additional Context
24
+ Add any other context, screenshots, or examples about the feature request here.
25
+
26
+ ## Would you be willing to contribute this feature?
27
+ - [ ] Yes, I can work on this
28
+ - [ ] No, but I can help test it
29
+ - [ ] No, just requesting
@@ -0,0 +1,41 @@
1
+ ## Description
2
+ <!-- Provide a brief description of the changes -->
3
+
4
+ ## Type of Change
5
+ - [ ] Bug fix (non-breaking change that fixes an issue)
6
+ - [ ] New feature (non-breaking change that adds functionality)
7
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
8
+ - [ ] Documentation update
9
+ - [ ] Code refactoring
10
+ - [ ] Performance improvement
11
+
12
+ ## Related Issues
13
+ <!-- Link any related issues using #issue_number -->
14
+ Closes #
15
+
16
+ ## Changes Made
17
+ <!-- List the main changes in this PR -->
18
+ -
19
+ -
20
+ -
21
+
22
+ ## Testing
23
+ <!-- Describe how you tested these changes -->
24
+ - [ ] Added new tests
25
+ - [ ] All existing tests pass
26
+ - [ ] Manual testing performed
27
+
28
+ ## Checklist
29
+ - [ ] My code follows the project's code style
30
+ - [ ] I have run `ruff format .` and `ruff check .`
31
+ - [ ] I have run `mypy .` with no errors
32
+ - [ ] I have updated the documentation accordingly
33
+ - [ ] I have added/updated tests for my changes
34
+ - [ ] I have updated CHANGELOG.md
35
+ - [ ] All new and existing tests pass
36
+
37
+ ## Screenshots (if applicable)
38
+ <!-- Add screenshots to help explain your changes -->
39
+
40
+ ## Additional Notes
41
+ <!-- Any additional information that reviewers should know -->
@@ -0,0 +1,73 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, master]
6
+ pull_request:
7
+ branches: [main, master]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v4
21
+ with:
22
+ enable-cache: true
23
+
24
+ - name: Set up Python ${{ matrix.python-version }}
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: ${{ matrix.python-version }}
28
+
29
+ - name: Install dependencies
30
+ run: |
31
+ uv pip install --system -e ".[dev]"
32
+
33
+ - name: Run ruff check
34
+ run: ruff check .
35
+
36
+ - name: Run ruff format check
37
+ run: ruff format --check .
38
+
39
+ - name: Run mypy
40
+ run: mypy .
41
+
42
+ - name: Run tests
43
+ run: pytest
44
+ if: always()
45
+
46
+ build:
47
+ runs-on: ubuntu-latest
48
+ needs: test
49
+
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+
53
+ - name: Set up Python
54
+ uses: actions/setup-python@v5
55
+ with:
56
+ python-version: "3.12"
57
+
58
+ - name: Install build tools
59
+ run: |
60
+ python -m pip install --upgrade pip
61
+ pip install build twine
62
+
63
+ - name: Build package
64
+ run: python -m build
65
+
66
+ - name: Check package
67
+ run: twine check dist/*
68
+
69
+ - name: Upload artifacts
70
+ uses: actions/upload-artifact@v4
71
+ with:
72
+ name: dist
73
+ path: dist/
@@ -0,0 +1,30 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ id-token: write # Required for trusted publishing
12
+
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v5
18
+ with:
19
+ python-version: "3.12"
20
+
21
+ - name: Install build tools
22
+ run: |
23
+ python -m pip install --upgrade pip
24
+ pip install build
25
+
26
+ - name: Build package
27
+ run: python -m build
28
+
29
+ - name: Publish to PyPI
30
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,89 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ *.manifest
32
+ *.spec
33
+
34
+ # Unit test / coverage reports
35
+ htmlcov/
36
+ .tox/
37
+ .nox/
38
+ .coverage
39
+ .coverage.*
40
+ .cache
41
+ nosetests.xml
42
+ coverage.xml
43
+ *.cover
44
+ *.py,cover
45
+ .hypothesis/
46
+ .pytest_cache/
47
+
48
+ # Virtual environments
49
+ venv/
50
+ ENV/
51
+ env/
52
+ .venv
53
+
54
+ # IDEs
55
+ .vscode/
56
+ .idea/
57
+ *.swp
58
+ *.swo
59
+ *~
60
+
61
+ # OS
62
+ .DS_Store
63
+ Thumbs.db
64
+
65
+ # mypy
66
+ .mypy_cache/
67
+ .dmypy.json
68
+ dmypy.json
69
+
70
+ # ruff
71
+ .ruff_cache/
72
+
73
+ # uv
74
+ .uv/
75
+ uv.lock
76
+
77
+ # Lock files (libraries should not commit lock files)
78
+ poetry.lock
79
+ Pipfile.lock
80
+
81
+ # Database files
82
+ *.db
83
+ *.sqlite
84
+ *.sqlite3
85
+
86
+ # Environment files
87
+ .env
88
+ .env.local
89
+ .env.*.local
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,22 @@
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/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2025-01-07
11
+
12
+ ### Added
13
+ - Initial release
14
+ - Query parameter parsing for Refine simple-rest conventions
15
+ - Support for filtering (eq, ne, gte, lte, like operators)
16
+ - Full-text search via `q` parameter
17
+ - Multi-field sorting
18
+ - Range-based and offset-based pagination
19
+ - `RefineCRUDRouter` factory for automatic CRUD endpoint generation
20
+ - Hook system for custom logic injection
21
+ - Type-safe with full mypy support
22
+ - Built-in type converters (parse_bool, parse_uuid)
@@ -0,0 +1,94 @@
1
+ # Contributing to fastapi-refine
2
+
3
+ Thank you for your interest in contributing to fastapi-refine! This document provides guidelines for contributing.
4
+
5
+ ## Development Setup
6
+
7
+ 1. Clone the repository:
8
+ ```bash
9
+ git clone https://github.com/koch3092/fastapi-refine.git
10
+ cd fastapi-refine
11
+ ```
12
+
13
+ 2. Install dependencies with uv:
14
+ ```bash
15
+ # Install uv if you haven't already
16
+ curl -LsSf https://astral.sh/uv/install.sh | sh
17
+
18
+ # Create virtual environment and install dependencies
19
+ uv venv
20
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
21
+ uv pip install -e ".[dev]"
22
+ ```
23
+
24
+ ## Code Quality
25
+
26
+ Before submitting a pull request, ensure your code passes all checks:
27
+
28
+ ```bash
29
+ # Format code
30
+ ruff format .
31
+
32
+ # Run linter
33
+ ruff check .
34
+
35
+ # Run type checker
36
+ mypy .
37
+
38
+ # Run tests (when available)
39
+ pytest
40
+ ```
41
+
42
+ ## Development Workflow
43
+
44
+ 1. Create a new branch for your feature or fix:
45
+ ```bash
46
+ git checkout -b feature/your-feature-name
47
+ ```
48
+
49
+ 2. Make your changes and commit with descriptive messages:
50
+ ```bash
51
+ git commit -m "Add feature: description of feature"
52
+ ```
53
+
54
+ 3. Push to your fork and submit a pull request:
55
+ ```bash
56
+ git push origin feature/your-feature-name
57
+ ```
58
+
59
+ ## Pull Request Guidelines
60
+
61
+ - Keep pull requests focused on a single feature or fix
62
+ - Include tests for new functionality
63
+ - Update documentation as needed
64
+ - Follow the existing code style
65
+ - Write clear commit messages
66
+ - Update CHANGELOG.md with your changes
67
+
68
+ ## Code Style
69
+
70
+ - Follow PEP 8 guidelines
71
+ - Use type hints for all function parameters and return values
72
+ - Write docstrings for all public APIs
73
+ - Keep functions small and focused
74
+ - Use meaningful variable names
75
+
76
+ ## Testing
77
+
78
+ When tests are added to the project, please ensure:
79
+ - All existing tests pass
80
+ - New features include appropriate tests
81
+ - Tests are clear and well-documented
82
+
83
+ ## Reporting Issues
84
+
85
+ When reporting issues, please include:
86
+ - Python version
87
+ - fastapi-refine version
88
+ - Minimal reproducible example
89
+ - Expected behavior vs actual behavior
90
+ - Any relevant error messages or stack traces
91
+
92
+ ## Questions?
93
+
94
+ Feel free to open an issue for any questions about contributing!
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 koko
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,0 +1,5 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
4
+ recursive-include fastapi_refine *.py
5
+ recursive-include fastapi_refine py.typed