prefect-github 0.2.7__tar.gz → 0.3.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 (51) hide show
  1. {prefect_github-0.2.7/prefect_github.egg-info → prefect_github-0.3.0}/PKG-INFO +6 -7
  2. {prefect_github-0.2.7 → prefect_github-0.3.0}/README.md +2 -2
  3. prefect_github-0.3.0/prefect_github/__init__.py +8 -0
  4. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/_version.py +2 -2
  5. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/credentials.py +4 -40
  6. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/graphql.py +2 -0
  7. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/mutations.py +25 -25
  8. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/organization.py +156 -156
  9. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/repository.py +195 -220
  10. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/repository_owner.py +14 -14
  11. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/user.py +191 -191
  12. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/viewer.py +191 -191
  13. {prefect_github-0.2.7 → prefect_github-0.3.0/prefect_github.egg-info}/PKG-INFO +6 -7
  14. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github.egg-info/requires.txt +2 -4
  15. {prefect_github-0.2.7 → prefect_github-0.3.0}/pyproject.toml +10 -5
  16. {prefect_github-0.2.7 → prefect_github-0.3.0}/tests/conftest.py +0 -11
  17. {prefect_github-0.2.7 → prefect_github-0.3.0}/tests/test_credentials.py +0 -8
  18. {prefect_github-0.2.7 → prefect_github-0.3.0}/tests/test_repository.py +3 -32
  19. prefect_github-0.2.7/prefect_github/__init__.py +0 -5
  20. {prefect_github-0.2.7 → prefect_github-0.3.0}/LICENSE +0 -0
  21. {prefect_github-0.2.7 → prefect_github-0.3.0}/MANIFEST.in +0 -0
  22. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/mutation/add_comment.json +0 -0
  23. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/mutation/add_pull_request_review.json +0 -0
  24. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/mutation/add_reaction.json +0 -0
  25. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/mutation/add_star.json +0 -0
  26. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/mutation/close_issue.json +0 -0
  27. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/mutation/close_pull_request.json +0 -0
  28. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/mutation/create_issue.json +0 -0
  29. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/mutation/create_pull_request.json +0 -0
  30. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/mutation/remove_reaction.json +0 -0
  31. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/mutation/remove_star.json +0 -0
  32. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/mutation/request_reviews.json +0 -0
  33. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/query/organization.json +0 -0
  34. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/query/repository.json +0 -0
  35. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/query/repository_owner.json +0 -0
  36. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/query/user.json +0 -0
  37. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/configs/query/viewer.json +0 -0
  38. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/exceptions.py +0 -0
  39. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/schemas/__init__.py +0 -0
  40. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/schemas/graphql_schema.json +0 -0
  41. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/schemas/graphql_schema.py +0 -0
  42. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github/utils.py +0 -0
  43. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github.egg-info/SOURCES.txt +0 -0
  44. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github.egg-info/dependency_links.txt +0 -0
  45. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github.egg-info/entry_points.txt +0 -0
  46. {prefect_github-0.2.7 → prefect_github-0.3.0}/prefect_github.egg-info/top_level.txt +0 -0
  47. {prefect_github-0.2.7 → prefect_github-0.3.0}/setup.cfg +0 -0
  48. {prefect_github-0.2.7 → prefect_github-0.3.0}/tests/test_block_standards.py +0 -0
  49. {prefect_github-0.2.7 → prefect_github-0.3.0}/tests/test_graphql.py +0 -0
  50. {prefect_github-0.2.7 → prefect_github-0.3.0}/tests/test_utils.py +0 -0
  51. {prefect_github-0.2.7 → prefect_github-0.3.0}/tests/test_version.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: prefect-github
3
- Version: 0.2.7
3
+ Version: 0.3.0
4
4
  Summary: Prefect integrations interacting with GitHub
5
5
  Author-email: "Prefect Technologies, Inc." <help@prefect.io>
6
6
  License: Apache License 2.0
@@ -11,17 +11,16 @@ Classifier: Intended Audience :: Developers
11
11
  Classifier: Intended Audience :: System Administrators
12
12
  Classifier: License :: OSI Approved :: Apache Software License
13
13
  Classifier: Programming Language :: Python :: 3 :: Only
14
- Classifier: Programming Language :: Python :: 3.8
15
14
  Classifier: Programming Language :: Python :: 3.9
16
15
  Classifier: Programming Language :: Python :: 3.10
17
16
  Classifier: Programming Language :: Python :: 3.11
18
17
  Classifier: Programming Language :: Python :: 3.12
19
18
  Classifier: Topic :: Software Development :: Libraries
20
- Requires-Python: >=3.8
19
+ Requires-Python: >=3.9
21
20
  Description-Content-Type: text/markdown
22
21
  License-File: LICENSE
