lightapi 0.0.20__tar.gz → 0.1.1__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 (124) hide show
  1. lightapi-0.1.1/.github/workflows/pages-publish.yml +59 -0
  2. lightapi-0.1.1/.github/workflows/python-publish.yml +129 -0
  3. lightapi-0.1.1/.github/workflows/test-dev.yml +80 -0
  4. lightapi-0.1.1/.gitignore +110 -0
  5. lightapi-0.1.1/.idx/dev.nix +38 -0
  6. lightapi-0.1.1/LICENSE +21 -0
  7. lightapi-0.1.1/PKG-INFO +1231 -0
  8. lightapi-0.1.1/README.md +1180 -0
  9. lightapi-0.1.1/docs/.pages +25 -0
  10. lightapi-0.1.1/docs/advanced/.pages +9 -0
  11. lightapi-0.1.1/docs/advanced/authentication.md +734 -0
  12. lightapi-0.1.1/docs/advanced/caching.md +292 -0
  13. lightapi-0.1.1/docs/advanced/filtering.md +53 -0
  14. lightapi-0.1.1/docs/advanced/middleware.md +244 -0
  15. lightapi-0.1.1/docs/advanced/pagination.md +66 -0
  16. lightapi-0.1.1/docs/advanced/validation.md +52 -0
  17. lightapi-0.1.1/docs/api-reference/.pages +12 -0
  18. lightapi-0.1.1/docs/api-reference/auth.md +569 -0
  19. lightapi-0.1.1/docs/api-reference/cache.md +167 -0
  20. lightapi-0.1.1/docs/api-reference/core.md +459 -0
  21. lightapi-0.1.1/docs/api-reference/database.md +150 -0
  22. lightapi-0.1.1/docs/api-reference/exceptions.md +197 -0
  23. lightapi-0.1.1/docs/api-reference/filters.md +698 -0
  24. lightapi-0.1.1/docs/api-reference/index.md +57 -0
  25. lightapi-0.1.1/docs/api-reference/models.md +196 -0
  26. lightapi-0.1.1/docs/api-reference/pagination.md +172 -0
  27. lightapi-0.1.1/docs/api-reference/rest.md +750 -0
  28. lightapi-0.1.1/docs/api-reference/swagger.md +225 -0
  29. lightapi-0.1.1/docs/api-reference/validation.md +226 -0
  30. lightapi-0.1.1/docs/deployment/.pages +6 -0
  31. lightapi-0.1.1/docs/deployment/docker.md +50 -0
  32. lightapi-0.1.1/docs/deployment/production.md +70 -0
  33. lightapi-0.1.1/docs/deployment/security.md +58 -0
  34. lightapi-0.1.1/docs/examples/.pages +12 -0
  35. lightapi-0.1.1/docs/examples/auth.md +486 -0
  36. lightapi-0.1.1/docs/examples/basic-crud.md +108 -0
  37. lightapi-0.1.1/docs/examples/basic-rest.md +302 -0
  38. lightapi-0.1.1/docs/examples/caching.md +665 -0
  39. lightapi-0.1.1/docs/examples/custom-application.md +81 -0
  40. lightapi-0.1.1/docs/examples/filtering-pagination.md +408 -0
  41. lightapi-0.1.1/docs/examples/middleware.md +705 -0
  42. lightapi-0.1.1/docs/examples/validation.md +634 -0
  43. lightapi-0.1.1/docs/getting-started/.pages +15 -0
  44. lightapi-0.1.1/docs/getting-started/configuration.md +43 -0
  45. lightapi-0.1.1/docs/getting-started/first-steps.md +88 -0
  46. lightapi-0.1.1/docs/getting-started/installation.md +12 -0
  47. lightapi-0.1.1/docs/getting-started/introduction.md +35 -0
  48. lightapi-0.1.1/docs/getting-started/quickstart.md +47 -0
  49. lightapi-0.1.1/docs/index.md +154 -0
  50. lightapi-0.1.1/docs/technical-reference/.pages +9 -0
  51. lightapi-0.1.1/docs/technical-reference/cache.md +31 -0
  52. lightapi-0.1.1/docs/technical-reference/core-api.md +71 -0
  53. lightapi-0.1.1/docs/technical-reference/endpoints.md +77 -0
  54. lightapi-0.1.1/docs/technical-reference/handlers.md +69 -0
  55. lightapi-0.1.1/docs/technical-reference/middleware.md +51 -0
  56. lightapi-0.1.1/docs/technical-reference/models.md +31 -0
  57. lightapi-0.1.1/docs/troubleshooting.md +354 -0
  58. lightapi-0.1.1/docs/tutorial/.pages +8 -0
  59. lightapi-0.1.1/docs/tutorial/basic-api.md +58 -0
  60. lightapi-0.1.1/docs/tutorial/database.md +90 -0
  61. lightapi-0.1.1/docs/tutorial/endpoints.md +67 -0
  62. lightapi-0.1.1/docs/tutorial/requests.md +69 -0
  63. lightapi-0.1.1/docs/tutorial/responses.md +93 -0
  64. lightapi-0.1.1/examples/README.md +206 -0
  65. lightapi-0.1.1/examples/auth_example.py +131 -0
  66. lightapi-0.1.1/examples/basic_rest_api.py +39 -0
  67. lightapi-0.1.1/examples/caching_example.py +193 -0
  68. lightapi-0.1.1/examples/custom_snippet.py +107 -0
  69. lightapi-0.1.1/examples/example.py +125 -0
  70. lightapi-0.1.1/examples/filtering_pagination_example.py +257 -0
  71. lightapi-0.1.1/examples/middleware_example.py +214 -0
  72. lightapi-0.1.1/examples/relationships_example.py +401 -0
  73. lightapi-0.1.1/examples/swagger_example.py +273 -0
  74. lightapi-0.1.1/examples/user_goal_example.py +135 -0
  75. lightapi-0.1.1/examples/validation_example.py +90 -0
  76. lightapi-0.1.1/lightapi/__init__.py +24 -0
  77. lightapi-0.1.1/lightapi/auth.py +133 -0
  78. lightapi-0.1.1/lightapi/base_endpoint.py +248 -0
  79. lightapi-0.1.1/lightapi/cache.py +108 -0
  80. lightapi-0.1.1/lightapi/config.py +57 -0
  81. lightapi-0.1.1/lightapi/core.py +662 -0
  82. lightapi-0.1.1/lightapi/database.py +60 -0
  83. lightapi-0.1.1/lightapi/exceptions.py +24 -0
  84. lightapi-0.1.1/lightapi/filters.py +60 -0
  85. lightapi-0.1.1/lightapi/handlers.py +357 -0
  86. lightapi-0.1.1/lightapi/lightapi.py +110 -0
  87. lightapi-0.1.1/lightapi/models.py +132 -0
  88. lightapi-0.1.1/lightapi/pagination.py +78 -0
  89. lightapi-0.1.1/lightapi/rest.py +388 -0
  90. lightapi-0.1.1/lightapi/swagger.py +314 -0
  91. lightapi-0.1.1/mkdocs.yml +148 -0
  92. lightapi-0.1.1/pyproject.toml +114 -0
  93. lightapi-0.1.1/pytest.ini +4 -0
  94. lightapi-0.1.1/requirements.txt +8 -0
  95. lightapi-0.1.1/test_simple_response.py +14 -0
  96. lightapi-0.1.1/tests/__init__.py +0 -0
  97. lightapi-0.1.1/tests/conftest.py +71 -0
  98. lightapi-0.1.1/tests/test_additional_features.py +124 -0
  99. lightapi-0.1.1/tests/test_auth.py +84 -0
  100. lightapi-0.1.1/tests/test_auth_example.py +305 -0
  101. lightapi-0.1.1/tests/test_basic_rest_api.py +236 -0
  102. lightapi-0.1.1/tests/test_cache.py +81 -0
  103. lightapi-0.1.1/tests/test_caching_example.py +409 -0
  104. lightapi-0.1.1/tests/test_clients.py +0 -0
  105. lightapi-0.1.1/tests/test_core.py +71 -0
  106. lightapi-0.1.1/tests/test_custom_snippet.py +310 -0
  107. lightapi-0.1.1/tests/test_example.py +54 -0
  108. lightapi-0.1.1/tests/test_filtering_pagination_example.py +442 -0
  109. lightapi-0.1.1/tests/test_filters.py +55 -0
  110. lightapi-0.1.1/tests/test_helpers.py +78 -0
  111. lightapi-0.1.1/tests/test_integration.py +106 -0
  112. lightapi-0.1.1/tests/test_middleware.py +90 -0
  113. lightapi-0.1.1/tests/test_middleware_example.py +351 -0
  114. lightapi-0.1.1/tests/test_pagination.py +89 -0
  115. lightapi-0.1.1/tests/test_rest.py +162 -0
  116. lightapi-0.1.1/tests/test_swagger.py +113 -0
  117. lightapi-0.1.1/tests/test_validation_example.py +210 -0
  118. lightapi-0.1.1/update_version.py +36 -0
  119. lightapi-0.1.1/uv.lock +734 -0
  120. lightapi-0.0.20/PKG-INFO +0 -66
  121. lightapi-0.0.20/README.md +0 -52
  122. lightapi-0.0.20/pyproject.toml +0 -16
  123. lightapi-0.0.20/setup.py +0 -34
  124. {lightapi-0.0.20/src/lightapi → lightapi-0.1.1/examples}/__init__.py +0 -0
