viscribe 1.0.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 (37) hide show
  1. viscribe-1.0.1/.github/ISSUE_TEMPLATE/bug_report.yml +109 -0
  2. viscribe-1.0.1/.github/ISSUE_TEMPLATE/feature_request.yml +51 -0
  3. viscribe-1.0.1/.github/actions/uv_setup/action.yml +21 -0
  4. viscribe-1.0.1/.github/workflows/_lint.yml +44 -0
  5. viscribe-1.0.1/.github/workflows/_test.yml +42 -0
  6. viscribe-1.0.1/.github/workflows/ci.yml +57 -0
  7. viscribe-1.0.1/.github/workflows/release.yml +151 -0
  8. viscribe-1.0.1/.gitignore +147 -0
  9. viscribe-1.0.1/.pre-commit-config.yaml +23 -0
  10. viscribe-1.0.1/CODE_OF_CONDUCT.md +128 -0
  11. viscribe-1.0.1/CONTRIBUTING.md +102 -0
  12. viscribe-1.0.1/LICENSE +21 -0
  13. viscribe-1.0.1/Makefile +55 -0
  14. viscribe-1.0.1/PKG-INFO +235 -0
  15. viscribe-1.0.1/README.md +213 -0
  16. viscribe-1.0.1/assets/viscribe-logo.png +0 -0
  17. viscribe-1.0.1/examples/async_image_endpoints_example.py +66 -0
  18. viscribe-1.0.1/examples/image_endpoints_example.py +61 -0
  19. viscribe-1.0.1/examples/user_endpoints_example.py +23 -0
  20. viscribe-1.0.1/pyproject.toml +97 -0
  21. viscribe-1.0.1/tests/__init__.py +0 -0
  22. viscribe-1.0.1/tests/test_async_client.py +173 -0
  23. viscribe-1.0.1/tests/test_client.py +160 -0
  24. viscribe-1.0.1/tests/test_exceptions.py +15 -0
  25. viscribe-1.0.1/tests/test_image_endpoints.py +137 -0
  26. viscribe-1.0.1/tests/utils.py +6 -0
  27. viscribe-1.0.1/uv.lock +1956 -0
  28. viscribe-1.0.1/viscribe/__init__.py +4 -0
  29. viscribe-1.0.1/viscribe/async_client.py +316 -0
  30. viscribe-1.0.1/viscribe/client.py +327 -0
  31. viscribe-1.0.1/viscribe/config.py +6 -0
  32. viscribe-1.0.1/viscribe/exceptions.py +7 -0
  33. viscribe-1.0.1/viscribe/logger.py +119 -0
  34. viscribe-1.0.1/viscribe/models/__init__.py +16 -0
  35. viscribe-1.0.1/viscribe/models/image.py +188 -0
  36. viscribe-1.0.1/viscribe/utils/__init__.py +0 -0
  37. viscribe-1.0.1/viscribe/utils/helpers.py +80 -0