23
22
  Requires-Dist: sgqlc>=15.0
24
- Requires-Dist: prefect<3.0.0,>=2.20.0
23
+ Requires-Dist: prefect>=3.0.0rc1
25
24
  Provides-Extra: dev
26
25
  Requires-Dist: coverage; extra == "dev"
27
26
  Requires-Dist: interrogate; extra == "dev"
@@ -29,16 +28,16 @@ Requires-Dist: mkdocs-gen-files; extra == "dev"
29
28
  Requires-Dist: mkdocs-material; extra == "dev"
30
29
  Requires-Dist: mkdocs; extra == "dev"
31
30
  Requires-Dist: mkdocstrings[python]; extra == "dev"
32
- Requires-Dist: mock; python_version < "3.8" and extra == "dev"
33
31
  Requires-Dist: mypy; extra == "dev"
34
32
  Requires-Dist: pillow; extra == "dev"
35
33
  Requires-Dist: pre-commit; extra == "dev"
36
34
  Requires-Dist: pytest-asyncio; extra == "dev"
37
35
  Requires-Dist: pytest; extra == "dev"
36
+ Requires-Dist: pytest-env; extra == "dev"
38
37
  Requires-Dist: pytest-xdist; extra == "dev"
39
38
 
40
39
  # prefect-github
41
-
40
+
42
41
  <p align="center">
43
42
  <a href="https://pypi.python.org/pypi/prefect-github/" alt="PyPI version">
44
43
  <img alt="PyPI" src="https://img.shields.io/pypi/v/prefect-github?color=26272B&labelColor=090422"></a>
@@ -56,7 +55,7 @@ The tasks within this collection were created by a code generator using the GitH
56
55
 
57
56
  ### Python setup
58
57
 
59
- Requires an installation of Python 3.8 or newer.
58
+ Requires an installation of Python 3.9 or newer.
60
59
 
61
60
  We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.
62
61
 
@@ -1,5 +1,5 @@
1
1
  # prefect-github
2
-
2
+
3
3
  <p align="center">
4
4
  <a href="https://pypi.python.org/pypi/prefect-github/" alt="PyPI version">
5
5
  <img alt="PyPI" src="https://img.shields.io/pypi/v/prefect-github?color=26272B&labelColor=090422"></a>
@@ -17,7 +17,7 @@ The tasks within this collection were created by a code generator using the GitH
17
17
 
18
18
  ### Python setup
19
19
 
20
- Requires an installation of Python 3.8 or newer.
20
+ Requires an installation of Python 3.9 or newer.
21
21
 
22
22
  We recommend using a Python virtual environment manager such as pipenv, conda or virtualenv.
23
23
 
@@ -0,0 +1,8 @@
1
+ # pyright: reportPrivateUsage=false
2
+ from . import _version
3
+ from .credentials import GitHubCredentials # noqa
4
+ from .repository import GitHubRepository # noqa
5
+
6
+ __all__ = ["GitHubCredentials", "GitHubRepository"]
7
+
8
+ __version__ = getattr(_version, "__version__")
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.2.7'
16
- __version_tuple__ = version_tuple = (0, 2, 7)
15
+ __version__ = version = '0.3.0'
16
+ __version_tuple__ = version_tuple = (0, 3, 0)
@@ -1,18 +1,12 @@
1
1
  """Credential classes used to perform authenticated interactions with GitHub"""
2
2
 
3
- import warnings
3
+ from typing import Optional
4
4
 
5
- from pydantic import VERSION as PYDANTIC_VERSION
5
+ from pydantic import Field, SecretStr
6
+ from sgqlc.endpoint.http import HTTPEndpoint
6
7
 
7
8
  from prefect.blocks.abstract import CredentialsBlock
8
9
 
9
- if PYDANTIC_VERSION.startswith("2."):
10
- from pydantic.v1 import Field, SecretStr
11
- else:
12
- from pydantic import Field, SecretStr
13
-
14
- from sgqlc.endpoint.http import HTTPEndpoint
15
-
16
10
 
17
11
  class GitHubCredentials(CredentialsBlock):
