Skip to main content

webdev-pitfall-analyzer

PyPI version License: MIT Downloads LinkedIn

webdev-pitfall-analyzer helps developers quickly spot common web‑development pitfalls—security issues, accessibility problems, performance bottlenecks, outdated patterns, and more—by analysing short text inputs such as code snippets, design questions, or discussion fragments. The package uses an LLM (by default ChatLLM7 from langchain_llm7) to return a concise, structured list of warnings and best‑practice recommendations.


📦 Installation

pip install webdev_pitfall_analyzer

🚀 Quick start

from webdev_pitfall_analyzer import webdev_pitfall_analyzer

# Example HTML/JS snippet
snippet = """
<input type="text" onblur="doBadThing()" />
<script>
  function doBadThing() {
    eval(userInput);   // <- unsafe!
  }
</script>
"""

warnings = webdev_pitfall_analyzer(user_input=snippet)
print(warnings)

Output (example)

[
  "⚠️ Use of `eval` can lead to XSS vulnerabilities. Consider safer alternatives.",
  "⚠️ Missing `label` element for the input; this hurts accessibility.",
  "⚠️ Inline event handlers (`onblur`) are discouraged; attach listeners via JavaScript instead."
]

🛠️ Function signature

def webdev_pitfall_analyzer(
    user_input: str,
    api_key: Optional[str] = None,
    llm: Optional[BaseChatModel] = None,
) -> List[str]:
Parameter Type Description
user_input str The text (code, question, description, etc.) you want analysed.
api_key Optional[str] API key for ChatLLM7. If omitted, the function will look for the LLM7_API_KEY environment variable; if still not found it falls back to an unauthenticated request (may be rate‑limited).
llm Optional[BaseChatModel] Any LangChain‑compatible LLM instance. If not supplied, the default ChatLLM7 (from langchain_llm7) is used.

The function returns a list of warning/recommendation strings. If the underlying LLM call fails, a RuntimeError is raised.


🔧 Using a custom LLM

You can pass any LangChain chat model that follows the BaseChatModel interface.

OpenAI

from langchain_openai import ChatOpenAI
from webdev_pitfall_analyzer import webdev_pitfall_analyzer

my_llm = ChatOpenAI(model="gpt-4o-mini")
result = webdev_pitfall_analyzer(user_input="...", llm=my_llm)

Anthropic

from langchain_anthropic import ChatAnthropic
from webdev_pitfall_analyzer import webdev_pitfall_analyzer

my_llm = ChatAnthropic(model="claude-3-haiku-20240307")
result = webdev_pitfall_analyzer(user_input="...", llm=my_llm)

Google GenAI

from langchain_google_genai import ChatGoogleGenerativeAI
from webdev_pitfall_analyzer import webdev_pitfall_analyzer

my_llm = ChatGoogleGenerativeAI(model="gemini-1.5-flash")
result = webdev_pitfall_analyzer(user_input="...", llm=my_llm)

🔑 API key for ChatLLM7

The default free tier of LLM7 is sufficient for most occasional analyses.

  • Set the key once in your environment:
export LLM7_API_KEY="your_llm7_key"
  • Or pass it directly:
result = webdev_pitfall_analyzer(user_input="...", api_key="your_llm7_key")

Obtain a free key by registering at https://token.llm7.io/.


📚 What the analyzer looks for

  • Security – unsafe functions (eval, innerHTML, etc.), injection risks.
  • Accessibility – missing ARIA attributes, improper heading structure, unlabeled form controls.
  • Performance – blocking synchronous XHR, large inline assets, unnecessary reflows.
  • Modern best practices – deprecated APIs, outdated HTML5 elements, inefficient CSS selectors.

The underlying prompt (human_prompt, system_prompt) can be customised by forking the repository.


📂 Repository

🛠️ Issues & feature requests: https://github.com/chigwell/webdev_pitfall_analyzer/issues


👤 Author

Eugene Evstafev
Email: hi@eugene.plus
GitHub: https://github.com/chigwell


📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

Metadata

Release files for webdev-pitfall-analyzer 2025.12.21133820

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for webdev-pitfall-analyzer 2025.12.21133820
File Size Uploaded Provenance
webdev_pitfall_analyzer-2025.12.21133820.tar.gz 5.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for webdev-pitfall-analyzer 2025.12.21133820
File Interpreter ABI Platform
webdev_pitfall_analyzer-2025.12.21133820-py3-none-any.whl Python 3 none any Details

Total release size: 12.5 kB

Release files / webdev_pitfall_analyzer-2025.12.21133820.tar.gz

Download URL webdev_pitfall_analyzer-2025.12.21133820.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4e2ee0b7f2bc69bde02653e741de7ea99b6be28fc074c2cf5f8994529351f907
BLAKE2b-256 checksum
How to use checksums
90c57bf2a8bb62f57811c1ee45c46e847bcbe083fd7c99a0f8cb40794dae12f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release files / webdev_pitfall_analyzer-2025.12.21133820-py3-none-any.whl

Download URL webdev_pitfall_analyzer-2025.12.21133820-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
85dc7ca271f764240177a41988946d642faca23348d2648f71449bb0579d2019
BLAKE2b-256 checksum
How to use checksums
170ccdee8739f57daa138796c94daf1e85f04a4c37768089a4ade98911c76199
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Security for webdev-pitfall-analyzer 2025.12.21133820

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.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page