diff --git a/website/app/sitemap.ts b/website/app/sitemap.ts index 1e4ed33..2e87f95 100644 --- a/website/app/sitemap.ts +++ b/website/app/sitemap.ts @@ -25,6 +25,7 @@ export default async function sitemap():Promise{ {url:absolute('/salesforce-studio/privacy'),lastModified:updated,changeFrequency:'yearly',priority:0.3}, {url:absolute('/baazcyber/privacy'),lastModified:new Date('2026-11-08'),changeFrequency:'yearly',priority:0.3}, {url:absolute('/pdf'),lastModified:new Date('2026-10-19'),changeFrequency:'monthly',priority:0.8}, + {url:absolute('/veyra-snap'),lastModified:new Date('2026-11-22'),changeFrequency:'monthly',priority:0.8}, {url:absolute('/pdf/privacy'),lastModified:new Date('2026-10-19'),changeFrequency:'yearly',priority:0.3}, {url:absolute('/docs'),lastModified:updated,changeFrequency:'monthly',priority:0.8}, {url:absolute('/vs-code-alternative'),changeFrequency:'monthly',priority:0.8}, diff --git a/website/app/veyra-snap/CopyCommand.tsx b/website/app/veyra-snap/CopyCommand.tsx new file mode 100644 index 0000000..cef1f0a --- /dev/null +++ b/website/app/veyra-snap/CopyCommand.tsx @@ -0,0 +1,15 @@ +'use client'; +import {useState} from 'react'; +import {Check,Copy} from 'lucide-react'; + +/** A shell command with a copy button. */ +export function CopyCommand({command,label}:{command:string;label?:string}){ + const [copied,setCopied]=useState(false); + const copy=async()=>{ + try{await navigator.clipboard.writeText(command);setCopied(true);setTimeout(()=>setCopied(false),1600);}catch{/* the text is selectable anyway */} + }; + return
+ {command} + +
; +} diff --git a/website/app/veyra-snap/page.tsx b/website/app/veyra-snap/page.tsx new file mode 100644 index 0000000..19bdb0b --- /dev/null +++ b/website/app/veyra-snap/page.tsx @@ -0,0 +1,197 @@ +import type {Metadata} from 'next'; +import Image from 'next/image'; +import Link from 'next/link'; +import {AlertTriangle,Ban,BookOpen,Camera,CheckCheck,FileCode2,Gauge,Github,Layers,Package,ShieldCheck,Wand2} from 'lucide-react'; +import {Nav} from '@/components/Nav'; +import {Footer} from '@/components/Footer'; +import {Breadcrumbs} from '@/components/Breadcrumbs'; +import {ClosingCTA} from '@/components/ContentPage'; +import {absolute,jsonLd} from '@/lib/site'; +import {CopyCommand} from './CopyCommand'; +import '../live-server/live-server.css'; +import '../port-manager/port-manager.css'; +import './veyra-snap.css'; + +const PYPI='https://pypi.org/project/veyra-snap/'; +const SOURCE='https://github.com/fcopensource/veyraeditor/tree/main/python/veyra-snap'; +const FROM_GITHUB='pip install "git+https://github.com/fcopensource/veyraeditor#subdirectory=python/veyra-snap"'; +const VERSION='1.0.0'; + +/** The version on PyPI, or null before it's published. Checked hourly, so the page switches to PyPI by itself. */ +async function pypiVersion():Promise{ + try{ + const res=await fetch('https://pypi.org/pypi/veyra-snap/json',{next:{revalidate:3600},signal:AbortSignal.timeout(5000)}); + if(!res.ok)return null; + const data=await res.json() as {info?:{version?:string}}; + return data.info?.version||null; + }catch{return null;} +} + +export const revalidate=3600; + +export const metadata:Metadata={ + title:'veyra-snap: Generate pytest Tests From Real Runs (Python)', + description:'Run your Python code, get pytest tests. veyra-snap records what your functions are given and what they return or raise, and writes those real calls as readable regression tests. Free, MIT, no dependencies.', + keywords:['generate pytest tests','automatic unit tests python','pytest test generator','snapshot testing python','regression tests','characterization tests','golden master testing','legacy code tests','python testing tool','pip install veyra-snap'], + alternates:{canonical:'/veyra-snap'}, + openGraph:{url:'/veyra-snap',title:'veyra-snap: run your code, get pytest tests',description:'Records real function calls and writes them as pytest regression tests. Free and open source.',images:[{url:'/veyra-snap-icon.png',width:256,height:256,alt:'veyra-snap icon: a viewfinder around a check mark'}]}, +}; + +const FEATURES=[ + {icon:Wand2,title:'No code changes',copy:'Run your script or module with veyra-snap run. It watches the functions in your project while your program does what it always does.'}, + {icon:CheckCheck,title:'Every value double-checked',copy:'Each argument and result is written as Python source and rebuilt to make sure it comes back the same, type for type, before it goes in a test.'}, + {icon:Ban,title:'No flaky tests',copy:'If the same arguments ever give a different result (time, randomness, a database), the function gets no tests. Functions that only return None are skipped too.'}, + {icon:AlertTriangle,title:'Errors, too',copy:'Calls that raise become tests that expect that exception with that exact message, so a changed error is caught as well.'}, + {icon:FileCode2,title:'Tests you can read',copy:'Plain parametrized pytest, one test per function, each case named after its call. Review it, commit it, edit what looks wrong.'}, + {icon:Layers,title:'Your code only',copy:'The standard library, your installed packages, virtual environments and your tests are never recorded.'}, + {icon:Gauge,title:'Fast',copy:'On Python 3.12+ it uses sys.monitoring: library code costs nothing, and a function stops being watched once it has 25 cases. Hot loops stay fast.'}, + {icon:Camera,title:'Record more any time',copy:'Every run adds new cases to .veyra-snap/ and veyra-snap write regenerates the files. It never touches a test file it didn’t write.'}, + {icon:ShieldCheck,title:'Free, local, no dependencies',copy:'Pure Python, MIT licensed, nothing sent anywhere. Python 3.9 to 3.14 on Windows, macOS and Linux.'}, +]; + +const TYPES=['None','bool','int','float','str','bytes','list','tuple','dict','set','Decimal','Fraction','datetime','date','timedelta','UUID','Enum','dataclasses','NamedTuple']; + +const FAQ=[ + {q:'What is veyra-snap for?',a:'Getting a safety net fast. Code without tests, a refactor you’re nervous about, a library whose behaviour you want to lock down: run it once under veyra-snap and you have regression tests for what it does today.'}, + {q:'Do the tests prove my code is correct?',a:'No. They record what your code does now, bugs included, so you notice when that changes. Read them, and fix what looks wrong; they’re a starting point you own.'}, + {q:'Do I have to change my code?',a:'No. veyra-snap run app.py (or run -m yourpackage) records everything. If you prefer, mark chosen functions with @snap, or record a block with "with recording():".'}, + {q:'What about values it can’t write, like open files or database connections?',a:'Those calls are left out, and veyra-snap tells you which ones and why. Everything that does go in a test has been rebuilt from its source and compared first.'}, + {q:'Which Python versions?',a:'Python 3.9 to 3.14. On 3.12+ recording uses sys.monitoring and records raised errors automatically; on 3.9 to 3.11 it uses sys.settrace, and errors are recorded for functions marked with @snap.'}, + {q:'Is it free?',a:'Yes. veyra-snap is free and open source under the MIT license, with no account and no telemetry. It’s made by FlightCoders, the team behind the Veyra editor.'}, +]; + +export default async function VeyraSnapPage(){ + const published=await pypiVersion(); + const version=published||VERSION; + const install=published?'pip install veyra-snap':FROM_GITHUB; + const app={ + '@context':'https://schema.org','@type':'SoftwareApplication',name:'veyra-snap',applicationCategory:'DeveloperApplication', + operatingSystem:'Windows, macOS, Linux',url:absolute('/veyra-snap'),image:absolute('/veyra-snap-icon.png'),softwareVersion:version, + downloadUrl:published?PYPI:SOURCE,programmingLanguage:'Python',license:'https://opensource.org/licenses/MIT', + description:'A free Python library that records real function calls and writes them as pytest regression tests.', + offers:{'@type':'Offer',price:'0',priceCurrency:'USD'},publisher:{'@type':'Organization',name:'FlightCoders',url:'https://flightcoders.com'}, + }; + const faq={'@context':'https://schema.org','@type':'FAQPage',mainEntity:FAQ.map(item=>({'@type':'Question',name:item.q,acceptedAnswer:{'@type':'Answer',text:item.a}}))}; + + return <>