18
12
  """
@@ -33,7 +27,7 @@ class GitHubCredentials(CredentialsBlock):
33
27
  _logo_url = "https://cdn.sanity.io/images/3ugk85nk/production/41971cfecfea5f79ff334164f06ecb34d1038dd4-250x250.png" # noqa
34
28
  _documentation_url = "https://prefecthq.github.io/prefect-github/credentials/#prefect_github.credentials.GitHubCredentials" # noqa
35
29
 
36
- token: SecretStr = Field(
30
+ token: Optional[SecretStr] = Field(
37
31
  default=None, description="A GitHub personal access token (PAT)."
38
32
  )
39
33
 
@@ -63,33 +57,3 @@ class GitHubCredentials(CredentialsBlock):
63
57
  "https://api.github.com/graphql", base_headers=base_headers
64
58
  )
65
59
  return endpoint
66
-
67
- def get_endpoint(self) -> HTTPEndpoint:
68
- """
69
- Gets an authenticated GitHub GraphQL HTTPEndpoint.
70
-
71
- Returns:
72
- An authenticated GitHub GraphQL HTTPEndpoint
73
-
74
- Example:
75
- Gets an authenticated GitHub GraphQL HTTPEndpoint.
76
- ```python
77
- from prefect import flow
78
- from prefect_github import GitHubCredentials
79
-
80
- @flow
81
- def example_get_endpoint_flow():
82
- token = "token_xxxxxxx"
83
- github_credentials = GitHubCredentials(token=token)
84
- endpoint = github_credentials.get_endpoint()
85
- return endpoint
86
-
87
- example_get_endpoint_flow()
88
- ```
89
- """
90
- warnings.warn(
91
- "`get_endpoint` is deprecated and will be removed March 31st, 2023, "
92
- "use `get_client` instead.",
93
- DeprecationWarning,
94
- )
95
- return self.get_client()
@@ -13,6 +13,7 @@ from anyio import to_thread
13
13
  from sgqlc.operation import Operation, Selection
14
14
 
15
15
  from prefect import task
16
+ from prefect.utilities.asyncutils import sync_compatible
16
17
  from prefect_github import GitHubCredentials
17
18
  from prefect_github.utils import camel_to_snake_case
18
19
 
@@ -61,6 +62,7 @@ def _subset_return_fields(
61
62
 
62
63
 
63
64
  @task
65
+ @sync_compatible
64
66
  async def execute_graphql(
65
67
  op: Union[Operation, str],
66
68
  github_credentials: GitHubCredentials,
@@ -10,7 +10,7 @@ GitHub mutation tasks
10
10
 
11
11
  from datetime import datetime
12
12
  from pathlib import Path
13
- from typing import Any, Dict, Iterable
13
+ from typing import Any, Dict, Iterable, Optional
14
14
 
15
15
  from sgqlc.operation import Operation
16
16
 
@@ -31,7 +31,7 @@ async def add_comment_subject( # noqa
31
31
  subject_id: str,
32
32
  body: str,
33
33
  github_credentials: GitHubCredentials,
34
- return_fields: Iterable[str] = None,
34
+ return_fields: Optional[Iterable[str]] = None,
35
35
  ) -> Dict[str, Any]: # pragma: no cover
36
36
  """
37
37
  Adds a comment to an Issue or Pull Request.
@@ -75,10 +75,10 @@ async def create_pull_request( # noqa
75
75
  head_ref_name: str,
76
76
  title: str,
77
77
  github_credentials: GitHubCredentials,
78
- body: str = None,
79
- maintainer_can_modify: bool = None,
80
- draft: bool = None,
81
- return_fields: Iterable[str] = None,
78
+ body: Optional[str] = None,
79
+ maintainer_can_modify: Optional[bool] = None,
80
+ draft: Optional[bool] = None,
81
+ return_fields: Optional[Iterable[str]] = None,
82
82
  ) -> Dict[str, Any]: # pragma: no cover
83
83
  """
84
84
  Create a new pull request.
@@ -136,7 +136,7 @@ async def create_pull_request( # noqa
136
136
  async def close_pull_request( # noqa
137
137
  pull_request_id: str,
138
138
  github_credentials: GitHubCredentials,
139
- return_fields: Iterable[str] = None,
139
+ return_fields: Optional[Iterable[str]] = None,
140
140
  ) -> Dict[str, Any]: # pragma: no cover
141
141
  """
142
142
  Close a pull request.
@@ -179,10 +179,10 @@ async def create_issue( # noqa
179
179
  label_ids: Iterable[str],
180
180
  project_ids: Iterable[str],
181
181
  github_credentials: GitHubCredentials,
182
- body: str = None,
183
- milestone_id: str = None,
184
- issue_template: str = None,
185
- return_fields: Iterable[str] = None,
182
+ body: Optional[str] = None,
183
+ milestone_id: Optional[str] = None,
184
+ issue_template: Optional[str] = None,
185
+ return_fields: Optional[Iterable[str]] = None,
186
186
  ) -> Dict[str, Any]: # pragma: no cover
187
187
  """
188
188
  Creates a new issue.
@@ -238,7 +238,7 @@ async def close_issue( # noqa
238
238
  issue_id: str,
239
239
  github_credentials: GitHubCredentials,
240
240
  state_reason: graphql_schema.IssueClosedStateReason = None,
241
- return_fields: Iterable[str] = None,
241
+ return_fields: Optional[Iterable[str]] = None,
242
242
  ) -> Dict[str, Any]: # pragma: no cover
243
243
  """