@@ -0,0 +1,59 @@
1
+ name: Deploy GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ branches: ["main"]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ pages: write
11
+ id-token: write
12
+ pull-requests: read
13
+
14
+ concurrency:
15
+ group: "pages"
16
+ cancel-in-progress: false
17
+
18
+ jobs:
19
+ deploy:
20
+ environment:
21
+ name: github-pages
22
+ url: ${{ steps.deployment.outputs.page_url }}
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - name: Checkout
26
+ uses: actions/checkout@v4
27
+ with:
28
+ fetch-depth: 0
29
+ token: ${{ secrets.GITHUB_TOKEN }}
30
+
31
+ - name: Set up Python
32
+ uses: actions/setup-python@v4
33
+ with:
34
+ python-version: '3.x'
35
+ cache: 'pip'
36
+
37
+ - name: Install dependencies
38
+ run: |
39
+ python -m pip install --upgrade pip
40
+ pip install mkdocs mkdocs-material mkdocs-git-authors-plugin mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin mkdocs-awesome-pages-plugin mkdocs-glightbox mkdocstrings[python]
41
+ pip install -e .[docs]
42
+
43
+ - name: Build site with MkDocs
44
+ env:
45
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46
+ run: |
47
+ mkdocs build --strict
48
+
49
+ - name: Setup Pages
50
+ uses: actions/configure-pages@v5
51
+
52
+ - name: Upload artifact
53
+ uses: actions/upload-pages-artifact@v3
54
+ with:
55
+ path: './site'
56
+
57
+ - name: Deploy to GitHub Pages
58
+ id: deployment
59
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,129 @@
1
+ # This workflow will upload a Python Package using Twine when code is pushed to main
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3
+
4
+ # This workflow uses actions that are not certified by GitHub.
5
+ # They are provided by a third-party and are governed by
6
+ # separate terms of service, privacy policy, and support
7
+ # documentation.
8
+
9
+ name: Upload Python Package
10
+
11
+ on:
12
+ push:
13
+ branches: [ "master" ]
14
+ release:
15
+ types: [published]
16
+
17
+ permissions:
18
+ contents: write
19
+ id-token: write
20
+
21
+ jobs:
22
+ test:
23
+ runs-on: ubuntu-latest
24
+ strategy:
25
+ matrix:
26
+ python-version: ["3.8", "3.9", "3.10", "3.11"]
27
+
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ - name: Set up Python ${{ matrix.python-version }}
31
+ uses: actions/setup-python@v4
32
+ with:
33
+ python-version: ${{ matrix.python-version }}
34
+
35
+ - name: Install dependencies
36
+ run: |
37
+ python -m pip install --upgrade pip
38
+ pip install -e .[test,dev]
39
+
40
+ - name: Run tests
41
+ run: |
42
+ pytest tests/ -v
43
+
44
+ deploy:
45
+ needs: test
46
+ runs-on: ubuntu-latest
47
+ if: github.ref == 'refs/heads/master'
48
+
49
+ steps:
50
+ - uses: actions/checkout@v4
51
+ with:
52
+ fetch-depth: 0
53
+ token: ${{ secrets.GITHUB_TOKEN }}
54
+
55
+ - name: Set up Python
56
+ uses: actions/setup-python@v4
57
+ with:
58
+ python-version: '3.11'
59
+
60
+ - name: Install dependencies
61
+ run: |
62
+ python -m pip install --upgrade pip
63
+ pip install build twine tomli-w tomli
64
+
65
+ - name: Create version update script
66
+ run: |
67
+ cat > update_version.py << 'EOF'
68
+ import sys
69
+ import os
70
+ try:
71
+ import tomllib
72
+ except ImportError:
73
+ import tomli as tomllib
74
+ import tomli_w
75
+
76
+ def get_current_version():
77
+ with open('pyproject.toml', 'rb') as f:
78
+ data = tomllib.load(f)
79
+ return data['project']['version']
80
+
81
+ def increment_version(version):
82
+ parts = version.split('.')
83
+ parts[-1] = str(int(parts[-1]) + 1)
84
+ return '.'.join(parts)
85
+
86
+ def update_version(new_version):
87
+ with open('pyproject.toml', 'rb') as f:
88
+ data = tomllib.load(f)
89
+
90
+ data['project']['version'] = new_version
91
+
92
+ with open('pyproject.toml', 'wb') as f:
93
+ tomli_w.dump(data, f)
94
+
95
+ if __name__ == "__main__":
96
+ current = get_current_version()
97
+ new = increment_version(current)
98
+ update_version(new)
99
+ print(f"Updated version from {current} to {new}")
100
+
101
+ # Write to GitHub output
102
+ with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
103
+ f.write(f"new_version={new}\n")
104
+ EOF
105
+
106
+ - name: Update version
107
+ id: update_version
108
+ run: python update_version.py
109
+
110
+ - name: Build package
111
+ run: python -m build
112
+
113
+ - name: Check package
114
+ run: twine check dist/*
115
+
116
+ - name: Publish package to PyPI
117
+ env:
118
+ TWINE_USERNAME: __token__
119
+ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
120
+ run: |
121
+ twine upload dist/*
122
+
123
+ - name: Commit version update
124
+ run: |
125
+ git config --local user.email "action@github.com"
126
+ git config --local user.name "GitHub Action"
127
+ git add pyproject.toml
128
+ git commit -m "Bump version to ${{ steps.update_version.outputs.new_version }}" || exit 0
129
+ git push
@@ -0,0 +1,80 @@
1
+ # This workflow runs tests on the development branch
2
+ # It runs tests but does not publish to PyPI
3
+
4
+ name: Development Tests
5
+
6
+ on:
7
+ push:
8
+ branches: [ "development" ]
9
+ pull_request:
10
+ branches: [ "development", "master" ]
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ test:
17
+ runs-on: ubuntu-latest
18
+ strategy:
19
+ matrix:
20
+ python-version: ["3.8", "3.9", "3.10", "3.11"]
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+
25
+ - name: Set up Python ${{ matrix.python-version }}
26
+ uses: actions/setup-python@v4
27
+ with:
28
+ python-version: ${{ matrix.python-version }}
29
+
30
+ - name: Install dependencies
31
+ run: |
32
+ python -m pip install --upgrade pip
33
+ pip install -e .[test,dev]
34
+
35
+ - name: Run linting (Python 3.11 only)
36
+ if: matrix.python-version == '3.11'
37
+ run: |
38
+ # Install linting tools
39
+ pip install black isort flake8 mypy
40
+
41
+ # Run code formatting checks
42
+ black --check --diff .
43
+
44
+ # Run import sorting checks
45
+ isort --check-only --diff .
46
+
47
+ # Run style checks
48
+ flake8 lightapi/ --count --select=E9,F63,F7,F82 --show-source --statistics
49
+ flake8 lightapi/ --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
50
+
51
+ - name: Run tests
52
+ run: |
53
+ pytest tests/ -v --tb=short
54
+
55
+ - name: Test package build
56
+ if: matrix.python-version == '3.11'
57
+ run: |
58
+ pip install build
59
+ python -m build
60
+
61
+ - name: Check package
62
+ if: matrix.python-version == '3.11'
63
+ run: |
64
+ pip install twine
65
+ twine check dist/*
66
+
67
+ # Job to check if all tests passed
68
+ test-summary:
69
+ needs: test
70
+ runs-on: ubuntu-latest
71
+ if: always()
72
+ steps:
73
+ - name: Check test results
74
+ run: |
75
+ if [ "${{ needs.test.result }}" = "success" ]; then
76
+ echo "✅ All tests passed! Ready for merge to master."
77
+ else
78
+ echo "❌ Tests failed. Please fix issues before merging."
79
+ exit 1
80
+ fi
@@ -0,0 +1,110 @@
1
+ .idea/**/workspace.xml
2
+ .idea/**/tasks.xml
3
+ .idea/**/usage.statistics.xml
4
+ .idea/**/dictionaries
5
+ .idea/**/shelf
6
+ .idea/**/aws.xml
7
+ .idea/**/contentModel.xml
8
+ .idea/**/dataSources/
9
+ .idea/**/dataSources.ids
10
+ .idea/**/dataSources.local.xml
11
+ .idea/**/sqlDataSources.xml
12
+ .idea/**/dynamic.xml
13
+ .idea/**/uiDesigner.xml
14
+ .idea/**/dbnavigator.xml
15
+ .idea/**/gradle.xml
16
+ .idea/**/libraries
17
+ cmake-build-*/
18
+ .idea/**/mongoSettings.xml
19
+ *.iws
20
+ out/
21
+ .idea_modules/
22
+ atlassian-ide-plugin.xml
23
+ .idea/replstate.xml
24
+ .idea/sonarlint/
25
+ com_crashlytics_export_strings.xml
26
+ crashlytics.properties
27
+ crashlytics-build.properties
28
+ fabric.properties
29
+ .idea/httpRequests
30
+ .idea/caches/build_file_checksums.ser
31
+ __pycache__/
32
+ *.py[cod]
33
+ *$py.class
34
+ *.so
35
+ .Python
36
+ build/
37
+ develop-eggs/
38
+ dist/
39
+ downloads/
40
+ eggs/
41
+ .eggs/
42
+ lib/
43
+ lib64/
44
+ parts/
45
+ sdist/
46
+ var/
47
+ wheels/
48
+ share/python-wheels/
49
+ *.egg-info/
50
+ .installed.cfg
51
+ *.egg
52
+ MANIFEST
53
+ *.manifest
54
+ *.spec
55
+ pip-log.txt
56
+ pip-delete-this-directory.txt
57
+ htmlcov/
58
+ .tox/
59
+ .nox/
60
+ .coverage
61
+ .coverage.*
62
+ .cache
63
+ nosetests.xml
64
+ coverage.xml
65
+ *.cover
66
+ *.py,cover
67
+ .hypothesis/
68
+ .pytest_cache/
69
+ cover/
70
+ *.mo
71
+ *.pot
72
+ *.log
73
+ local_settings.py
74
+ db.sqlite3
75
+ db.sqlite3-journal
76
+ instance/
77
+ .webassets-cache
78
+ .scrapy
79
+ docs/_build/
80
+ .pybuilder/
81
+ target/
82
+ .ipynb_checkpoints
83
+ profile_default/
84
+ ipython_config.py
85
+ .pdm.toml
86
+ __pypackages__/
87
+ celerybeat-schedule
88
+ celerybeat.pid
89
+ *.sage.py
90
+ .env
91
+ .venv
92
+ env/
93
+ venv/
94
+ ENV/
95
+ env.bak/
96
+ venv.bak/
97
+ .spyderproject
98
+ .spyproject
99
+ .ropeproject
100
+ /site
101
+ .mypy_cache/
102
+ .dmypy.json
103
+ dmypy.json
104
+ .pyre/
105
+ .pytype/
106
+ cython_debug/
107
+ .idea
108
+ .idea
109
+ alembic
110
+ *.db
@@ -0,0 +1,38 @@
1
+ # To learn more about how to use Nix to configure your environment
2
+ # see: https://developers.google.com/idx/guides/customize-idx-env
3
+ { pkgs, ... }: {
4
+ # Which nixpkgs channel to use.
5
+ channel = "stable-23.11"; # or "unstable"
6
+
7
+ # Use https://search.nixos.org/packages to find packages
8
+ packages = [
9
+ pkgs.python3
10
+ ];
11
+
12
+ # Sets environment variables in the workspace
13
+ env = {};
14
+ idx = {
15
+ # Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
16
+ extensions = [
17
+ "ms-python.python"
18
+ ];
19
+
20
+ # Workspace lifecycle hooks
21
+ workspace = {
22
+ # Runs when a workspace is first created
23
+ onCreate = {
24
+ create-venv = ''
25
+ python -m venv .venv
26
+ source .venv/bin/activate
27
+ pip install -e .[test,docs]
28
+ '';
29
+ };
30
+ # Runs when the workspace is (re)started
31
+ onStart = {
32
+ #activate-venv = ''
33
+ # echo "source .venv/bin/activate" >> ~/.bashrc
34
+ #'';
35
+ };
36
+ };
37
+ };
38
+ }
lightapi-0.1.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 iklobato
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.