@@ -0,0 +1,109 @@
1
+ name: 🐛 Bug report
2
+ description: Submit a bug report to help us improve ViscribeAI Python SDK.
3
+ labels: ["type:bug", "status:needs-triage"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thanks for taking the time to report this problem!
9
+ We really appreciate the community's efforts to improve ViscribeAI Python SDK.
10
+
11
+ - type: checkboxes
12
+ attributes:
13
+ label: Checklist
14
+ description: Please confirm and check all the following options.
15
+ options:
16
+ - label: I have searched the [existing issues](https://github.com/ViscribeAI/python-sdk/issues) for similar issues.
17
+ required: true
18
+ - label: I added a very descriptive title to this issue.
19
+ required: true
20
+ - label: I have provided sufficient information below to help reproduce this issue.
21
+ required: true
22
+ - type: textarea
23
+ attributes:
24
+ label: Summary
25
+ description: Type here a clear and concise description of the problem. Aim for 2-3 sentences.
26
+ validations:
27
+ required: true
28
+ - type: textarea
29
+ attributes:
30
+ label: Reproducible Code Example
31
+ render: Python
32
+ description: |
33
+ If applicable, please provide a [self-contained minimal code example](https://stackoverflow.com/help/minimal-reproducible-example) that reproduces the problem you ran into.
34
+ If we can copy it, run it, and see it right away, there's a much higher chance we will be able to help you.
35
+ placeholder: |
36
+ import viscribe
37
+
38
+ # Your code here
39
+ validations:
40
+ required: false
41
+ - type: textarea
42
+ attributes:
43
+ label: Steps To Reproduce
44
+ description: Please provide the steps we should take to reproduce the bug.
45
+ placeholder: |
46
+ 1. Go to '...'
47
+ 2. Click on '....'
48
+ 3. Scroll down to '....'
49
+ 4. See error
50
+ validations:
51
+ required: false
52
+ - type: textarea
53
+ attributes:
54
+ label: Expected Behavior
55
+ description: Explain what you expect to happen when you go through the steps above, assuming there were no bugs.
56
+ validations:
57
+ required: false
58
+ - type: textarea
59
+ attributes:
60
+ label: Current Behavior
61
+ placeholder: |
62
+ Error message:
63
+ ```
64
+ Traceback (most recent call last):
65
+ File "example.py", line 1, in <module>
66
+ import viscribe
67
+ ```
68
+ description: |
69
+ Explain the buggy behavior you experience when you go through the steps above.
70
+ If you have error messages or stack traces please provide them here as well.
71
+ If applicable, add screenshots to help explain your problem.
72
+
73
+ _Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in._
74
+ validations:
75
+ required: false
76
+ - type: checkboxes
77
+ attributes:
78
+ label: Is this a regression?
79
+ description: Did this use to work the way you expected in the past?
80
+ options:
81
+ - label: Yes, this used to work in a previous version.
82
+ required: false
83
+ - type: textarea
84
+ attributes:
85
+ label: Debug info
86
+ description: |
87
+ Please share some system information related to the environment your app is running in.
88
+
89
+ Example:
90
+ - **ViscribeAI Python SDK version**: 1.8.0 _(get it with `$ pip show viscribe`)_
91
+ - **Python version**: 3.10 _(get it with `$ python --version`)_
92
+ - **Operating System**: MacOs 12.6
93
+ - **Browser**: Chrome
94
+ value: |
95
+ - ViscribeAI Python SDK version:
96
+ - Python version:
97
+ - Operating System:
98
+ - Browser:
99
+ validations:
100
+ required: false
101
+ - type: textarea
102
+ attributes:
103
+ label: Additional Information
104
+ description: |
105
+ Links? References? Anything that will give us more context about the issue you are encountering!
106
+
107
+ _Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in._
108
+ validations:
109
+ required: false
@@ -0,0 +1,51 @@
1
+ name: ✨ Feature request
2
+ description: Suggest a feature or enhancement for ViscribeAI Python SDK.
3
+ labels: ["type:enhancement"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ Thanks for taking the time to suggest a feature or enhancement for ViscribeAI Python SDK!
9
+ We really appreciate the community's efforts to improve ViscribeAI Python SDK ❤️
10
+ - type: checkboxes
11
+ attributes:
12
+ label: Checklist
13
+ description: Please confirm and check all the following options.
14
+ options:
15
+ - label: I have searched the [existing issues](https://github.com/ViscribeAI/python-sdk/issues) for similar feature requests.
16
+ required: true
17
+ - label: I added a descriptive title and summary to this issue.
18
+ required: true
19
+ - type: textarea
20
+ attributes:
21
+ label: Summary
22
+ description: Type here a clear and concise description of the feature or enhancement request. Aim for 2-3 sentences.
23
+ validations:
24
+ required: true
25
+ - type: textarea
26
+ attributes:
27
+ label: Why?
28
+ description: Please outline the problem, motivation, or use case related to this feature request.
29
+ placeholder: |
30
+ I'm always frustrated when ...
31
+ validations:
32
+ required: false
33
+ - type: textarea
34
+ attributes:
35
+ label: How?
36
+ description: |
37
+ Please describe the solution or implementation you'd like to see. This might include suggestions for new parameters, UI mockups etc.
38
+ Don't worry if you don't have a clear solution in mind; any input helps!
39
+ placeholder: |
40
+ Introduce a new feature that ...
41
+ validations:
42
+ required: false
43
+ - type: textarea
44
+ attributes:
45
+ label: Additional Context
46
+ description: |
47
+ Links? References? Anything that will give us more context about the feature request here!
48
+
49
+ _Tip: You can attach images by clicking this area to highlight it and then dragging files in._
50
+ validations:
51
+ required: false
@@ -0,0 +1,21 @@
1
+ # TODO: https://docs.astral.sh/uv/guides/integration/github/#caching
2
+
3
+ name: uv-install
4
+ description: Set up Python and uv
5
+
6
+ inputs:
7
+ python-version:
8
+ description: Python version, supporting MAJOR.MINOR only
9
+ required: true
10
+
11
+ env:
12
+ UV_VERSION: "0.5.25"
13
+
14
+ runs:
15
+ using: composite
16
+ steps:
17
+ - name: Install uv and set the python version
18
+ uses: astral-sh/setup-uv@v5
19
+ with:
20
+ version: ${{ env.UV_VERSION }}
21
+ python-version: ${{ inputs.python-version }}
@@ -0,0 +1,44 @@
1
+ name: lint
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ working-directory:
7
+ required: true
8
+ type: string
9
+ description: "From which folder this pipeline executes"
10
+ python-version:
11
+ required: true
12
+ type: string
13
+ description: "Python version to use"
14
+
15
+ env:
16
+ WORKDIR: ${{ inputs.working-directory == '' && '.' || inputs.working-directory }}
17
+
18
+ # This env var allows us to get inline annotations when ruff has complaints.
19
+ RUFF_OUTPUT_FORMAT: github
20
+
21
+ UV_FROZEN: "true"
22
+
23
+ jobs:
24
+ build:
25
+ name: "make lint #${{ inputs.python-version }}"
26
+ runs-on: ubuntu-latest
27
+ timeout-minutes: 20
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+
31
+ - name: Set up Python ${{ inputs.python-version }} + uv
32
+ uses: "./.github/actions/uv_setup"
33
+ with:
34
+ python-version: ${{ inputs.python-version }}
35
+
36
+ - name: Install dependencies
37
+ working-directory: ${{ inputs.working-directory }}
38
+ run: |
39
+ uv sync --group test
40
+
41
+ - name: Analysing the code with our lint
42
+ working-directory: ${{ inputs.working-directory }}
43
+ run: |
44
+ make lint
@@ -0,0 +1,42 @@
1
+ name: test
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ working-directory:
7
+ required: true
8
+ type: string
9
+ description: "From which folder this pipeline executes"
10
+ python-version:
11
+ required: true
12
+ type: string
13
+ description: "Python version to use"
14
+
15
+ env:
16
+ UV_FROZEN: "true"
17
+ UV_NO_SYNC: "true"
18
+
19
+ jobs:
20
+ build:
21
+ defaults:
22
+ run:
23
+ working-directory: ${{ inputs.working-directory }}
24
+ runs-on: ubuntu-latest
25
+ timeout-minutes: 20
26
+ name: "make test #${{ inputs.python-version }}"
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+
30
+ - name: Set up Python ${{ inputs.python-version }} + uv
31
+ uses: "./.github/actions/uv_setup"
32
+ id: setup-python
33
+ with:
34
+ python-version: ${{ inputs.python-version }}
35
+ - name: Install dependencies
36
+ shell: bash
37
+ run: uv sync --group test
38
+
39
+ - name: Run core tests
40
+ shell: bash
41
+ run: |
42
+ make test
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: Run CI Tests
3
+
4
+ on:
5
+ push:
6
+ branches: [ main ]
7
+ pull_request:
8
+ workflow_dispatch: # Allows to trigger the workflow manually in GitHub UI
9
+
10
+ # If another push to the same PR or branch happens while this workflow is still running,
11
+ # cancel the earlier run in favor of the next run.
12
+ #
13
+ # There's no point in testing an outdated version of the code. GitHub only allows
14
+ # a limited number of job runners to be active at the same time, so it's better to cancel
15
+ # pointless jobs early so that more useful jobs can run sooner.
16
+ concurrency:
17
+ group: ${{ github.workflow }}-${{ github.ref }}
18
+ cancel-in-progress: true
19
+
20
+ jobs:
21
+ lint:
22
+ strategy:
23
+ matrix:
24
+ # Only lint on the min and max supported Python versions.
25
+ # It's extremely unlikely that there's a lint issue on any version in between
26
+ # that doesn't show up on the min or max versions.
27
+ #
28
+ # GitHub rate-limits how many jobs can be running at any one time.
29
+ # Starting new jobs is also relatively slow,
30
+ # so linting on fewer versions makes CI faster.
31
+ python-version:
32
+ - "3.12"
33
+ uses:
34
+ ./.github/workflows/_lint.yml
35
+ with:
36
+ working-directory: .
37
+ python-version: ${{ matrix.python-version }}
38
+ secrets: inherit
39
+ test:
40
+ strategy:
41
+ matrix:
42
+ # Only lint on the min and max supported Python versions.
43
+ # It's extremely unlikely that there's a lint issue on any version in between
44
+ # that doesn't show up on the min or max versions.
45
+ #
46
+ # GitHub rate-limits how many jobs can be running at any one time.
47
+ # Starting new jobs is also relatively slow,
48
+ # so linting on fewer versions makes CI faster.
49
+ python-version:
50
+ - "3.10"
51
+ - "3.12"
52
+ uses:
53
+ ./.github/workflows/_test.yml
54
+ with:
55
+ working-directory: .
56
+ python-version: ${{ matrix.python-version }}
57
+ secrets: inherit
@@ -0,0 +1,151 @@
1
+ name: release
2
+ run-name: Release ${{ inputs.working-directory }} by @${{ github.actor }}
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ working-directory:
7
+ required: true
8
+ type: string
9
+ description: "From which folder this pipeline executes"
10
+ workflow_dispatch:
11
+ inputs:
12
+ working-directory:
13
+ description: "From which folder this pipeline executes"
14
+ default: "."
15
+ dangerous-nonmain-release:
16
+ required: false
17
+ type: boolean
18
+ default: false
19
+ description: "Release from a non-main branch (danger!)"
20
+
21
+ env:
22
+ PYTHON_VERSION: "3.11"
23
+ UV_FROZEN: "true"
24
+ UV_NO_SYNC: "true"
25
+
26
+ jobs:
27
+ build:
28
+ if: github.ref == 'refs/heads/main' || inputs.dangerous-nonmain-release
29
+ environment: Scheduled testing
30
+ runs-on: ubuntu-latest
31
+
32
+ outputs:
33
+ pkg-name: ${{ steps.check-version.outputs.pkg-name }}
34
+ version: ${{ steps.check-version.outputs.version }}
35
+
36
+ steps:
37
+ - uses: actions/checkout@v4
38
+
39
+ - name: Set up Python + uv
40
+ uses: "./.github/actions/uv_setup"
41
+ with:
42
+ python-version: ${{ env.PYTHON_VERSION }}
43
+
44
+ # We want to keep this build stage *separate* from the release stage,
45
+ # so that there's no sharing of permissions between them.
46
+ # The release stage has trusted publishing and GitHub repo contents write access,
47
+ # and we want to keep the scope of that access limited just to the release job.
48
+ # Otherwise, a malicious `build` step (e.g. via a compromised dependency)
49
+ # could get access to our GitHub or PyPI credentials.
50
+ #
51
+ # Per the trusted publishing GitHub Action:
52
+ # > It is strongly advised to separate jobs for building [...]
53
+ # > from the publish job.
54
+ # https://github.com/pypa/gh-action-pypi-publish#non-goals
55
+ - name: Build project for distribution
56
+ run: uv build
57
+ - name: Upload build
58
+ uses: actions/upload-artifact@v4
59
+ with:
60
+ name: dist
61
+ path: ${{ inputs.working-directory }}/dist/
62
+
63
+ - name: Check Version
64
+ id: check-version
65
+ shell: python
66
+ working-directory: ${{ inputs.working-directory }}
67
+ run: |
68
+ import os
69
+ import tomllib
70
+ with open("pyproject.toml", "rb") as f:
71
+ data = tomllib.load(f)
72
+ pkg_name = data["project"]["name"]
73
+ version = data["project"]["version"]
74
+ with open(os.environ["GITHUB_OUTPUT"], "a") as f:
75
+ f.write(f"pkg-name={pkg_name}\n")
76
+ f.write(f"version={version}\n")
77
+ publish:
78
+ needs:
79
+ - build
80
+ runs-on: ubuntu-latest
81
+ permissions:
82
+ # This permission is used for trusted publishing:
83
+ # https://blog.pypi.org/posts/2023-04-20-introducing-trusted-publishers/
84
+ #
85
+ # Trusted publishing has to also be configured on PyPI for each package:
86
+ # https://docs.pypi.org/trusted-publishers/adding-a-publisher/
87
+ id-token: write
88
+
89
+ defaults:
90
+ run:
91
+ working-directory: ${{ inputs.working-directory }}
92
+
93
+ steps:
94
+ - uses: actions/checkout@v4
95
+
96
+ - name: Set up Python + uv
97
+ uses: "./.github/actions/uv_setup"
98
+ with:
99
+ python-version: ${{ env.PYTHON_VERSION }}
100
+
101
+ - uses: actions/download-artifact@v4
102
+ with:
103
+ name: dist
104
+ path: ${{ inputs.working-directory }}/dist/
105
+
106
+ - name: Publish package distributions to PyPI
107
+ uses: pypa/gh-action-pypi-publish@release/v1
108
+ with:
109
+ packages-dir: ${{ inputs.working-directory }}/dist/
110
+ verbose: true
111
+ print-hash: true
112
+ # Temp workaround since attestations are on by default as of gh-action-pypi-publish v1.11.0
113
+ attestations: false
114
+
115
+ mark-release:
116
+ needs:
117
+ - build
118
+ - publish
119
+ runs-on: ubuntu-latest
120
+ permissions:
121
+ # This permission is needed by `ncipollo/release-action` to
122
+ # create the GitHub release.
123
+ contents: write
124
+
125
+ defaults:
126
+ run:
127
+ working-directory: ${{ inputs.working-directory }}
128
+
129
+ steps:
130
+ - uses: actions/checkout@v4
131
+
132
+ - name: Set up Python + uv
133
+ uses: "./.github/actions/uv_setup"
134
+ with:
135
+ python-version: ${{ env.PYTHON_VERSION }}
136
+
137
+ - uses: actions/download-artifact@v4
138
+ with:
139
+ name: dist
140
+ path: ${{ inputs.working-directory }}/dist/
141
+
142
+ - name: Create Tag
143
+ uses: ncipollo/release-action@v1
144
+ with:
145
+ artifacts: "dist/*"
146
+ token: ${{ secrets.GITHUB_TOKEN }}
147
+ generateReleaseNotes: true
148
+ tag: ${{needs.build.outputs.pkg-name}}==${{ needs.build.outputs.version }}
149
+ body: ${{ needs.release-notes.outputs.release-body }}
150
+ commit: main
151
+ makeLatest: true
@@ -0,0 +1,147 @@
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
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ *.manifest
31
+ *.spec
32
+
33
+ # Installer logs
34
+ pip-log.txt
35
+ pip-delete-this-directory.txt
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .nox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ *.py,cover
48
+ .hypothesis/
49
+ .pytest_cache/
50
+ .ruff_cache/
51
+ cover/
52
+
53
+ # Translations
54
+ *.mo
55
+ *.pot
56
+
57
+ # Django stuff:
58
+ *.log
59
+ local_settings.py
60
+ db.sqlite3
61
+ db.sqlite3-journal
62
+
63
+ # Flask stuff:
64
+ instance/
65
+ .webassets-cache
66
+
67
+
68
+ # Sphinx documentation
69
+ docs/_build/
70
+
71
+ # PyBuilder
72
+ .pybuilder/
73
+ target/
74
+
75
+ # Jupyter Notebook
76
+ .ipynb_checkpoints
77
+
78
+ # IPython
79
+ profile_default/
80
+ ipython_config.py
81
+
82
+ # pyenv
83
+ .python-version
84
+
85
+ # pipenv
86
+ Pipfile.lock
87
+
88
+ # poetry
89
+ poetry.lock
90
+
91
+ # pdm
92
+ pdm.lock
93
+ .pdm.toml
94
+
95
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
96
+ __pypackages__/
97
+
98
+ # Celery stuff
99
+ celerybeat-schedule
100
+ celerybeat.pid
101
+
102
+ # SageMath parsed files
103
+ *.sage.py
104
+
105
+ # Environments
106
+ .env
107
+ .venv
108
+ env/
109
+ venv/
110
+ ENV/
111
+ env.bak/
112
+ venv.bak/
113
+
114
+ # Spyder project settings
115
+ .spyderproject
116
+ .spyproject
117
+
118
+ # Rope project settings
119
+ .ropeproject
120
+
121
+ # mkdocs documentation
122
+ /site
123
+
124
+ # mypy
125
+ .mypy_cache/
126
+ .dmypy.json
127
+ dmypy.json
128
+
129
+ # Pyre type checker
130
+ .pyre/
131
+
132
+ # pytype static type analyzer
133
+ .pytype/
134
+
135
+ # Cython debug symbols
136
+ cython_debug/
137
+
138
+ # PyCharm
139
+ .idea/
140
+
141
+ # VS Code
142
+ .vscode/
143
+
144
+ # macOS
145
+ .DS_Store
146
+
147
+ dev.ipynb
@@ -0,0 +1,23 @@
1
+ repos:
2
+ - repo: https://github.com/psf/black
3
+ rev: 24.8.0
4
+ hooks:
5
+ - id: black
6
+
7
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
8
+ rev: v0.6.9
9
+ hooks:
10
+ - id: ruff
11
+
12
+ - repo: https://github.com/pycqa/isort
13
+ rev: 5.13.2
14
+ hooks:
15
+ - id: isort
16
+
17
+ - repo: https://github.com/pre-commit/pre-commit-hooks
18
+ rev: v4.6.0
19
+ hooks:
20
+ - id: trailing-whitespace
21
+ - id: end-of-file-fixer
22
+ - id: check-yaml
23
+ exclude: mkdocs.yml