Skip to main content

A new package that helps developers quickly set up Preact applications without needing a complex build configuration. Users can describe their application requirements in plain text, including desired

Project description

Preact Codegen

PyPI version License: MIT Downloads LinkedIn

Overview

Preact Codegen is a package that helps developers quickly set up Preact applications without needing a complex build configuration. Users can describe their application requirements in plain text, including desired routing and signal management features. The package processes this input to generate a structured, ready-to-use Preact application code snippet.

Key Features

  • Generate Preact application code from user input in plain text
  • Supports routing and signal management features
  • Easy to integrate and expand
  • Simple and fast setup

Installation

pip install preact_codegen

Usage

from preact_codegen import preact_codegen

user_input = "Describe your Preact application requirements here..."
api_key = "your_api_key_here"  # Optional, if not provided, the default LLM7 will be used

response = preact_codegen(
    user_input=user_input,
    api_key=api_key,
)
print(response)

Parameters

  • user_input: The user input text to process (type: str)
  • llm: The langchain LLM instance to use (optional, type: Optional[BaseChatModel]), defaults to ChatLLM7 from langchain_llm7
  • api_key: The API key for LLM7 (optional, type: Optional[str]), defaults to os.getenv("LLM7_API_KEY") or None

Notes

  • The package uses ChatLLM7 from langchain_llm7 by default. You can safely pass your own LLM instance (based on langchain) if you want to use another LLM.

    Example for ChatOpenAI:

    from langchain_openai import ChatOpenAI
    from preact_codegen import preact_codegen
    
    llm = ChatOpenAI()
    response = preact_codegen(
        user_input=user_input,
        llm=llm,
    )
    

    Example for ChatAnthropic:

    from langchain_anthropic import ChatAnthropic
    from preact_codegen import preact_codegen
    
    llm = ChatAnthropic()
    response = preact_codegen(
        user_input=user_input,
        llm=llm,
    )
    

    Example for ChatGoogleGenerativeAI:

    from langchain_google_genai import ChatGoogleGenerativeAI
    from preact_codegen import preact_codegen
    
    llm = ChatGoogleGenerativeAI()
    response = preact_codegen(
        user_input=user_input,
        llm=llm,
    )
    
  • The default rate limits for LLM7 free tier are sufficient for most use cases of this package. If you want higher rate limits for LLM7, you can pass your own API_KEY via environment variable LLM7_API_KEY or directly like preact_codegen(api_key="your_api_key").

  • You can get a free API key by registering at LLM7.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

preact_codegen-2025.12.21144856.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

preact_codegen-2025.12.21144856-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file preact_codegen-2025.12.21144856.tar.gz.

File metadata

File hashes

Hashes for preact_codegen-2025.12.21144856.tar.gz
Algorithm Hash digest
SHA256 18d44733c275d3ebb72209cbd8495900c58a174b777dd8f1de899eed53c89523
MD5 4b7ffc07536252c4e9ed7b0b451e643b
BLAKE2b-256 47a645b3994c46bfd479e467df3b8db71f74f1eed414b8aba12a46107ed6f2d6

See more details on using hashes here.

File details

Details for the file preact_codegen-2025.12.21144856-py3-none-any.whl.

File metadata

File hashes

Hashes for preact_codegen-2025.12.21144856-py3-none-any.whl
Algorithm Hash digest
SHA256 cbdd73867ab1fc27925b8c0520e3612c8c2014f50b43edd77d3a4712d2399f52
MD5 9b4d81ea064f7cae3cd13f9c46f88c72
BLAKE2b-256 ffcd8fe12ea221e88a9c85cca610bba8ca07da1ec6a11dec239d0d3b112c0d9a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page