244
244
  Close an issue.
@@ -279,7 +279,7 @@ async def close_issue( # noqa
279
279
  async def add_star_starrable( # noqa
280
280
  starrable_id: str,
281
281
  github_credentials: GitHubCredentials,
282
- return_fields: Iterable[str] = None,
282
+ return_fields: Optional[Iterable[str]] = None,
283
283
  ) -> Dict[str, Any]: # pragma: no cover
284
284
  """
285
285
  Adds a star to a Starrable.
@@ -318,7 +318,7 @@ async def add_star_starrable( # noqa
318
318
  async def remove_star_starrable( # noqa
319
319
  starrable_id: str,
320
320
  github_credentials: GitHubCredentials,
321
- return_fields: Iterable[str] = None,
321
+ return_fields: Optional[Iterable[str]] = None,
322
322
  ) -> Dict[str, Any]: # pragma: no cover
323
323
  """
324
324
  Removes a star from a Starrable.
@@ -358,7 +358,7 @@ async def add_reaction_subject( # noqa
358
358
  subject_id: str,
359
359
  content: graphql_schema.ReactionContent,
360
360
  github_credentials: GitHubCredentials,
361
- return_fields: Iterable[str] = None,
361
+ return_fields: Optional[Iterable[str]] = None,
362
362
  ) -> Dict[str, Any]: # pragma: no cover
363
363
  """
364
364
  Adds a reaction to a subject.
@@ -400,7 +400,7 @@ async def add_reaction( # noqa
400
400
  subject_id: str,
401
401
  content: graphql_schema.ReactionContent,
402
402
  github_credentials: GitHubCredentials,
403
- return_fields: Iterable[str] = None,
403
+ return_fields: Optional[Iterable[str]] = None,
404
404
  ) -> Dict[str, Any]: # pragma: no cover
405
405
  """
406
406
  Adds a reaction to a subject.
@@ -442,7 +442,7 @@ async def remove_reaction_subject( # noqa
442
442
  subject_id: str,
443
443
  content: graphql_schema.ReactionContent,
444
444
  github_credentials: GitHubCredentials,
445
- return_fields: Iterable[str] = None,
445
+ return_fields: Optional[Iterable[str]] = None,
446
446
  ) -> Dict[str, Any]: # pragma: no cover
447
447
  """
448
448
  Removes a reaction from a subject.
@@ -484,7 +484,7 @@ async def remove_reaction( # noqa
484
484
  subject_id: str,
485
485
  content: graphql_schema.ReactionContent,
486
486
  github_credentials: GitHubCredentials,
487
- return_fields: Iterable[str] = None,
487
+ return_fields: Optional[Iterable[str]] = None,
488
488
  ) -> Dict[str, Any]: # pragma: no cover
489
489
  """
490
490
  Removes a reaction from a subject.
@@ -527,8 +527,8 @@ async def request_reviews( # noqa
527
527
  user_ids: Iterable[str],
528
528
  team_ids: Iterable[str],
529
529
  github_credentials: GitHubCredentials,
530
- union: bool = None,
531
- return_fields: Iterable[str] = None,
530
+ union: Optional[bool] = None,
531
+ return_fields: Optional[Iterable[str]] = None,
532
532
  ) -> Dict[str, Any]: # pragma: no cover
533
533
  """
534
534
  Set review requests on a pull request.
@@ -572,8 +572,8 @@ async def request_reviews_pull_request( # noqa
572
572
  user_ids: Iterable[str],
573
573
  team_ids: Iterable[str],
574
574
  github_credentials: GitHubCredentials,
575
- union: bool = None,
576
- return_fields: Iterable[str] = None,
575
+ union: Optional[bool] = None,
576
+ return_fields: Optional[Iterable[str]] = None,
577
577
  ) -> Dict[str, Any]: # pragma: no cover
578
578
  """
579
579
  Set review requests on a pull request.
@@ -618,12 +618,12 @@ async def request_reviews_pull_request( # noqa
618
618
  async def add_pull_request_review( # noqa
619
619
  pull_request_id: str,
620
620
  github_credentials: GitHubCredentials,
621
- commit_oid: datetime = None,
622
- body: str = None,
621
+ commit_oid: Optional[datetime] = None,
622
+ body: Optional[str] = None,
623
623
  event: graphql_schema.PullRequestReviewEvent = None,
624
624
  comments: Iterable[graphql_schema.DraftPullRequestReviewComment] = None,
625
625
  threads: Iterable[graphql_schema.DraftPullRequestReviewThread] = None,
626
- return_fields: Iterable[str] = None,
626
+ return_fields: Optional[Iterable[str]] = None,
627
627
  ) -> Dict[str, Any]: # pragma: no cover
628
628
  """
629
629
  Adds a review to a Pull Request.