hammad-python
Harmoniously Accelerated Micro-Modules (for) Application Development
hammad-python is an ecosystem of wrappers with the sole purpose of defining
opinionated resources that I myself use in my projects and day to day work when
building with Python.
The ecosystem is split into 4 main sub-packages:
hammad-python-core: Contains "stdlib" like resources such as converters, types, caching, etc. All of these resources can easily be implemented from scratch, and are built soley for convenience.hammad-python-data: Contains aCollectionclass / system that implements a simple vector / non vector database system.hammad-python-genai: Contains a collection of patterns for using Generative AI models as well as implementing concepts like Agentic Reasoning.hammad-python-http: HTTP / API related resources and utilities. Contains resources related to MCP, HTTP, OpenAPI & GraphQL Servers.
Installation
You can install any of the sub-packages, or the main package through pip or uv.
pip install hammad-python
Quickstart
Easily Use Language Models With Various Tools & Patterns
from ham.genai import Agent, LanguageModel
from ham.http import SearchClient
client = SearchClient()
def search_web(query: str) -> str:
return client.search(query)
# create your agent
# agents have rich functionality, and use `litellm` & `instructor` under the hood
agent = Agent(
instructions = "You are a helpful assistant who can search the web",
tools = [search_web]
)
print(agent.run("What is the weather in Tokyo?"))
>>> AgentResponse:
city='Tokyo' temperature=25.0 description='Clear sky'
>>> Model: openai/gpt-4o-mini
>>> Steps: 2
>>> Output Type: Response
>>> Total Tool Calls: 1
Vectorized & Searchable Collections
from ham.data import Collection
collection = Collection(vector=True)
collection.add("Rocks")
collection.add("Cucumber")
collection.add("Dragon")
collection.add("Apple")
# query the collection
for result in collection.query("Fruit"):
print(result.item)
>>> Apple
>>> Cucumber
>>> Dragon
>>> Rocks
HTTP & API Resources
from ham.http import function_server
# instantly launch a server by decorating a function
@function_server(path="/some-endpoint", auto_start=True)
def some_endpoint(name : str) -> str:
return f"Hello, {name}!"
Now in a separate file:
import requests
print(
requests.post(
"http://0.0.0.0:8000/some-endpoint",
json = {"name": "John"}
).json()
)
>>> {'result' : 'Hello, John!'}
Metadata
Release files for hammad-python 0.0.38
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hammad_python-0.0.38.tar.gz | 434.1 kB | Without provenance | Details for hammad_python-0.0.38.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hammad_python-0.0.38-py3-none-any.whl | Python 3 | none | any | Details for hammad_python-0.0.38-py3-none-any.whl |
Total release size: 439.3 kB
Release files / hammad_python-0.0.38.tar.gz
| Download URL | hammad_python-0.0.38.tar.gz |
|---|---|
| Size | 434.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d300a6c48daecdf60a99fb07e25576d4beb34d1a2ffeaceada5029d5a0dc22f0
|
|
BLAKE2b-256 checksum How to use checksums |
1af6081360b06d72be9f922dc4d3e795e2b9ebf4e7bd615d2200653c5e114b2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Release files / hammad_python-0.0.38-py3-none-any.whl
| Download URL | hammad_python-0.0.38-py3-none-any.whl |
|---|---|
| Size | 5.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e719ee198c0b17746c69468e1e54e11653d2e815e5928bc22adeac6ee997f63d
|
|
BLAKE2b-256 checksum How to use checksums |
aed43019bacbccfa25264b57c5c48e61769d702d39bcc1b84ad470693d841aa0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.11
|
Security for hammad-python 0.0.38
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.