arcade-core 2.0.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.
@@ -0,0 +1,175 @@
1
+ .DS_Store
2
+ credentials.yaml
3
+ docker/credentials.yaml
4
+
5
+ *.lock
6
+
7
+ # example data
8
+ examples/data
9
+ scratch
10
+
11
+
12
+ docs/source
13
+
14
+ # From https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore
15
+
16
+ # Byte-compiled / optimized / DLL files
17
+ __pycache__/
18
+ *.py[cod]
19
+ *$py.class
20
+
21
+ # C extensions
22
+ *.so
23
+
24
+ # Distribution / packaging
25
+ .Python
26
+ build/
27
+ develop-eggs/
28
+ dist/
29
+ downloads/
30
+ eggs/
31
+ .eggs/
32
+ lib/
33
+ lib64/
34
+ parts/
35
+ sdist/
36
+ var/
37
+ wheels/
38
+ share/python-wheels/
39
+ *.egg-info/
40
+ .installed.cfg
41
+ *.egg
42
+ MANIFEST
43
+
44
+ # PyInstaller
45
+ # Usually these files are written by a python script from a template
46
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
47
+ *.manifest
48
+ *.spec
49
+
50
+ # Installer logs
51
+ pip-log.txt
52
+ pip-delete-this-directory.txt
53
+
54
+ # Unit test / coverage reports
55
+ htmlcov/
56
+ .tox/
57
+ .nox/
58
+ .coverage
59
+ .coverage.*
60
+ .cache
61
+ nosetests.xml
62
+ coverage.xml
63
+ *.cover
64
+ *.py,cover
65
+ .hypothesis/
66
+ .pytest_cache/
67
+ cover/
68
+
69
+ # Translations
70
+ *.mo
71
+ *.pot
72
+
73
+ # Django stuff:
74
+ *.log
75
+ local_settings.py
76
+ db.sqlite3
77
+ db.sqlite3-journal
78
+
79
+ # Flask stuff:
80
+ instance/
81
+ .webassets-cache
82
+
83
+ # Scrapy stuff:
84
+ .scrapy
85
+
86
+ # Sphinx documentation
87
+ docs/_build/
88
+
89
+ # PyBuilder
90
+ .pybuilder/
91
+ target/
92
+
93
+ # Jupyter Notebook
94
+ .ipynb_checkpoints
95
+
96
+ # IPython
97
+ profile_default/
98
+ ipython_config.py
99
+
100
+ # pyenv
101
+ # For a library or package, you might want to ignore these files since the code is
102
+ # intended to run in multiple environments; otherwise, check them in:
103
+ # .python-version
104
+
105
+ # pipenv
106
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
107
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
108
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
109
+ # install all needed dependencies.
110
+ #Pipfile.lock
111
+
112
+ # poetry
113
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
114
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
115
+ # commonly ignored for libraries.
116
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
117
+ poetry.lock
118
+
119
+ # pdm
120
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
121
+ #pdm.lock
122
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
123
+ # in version control.
124
+ # https://pdm.fming.dev/#use-with-ide
125
+ .pdm.toml
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .venv
140
+ env/
141
+ venv/
142
+ ENV/
143
+ env.bak/
144
+ venv.bak/
145
+
146
+ # Spyder project settings
147
+ .spyderproject
148
+ .spyproject
149
+
150
+ # Rope project settings
151
+ .ropeproject
152
+
153
+ # mkdocs documentation
154
+ /site
155
+
156
+ # mypy
157
+ .mypy_cache/
158
+ .dmypy.json
159
+ dmypy.json
160
+
161
+ # Pyre type checker
162
+ .pyre/
163
+
164
+ # pytype static type analyzer
165
+ .pytype/
166
+
167
+ # Cython debug symbols
168
+ cython_debug/
169
+
170
+ # PyCharm
171
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
172
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
173
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
174
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
175
+ #.idea/
@@ -0,0 +1,77 @@
1
+ Metadata-Version: 2.4
2
+ Name: arcade-core
3
+ Version: 2.0.0
4
+ Summary: Arcade Core - Core library for Arcade platform
5
+ Author-email: Arcade <dev@arcade.dev>
6
+ License: MIT
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: loguru>=0.7.0
17
+ Requires-Dist: opentelemetry-exporter-otlp-proto-common==1.28.2
18
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http==1.28.2
19
+ Requires-Dist: opentelemetry-instrumentation-fastapi==0.49b2
20
+ Requires-Dist: packaging>=24.1
21
+ Requires-Dist: pydantic>=2.7.0
22
+ Requires-Dist: pyjwt>=2.8.0
23
+ Requires-Dist: pyyaml>=6.0
24
+ Requires-Dist: toml>=0.10.2
25
+ Requires-Dist: types-python-dateutil==2.9.0.20241003
26
+ Requires-Dist: types-pytz==2024.2.0.20241003
27
+ Requires-Dist: types-toml==0.10.8.20240310
28
+ Provides-Extra: dev
29
+ Requires-Dist: mypy>=1.5.1; extra == 'dev'
30
+ Requires-Dist: pre-commit>=3.4.0; extra == 'dev'
31
+ Requires-Dist: pytest-asyncio>=0.23.7; extra == 'dev'
32
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
33
+ Requires-Dist: pytest>=8.1.2; extra == 'dev'
34
+ Requires-Dist: types-python-dateutil>=2.8.2; extra == 'dev'
35
+ Requires-Dist: types-pytz>=2024.1; extra == 'dev'
36
+ Requires-Dist: types-pyyaml>=6.0.0; extra == 'dev'
37
+ Description-Content-Type: text/markdown
38
+
39
+ # Arcade Core
40
+
41
+ Core library for the Arcade platform providing foundational components and utilities.
42
+
43
+ ## Overview
44
+
45
+ Arcade Core provides the essential building blocks for the Arcade platform:
46
+
47
+ - **Tool Catalog & Toolkit Management**: Core classes for managing and organizing tools
48
+ - **Configuration & Schema Handling**: Configuration management and validation
49
+ - **Authentication & Authorization**: Auth providers and security utilities
50
+ - **Error Handling**: Comprehensive error types and handling
51
+ - **Telemetry & Observability**: Monitoring and tracing capabilities
52
+ - **Utilities**: Common helper functions and validators
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ pip install arcade-core
58
+ ```
59
+
60
+ ## Usage
61
+
62
+ ```python
63
+ from arcade_core import ToolCatalog, Toolkit, ArcadeConfig
64
+
65
+ # Create a tool catalog
66
+ catalog = ToolCatalog()
67
+
68
+ # Load a toolkit
69
+ toolkit = Toolkit.from_directory("path/to/toolkit")
70
+
71
+ # Configure Arcade
72
+ config = ArcadeConfig.from_file("config.yaml")
73
+ ```
74
+
75
+ ## License
76
+
77
+ MIT License - see LICENSE file for details.
@@ -0,0 +1,39 @@
1
+ # Arcade Core
2
+
3
+ Core library for the Arcade platform providing foundational components and utilities.
4
+
5
+ ## Overview
6
+
7
+ Arcade Core provides the essential building blocks for the Arcade platform:
8
+
9
+ - **Tool Catalog & Toolkit Management**: Core classes for managing and organizing tools
10
+ - **Configuration & Schema Handling**: Configuration management and validation
11
+ - **Authentication & Authorization**: Auth providers and security utilities
12
+ - **Error Handling**: Comprehensive error types and handling
13
+ - **Telemetry & Observability**: Monitoring and tracing capabilities
14
+ - **Utilities**: Common helper functions and validators
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ pip install arcade-core
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ```python
25
+ from arcade_core import ToolCatalog, Toolkit, ArcadeConfig
26
+
27
+ # Create a tool catalog
28
+ catalog = ToolCatalog()
29
+
30
+ # Load a toolkit
31
+ toolkit = Toolkit.from_directory("path/to/toolkit")
32
+
33
+ # Configure Arcade
34
+ config = ArcadeConfig.from_file("config.yaml")
35
+ ```
36
+
37
+ ## License
38
+
39
+ MIT License - see LICENSE file for details.
@@ -0,0 +1,2 @@
1
+ from .catalog import ToolCatalog as ToolCatalog
2
+ from .toolkit import Toolkit as Toolkit
@@ -0,0 +1,8 @@
1
+ from dataclasses import dataclass
2
+
3
+
4
+ @dataclass(frozen=True)
5
+ class Inferrable:
6
+ """An annotation indicating that a parameter can be inferred by a model (default: True)."""
7
+
8
+ value: bool = True
@@ -0,0 +1,177 @@
1
+ from enum import Enum
2
+ from typing import Optional
3
+
4
+ from pydantic import BaseModel, ConfigDict
5
+
6
+
7
+ class AuthProviderType(str, Enum):
8
+ oauth2 = "oauth2"
9
+
10
+
11
+ class ToolAuthorization(BaseModel):
12
+ """Marks a tool as requiring authorization."""
13
+
14
+ model_config = ConfigDict(frozen=True)
15
+
16
+ provider_id: Optional[str] = None
17
+ """The provider ID configured in Arcade that acts as an alias to well-known configuration."""
18
+
19
+ provider_type: AuthProviderType
20
+ """The type of the authorization provider."""
21
+
22
+ id: Optional[str] = None
23
+ """A provider's unique identifier, allowing the tool to specify a specific authorization provider. Recommended for private tools only."""
24
+
25
+ scopes: Optional[list[str]] = None
26
+ """The scope(s) needed for the authorized action."""
27
+
28
+
29
+ class OAuth2(ToolAuthorization):
30
+ """Marks a tool as requiring OAuth 2.0 authorization."""
31
+
32
+ def __init__(self, *, id: str | None, scopes: Optional[list[str]] = None): # noqa: A002
33
+ super().__init__(id=id, scopes=scopes, provider_type=AuthProviderType.oauth2)
34
+
35
+
36
+ class Asana(OAuth2):
37
+ """Marks a tool as requiring Asana authorization."""
38
+
39
+ provider_id: str = "asana"
40
+
41
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
42
+ super().__init__(id=id, scopes=scopes)
43
+
44
+
45
+ class Atlassian(OAuth2):
46
+ """Marks a tool as requiring Atlassian authorization."""
47
+
48
+ provider_id: str = "atlassian"
49
+
50
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
51
+ super().__init__(id=id, scopes=scopes)
52
+
53
+
54
+ class Discord(OAuth2):
55
+ """Marks a tool as requiring Discord authorization."""
56
+
57
+ provider_id: str = "discord"
58
+
59
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
60
+ super().__init__(id=id, scopes=scopes)
61
+
62
+
63
+ class Dropbox(OAuth2):
64
+ """Marks a tool as requiring Dropbox authorization."""
65
+
66
+ provider_id: str = "dropbox"
67
+
68
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
69
+ super().__init__(id=id, scopes=scopes)
70
+
71
+
72
+ class GitHub(OAuth2):
73
+ """Marks a tool as requiring GitHub App authorization."""
74
+
75
+ provider_id: str = "github"
76
+
77
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
78
+ super().__init__(id=id, scopes=scopes)
79
+
80
+
81
+ class Google(OAuth2):
82
+ """Marks a tool as requiring Google authorization."""
83
+
84
+ provider_id: str = "google"
85
+
86
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
87
+ super().__init__(id=id, scopes=scopes)
88
+
89
+
90
+ class Hubspot(OAuth2):
91
+ """Marks a tool as requiring Hubspot authorization."""
92
+
93
+ provider_id: str = "hubspot"
94
+
95
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
96
+ super().__init__(id=id, scopes=scopes)
97
+
98
+
99
+ class LinkedIn(OAuth2):
100
+ """Marks a tool as requiring LinkedIn authorization."""
101
+
102
+ provider_id: str = "linkedin"
103
+
104
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
105
+ super().__init__(id=id, scopes=scopes)
106
+
107
+
108
+ class Microsoft(OAuth2):
109
+ """Marks a tool as requiring Microsoft authorization."""
110
+
111
+ provider_id: str = "microsoft"
112
+
113
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
114
+ super().__init__(id=id, scopes=scopes)
115
+
116
+
117
+ class Notion(OAuth2):
118
+ """Marks a tool as requiring Notion authorization."""
119
+
120
+ provider_id: str = "notion"
121
+
122
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
123
+ super().__init__(id=id, scopes=scopes)
124
+
125
+
126
+ class Reddit(OAuth2):
127
+ """Marks a tool as requiring Reddit authorization."""
128
+
129
+ provider_id: str = "reddit"
130
+
131
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
132
+ super().__init__(id=id, scopes=scopes)
133
+
134
+
135
+ class Slack(OAuth2):
136
+ """Marks a tool as requiring Slack (user token) authorization."""
137
+
138
+ provider_id: str = "slack"
139
+
140
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
141
+ super().__init__(id=id, scopes=scopes)
142
+
143
+
144
+ class Spotify(OAuth2):
145
+ """Marks a tool as requiring Spotify authorization."""
146
+
147
+ provider_id: str = "spotify"
148
+
149
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
150
+ super().__init__(id=id, scopes=scopes)
151
+
152
+
153
+ class Twitch(OAuth2):
154
+ """Marks a tool as requiring Twitch authorization."""
155
+
156
+ provider_id: str = "twitch"
157
+
158
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
159
+ super().__init__(id=id, scopes=scopes)
160
+
161
+
162
+ class X(OAuth2):
163
+ """Marks a tool as requiring X (Twitter) authorization."""
164
+
165
+ provider_id: str = "x"
166
+
167
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
168
+ super().__init__(id=id, scopes=scopes)
169
+
170
+
171
+ class Zoom(OAuth2):
172
+ """Marks a tool as requiring Zoom authorization."""
173
+
174
+ provider_id: str = "zoom"
175
+
176
+ def __init__(self, *, id: Optional[str] = None, scopes: Optional[list[str]] = None): # noqa: A002
177
+ super().__init__(id=id, scopes=scopes)