gemini-on-python 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.
@@ -0,0 +1,36 @@
1
+
2
+ name: Publish to PyPI
3
+
4
+ on:
5
+ release:
6
+ types: [published]
7
+
8
+ permissions:
9
+ id-token: write
10
+
11
+ jobs:
12
+ publish:
13
+ name: Publish package
14
+ runs-on: ubuntu-latest
15
+
16
+ environment:
17
+ name: pypi
18
+ url: https://pypi.org/p/gemini-on-python
19
+
20
+ steps:
21
+ - name: Checkout repository
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.x"
28
+
29
+ - name: Install build
30
+ run: python -m pip install build
31
+
32
+ - name: Build package
33
+ run: python -m build
34
+
35
+ - name: Publish to PyPI
36
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,17 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Leaftify
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.
@@ -0,0 +1,66 @@
1
+ Metadata-Version: 2.5
2
+ Name: gemini-on-python
3
+ Version: 0.1.1
4
+ Summary: A lightweight Python client for the Google Gemini API
5
+ Project-URL: Homepage, https://github.com/phoebychubi-cyber/gemini-on-python
6
+ Project-URL: Repository, https://github.com/phoebychubi-cyber/gemini-on-python
7
+ Project-URL: Issues, https://github.com/phoebychubi-cyber/gemini-on-python/issues/
8
+ Author: Leaftify
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: ai,api,client,gemini,google,python
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Requires-Python: >=3.9
15
+ Requires-Dist: requests
16
+ Description-Content-Type: text/markdown
17
+
18
+ # Gemini-On-Python
19
+
20
+ A lightweight Python wrapper for the Google Gemini API.
21
+
22
+ ## Installation
23
+
24
+ ```bash
25
+ pip install Gemini-On-Python
26
+ ```
27
+
28
+ ## Quick Start
29
+
30
+ ```python
31
+ from gemini import Gemini
32
+
33
+ gemini = Gemini("your api key")
34
+
35
+ response = gemini.ask("In 1809, a British statesman was shot in the buttock during a duel with a fellow Cabinet minister, later went on to serve as Prime Minister of the United Kingdom for just 119 days in 1827 before dying in office, and—according to evolutionary biologist Stephen Jay Gould—indirectly helped set the stage for Charles Darwin's voyage on HMS Beagle. Who was this statesman?")
36
+
37
+ print(response)
38
+ ```
39
+
40
+ ## Features
41
+
42
+ - Simple Gemini API integration
43
+ - Custom model selection
44
+ - Request timeout handling
45
+ - HTTP error handling
46
+ - Lightweight and easy to use
47
+
48
+ ## Requirements
49
+
50
+ - Python 3.9+
51
+ - Google Gemini API key
52
+
53
+ ## Configuration
54
+
55
+ You can specify a custom model:
56
+
57
+ ```python
58
+ ai = Gemini(
59
+ api_key="YOUR_API_KEY",
60
+ model="gemini-3.5-flash-lite"
61
+ )
62
+ ```
63
+
64
+ ## License
65
+
66
+ This project is licensed under the MIT License.
@@ -0,0 +1,49 @@
1
+ # Gemini-On-Python
2
+
3
+ A lightweight Python wrapper for the Google Gemini API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install Gemini-On-Python
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```python
14
+ from gemini import Gemini
15
+
16
+ gemini = Gemini("your api key")
17
+
18
+ response = gemini.ask("In 1809, a British statesman was shot in the buttock during a duel with a fellow Cabinet minister, later went on to serve as Prime Minister of the United Kingdom for just 119 days in 1827 before dying in office, and—according to evolutionary biologist Stephen Jay Gould—indirectly helped set the stage for Charles Darwin's voyage on HMS Beagle. Who was this statesman?")
19
+
20
+ print(response)
21
+ ```
22
+
23
+ ## Features
24
+
25
+ - Simple Gemini API integration
26
+ - Custom model selection
27
+ - Request timeout handling
28
+ - HTTP error handling
29
+ - Lightweight and easy to use
30
+
31
+ ## Requirements
32
+
33
+ - Python 3.9+
34
+ - Google Gemini API key
35
+
36
+ ## Configuration
37
+
38
+ You can specify a custom model:
39
+
40
+ ```python
41
+ ai = Gemini(
42
+ api_key="YOUR_API_KEY",
43
+ model="gemini-3.5-flash-lite"
44
+ )
45
+ ```
46
+
47
+ ## License
48
+
49
+ This project is licensed under the MIT License.
@@ -0,0 +1,39 @@
1
+
2
+ [build-system]
3
+ requires = ["hatchling"]
4
+ build-backend = "hatchling.build"
5
+
6
+ [project]
7
+ name = "gemini-on-python"
8
+ version = "0.1.1"
9
+ description = "A lightweight Python client for the Google Gemini API"
10
+ readme = "README.md"
11
+ requires-python = ">=3.9"
12
+ license = "MIT"
13
+ authors = [
14
+ { name = "Leaftify" }
15
+ ]
16
+ keywords = [
17
+ "gemini",
18
+ "google",
19
+ "ai",
20
+ "api",
21
+ "python",
22
+ "client"
23
+ ]
24
+ classifiers = [
25
+ "Programming Language :: Python :: 3",
26
+ "Operating System :: OS Independent"
27
+ ]
28
+ dependencies = [
29
+ "requests"
30
+ ]
31
+
32
+
33
+ [tool.hatch.build.targets.wheel]
34
+ packages = ["src/gemini"]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/phoebychubi-cyber/gemini-on-python"
38
+ Repository = "https://github.com/phoebychubi-cyber/gemini-on-python"
39
+ Issues = "https://github.com/phoebychubi-cyber/gemini-on-python/issues/"
@@ -0,0 +1,3 @@
1
+ from .client import Gemini
2
+
3
+ __all__ = ["Gemini"]
@@ -0,0 +1,47 @@
1
+ import requests
2
+
3
+ class Gemini:
4
+ def __init__(self, api_key, model=None):
5
+ if not api_key:
6
+ raise ValueError("API key is required")
7
+
8
+ self.api_key = api_key
9
+ self.model = model or "gemini-3.5-flash-lite"
10
+
11
+ def ask(self, prompt):
12
+ headers = {
13
+ "Content-Type": "application/json",
14
+ "x-goog-api-key": self.api_key
15
+ }
16
+ URL = (
17
+ f"https://generativelanguage.googleapis.com/v1beta/"
18
+ f"models/{self.model}:generateContent"
19
+ )
20
+ payload = {
21
+ "contents": [
22
+ {
23
+ "parts": [
24
+ {"text": prompt}
25
+ ]
26
+ }
27
+ ]
28
+ }
29
+ response = requests.post(
30
+ URL,
31
+ headers=headers,
32
+ json=payload,
33
+ timeout=60
34
+ )
35
+
36
+ try:
37
+
38
+ if response.status_code == "400":
39
+ raise RuntimeError(f"Gemini API request failed: Invalid API KEY")
40
+
41
+ response.raise_for_status()
42
+
43
+ data = response.json()
44
+
45
+ return data["candidates"][0]["content"]["parts"][0]["text"]
46
+ except requests.RequestException as error:
47
+ raise RuntimeError(f"Gemini API request failed: {error}") from error
@@ -0,0 +1,7 @@
1
+ from gemini import Gemini
2
+
3
+ gemini = Gemini("your api key")
4
+
5
+ response = gemini.ask("In 1809, a British statesman was shot in the buttock during a duel with a fellow Cabinet minister, later went on to serve as Prime Minister of the United Kingdom for just 119 days in 1827 before dying in office, and—according to evolutionary biologist Stephen Jay Gould—indirectly helped set the stage for Charles Darwin's voyage on HMS Beagle. Who was this statesman?")
6
+
7
+ print(response)