rooster 0.0.10a1__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,53 @@
1
+ Metadata-Version: 2.3
2
+ Name: rooster
3
+ Version: 0.0.10a1
4
+ Summary:
5
+ Author: Zanie
6
+ Author-email: Zanie <contact@zanie.dev>
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Environment :: Plugins
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Natural Language :: English
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.7
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Topic :: Software Development :: Libraries
21
+ Classifier: Topic :: Software Development
22
+ Classifier: Typing :: Typed
23
+ Requires-Dist: typer>=0.15.0
24
+ Requires-Dist: packaging>=23.1
25
+ Requires-Dist: pygit2>=1.13.1
26
+ Requires-Dist: httpx>=0.25.0
27
+ Requires-Dist: tqdm>=4.66.1
28
+ Requires-Dist: hishel>=0.0.24
29
+ Requires-Dist: pydantic>=2.4.2
30
+ Requires-Dist: marko>=2.0.2
31
+ Description-Content-Type: text/markdown
32
+
33
+ # Rooster
34
+
35
+ **This interface provided by this tool is unstable, we highly recommend pinning your version.**
36
+
37
+ ## Usage
38
+
39
+ ### Prepare a new release
40
+
41
+ Prepares a new release, which:
42
+
43
+ - Determines a new version number
44
+ - Generates a changelog entry for the release and adds to `CHANGELOG.md`
45
+ - Updates the version number in `pyproject.toml`
46
+
47
+ ```
48
+ rooster release [<path>] [--bump major|minor|patch]
49
+ ```
50
+
51
+ ### Caching
52
+
53
+ Rooster caches responses from the GitHub GraphQL API in `$PWD/.cache`. You may disable this behavior with `ROOSTER_NO_CACHE=1`.
@@ -0,0 +1,21 @@
1
+ # Rooster
2
+
3
+ **This interface provided by this tool is unstable, we highly recommend pinning your version.**
4
+
5
+ ## Usage
6
+
7
+ ### Prepare a new release
8
+
9
+ Prepares a new release, which:
10
+
11
+ - Determines a new version number
12
+ - Generates a changelog entry for the release and adds to `CHANGELOG.md`
13
+ - Updates the version number in `pyproject.toml`
14
+
15
+ ```
16
+ rooster release [<path>] [--bump major|minor|patch]
17
+ ```
18
+
19
+ ### Caching
20
+
21
+ Rooster caches responses from the GitHub GraphQL API in `$PWD/.cache`. You may disable this behavior with `ROOSTER_NO_CACHE=1`.
@@ -0,0 +1,75 @@
1
+ [project]
2
+ name = "rooster"
3
+ version = "0.0.10a1"
4
+ description = ""
5
+ authors = [{name = "Zanie", email = "contact@zanie.dev"}]
6
+ readme = "README.md"
7
+ repository = "https://github.com/zanieb/rooster"
8
+ classifiers = [
9
+ "Development Status :: 3 - Alpha",
10
+ "Operating System :: OS Independent",
11
+ "Environment :: Plugins",
12
+ "Intended Audience :: Developers",
13
+ "License :: OSI Approved :: MIT License",
14
+ "Natural Language :: English",
15
+ "Programming Language :: Python",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.7",
18
+ "Programming Language :: Python :: 3.8",
19
+ "Programming Language :: Python :: 3.9",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Topic :: Software Development :: Libraries",
23
+ "Topic :: Software Development",
24
+ "Typing :: Typed",
25
+ ]
26
+ dependencies = [
27
+ "typer>=0.15.0",
28
+ "packaging>=23.1",
29
+ "pygit2>=1.13.1",
30
+ "httpx>=0.25.0",
31
+ "tqdm>=4.66.1",
32
+ "hishel>=0.0.24",
33
+ "pydantic>=2.4.2",
34
+ "marko>=2.0.2",
35
+ ]
36
+
37
+ [project.scripts]
38
+ rooster = "rooster:app"
39
+
40
+ [dependency-groups]
41
+ dev = [
42
+ "mypy>=0.971",
43
+ "ruff>=0.0.287",
44
+ "pytest>=7.4.2",
45
+ "inline-snapshot>=0.23.0",
46
+ ]
47
+
48
+ [build-system]
49
+ requires = ["uv_build>=0.6.16,<0.8"]
50
+ build-backend = "uv_build"
51
+
52
+ [tool.uv.build-backend]
53
+ module-name = "rooster"
54
+
55
+ [tool.ruff.lint]
56
+ extend-select = ["I"]
57
+
58
+ # Ignore line length; the formatter handles it
59
+ ignore = ["E501"]
60
+
61
+ # Ignore some codes that break due to pytest fixtures in tests
62
+ per-file-ignores = { "tests/**/*.py" = ["F401", "F811"] }
63
+
64
+ [tool.rooster]
65
+ major_labels = [] # We do not use the major version number
66
+ minor_labels = [] # We will bump on breaking changes here once more stable
67
+ changelog_ignore_labels = ["internal"]
68
+ changelog_sections.breaking = "Breaking changes"
69
+ changelog_sections.enhancement = "Enhancements"
70
+ changelog_sections.cli = "CLI"
71
+ changelog_sections.configuration = "Configuration"
72
+ changelog_sections.bug = "Bug fixes"
73
+ changelog_sections.documentation = "Documentation"
74
+ changelog_sections.__unknown__ = "Other changes"
75
+ changelog_contributors = false
@@ -0,0 +1 @@
1
+ from ._cli import app as app
@@ -0,0 +1,4 @@
1
+ from rooster import app
2
+
3
+ if __name__ == "__main__":
4
+ app()
@@ -0,0 +1,45 @@
1
+ import contextlib
2
+ import os
3
+
4
+ import hishel
5
+ import httpx
6
+ from httpcore import Request, Response
7
+
8
+
9
+ class GraphQLCacheController(hishel.Controller):
10
+ def is_cachable(self, request: Request, response: Response) -> bool:
11
+ # Allow the cache to be disabled
12
+ if os.environ.get("ROOSTER_NO_CACHE"):
13
+ return False
14
+
15
+ # Since GraphQL always returns a 200, we check the response body for errors
16
+ error_in_response_body = False
17
+ try:
18
+ cooked_response = httpx.Response(
19
+ status_code=response.status,
20
+ headers=response.headers,
21
+ content=response.content,
22
+ )
23
+ error_in_response_body = cooked_response.json().get("errors")
24
+ except Exception:
25
+ pass # The response cannot be parsed as JSON
26
+ return super().is_cachable(request, response) and not error_in_response_body
27
+
28
+
29
+ @contextlib.contextmanager
30
+ def cached_graphql_client():
31
+ """
32
+ A HTTP client with support for caching GraphQL requests.
33
+
34
+ The cache will be stored at `$PWD/.cache`.
35
+ """
36
+ with httpx.Client(
37
+ transport=hishel.CacheTransport(
38
+ transport=httpx.HTTPTransport(),
39
+ controller=GraphQLCacheController(
40
+ allow_heuristics=True, cacheable_methods=["POST"]
41
+ ),
42
+ ),
43
+ timeout=None,
44
+ ) as client:
45
+ yield client