Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ node_modules/
/build/
/.svelte-kit/
/.yarn/install-state.gz
.env
.env.local
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"devDependencies": {
"@eslint/js": "^10.0.1",
"@sveltejs/adapter-static": "^3.0.10",
"@sveltejs/kit": "^2.49.1",
"@sveltejs/kit": "^2.70.3",
"@sveltejs/vite-plugin-svelte": "^6.2.1",
"@types/node": "^24",
"eslint": "^10.4.1",
Expand All @@ -28,7 +28,8 @@
"svelte-check": "^4.3.4",
"typescript": "^5.9.3",
"typescript-eslint": "^8.60.1",
"vite": "^7.2.6"
"vite": "^7.2.6",
"zod": "^4.5.4"
},
"packageManager": "yarn@4.17.0"
}
5 changes: 0 additions & 5 deletions src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta
name="description"
content="PurePy: a pure, functional subset of Python for scientific computing. Formal specification and reference checker."
/>
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
Expand Down
14 changes: 14 additions & 0 deletions src/env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineEnvVars } from "@sveltejs/kit/env";

import { z } from "zod";

export const variables = defineEnvVars({
ANONYMOUS: {
public: false, // this should only be used serverside to ensure no leakage
static: true,
schema: z
.string()
.optional()
.transform((x) => x === "true"),
},
});
20 changes: 20 additions & 0 deletions src/lib/config/anon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import logo from "$lib/assets/image/logo.png";

export const public_config = {
name: "PurePy",
logo: logo,
github: "https://github.com/pure-py/pure-py-spec",
spec: "https://github.com/pure-py/pure-py-spec/releases/latest",
favicon: "/favicon.png",
} as const;

const NO_LOGO =
"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";

export const anon_config = {
name: "This Project",
logo: NO_LOGO,
github: "https://github.com",
spec: "https://github.com", // we need an anoymous spec
favicon: NO_LOGO,
};
Comment on lines +3 to +20

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we define a shared SiteConfig type and use satisfies SiteConfig for both configuration objects, public_config and anon_config?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any benefit in doing that?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’d argue it gives us compile-time shape validation and safer refactors, all while preserving exact literal types—so I see it as a nice-to-have for safety and maintainability.

8 changes: 8 additions & 0 deletions src/routes/+layout.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as env from "$app/env/private";
import { anon_config, public_config } from "$lib/config/anon";

export const load = () => {
return {
config: env.ANONYMOUS ? anon_config : public_config,
};
};
26 changes: 18 additions & 8 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
<script lang="ts">
import type { LayoutProps } from "./$types";
import "$lib/styles.css";
import { headerLinks } from "$lib/config/nav";
import logo from "$lib/assets/image/logo.png";

let { children } = $props();
let { children, data }: LayoutProps = $props();
</script>

<svelte:head>
<title>{data.config.name}</title>
<link rel="icon" href={data.config.favicon} />

<meta
name="description"
content="{data.config
.name}: a pure, functional subset of Python for scientific computing. Formal specification and reference checker."
/>
</svelte:head>

<header class="site-header">
<a class="brand" href="#top"
><img class="brand-logo" src={logo} alt="PurePy" /></a
><img class="brand-logo" src={data.config.logo} alt={data.config.name} /></a
>
<nav class="site-nav">
{#each headerLinks as { url, title } (url)}
Expand All @@ -23,12 +34,11 @@

<footer class="site-footer">
<div class="footer-inner">
<p>© PurePy contributors</p>
<p>© {data.config.name} contributors</p>

<nav>
<a href="https://github.com/pure-py/pure-py-spec">GitHub</a>
<a href="https://github.com/pure-py/pure-py-spec/releases/latest"
>Specification (PDF)</a
>
<a href={data.config.github}>GitHub</a>
<a href={data.config.spec}>Specification (PDF)</a>
</nav>
</div>
</footer>
38 changes: 17 additions & 21 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<script lang="ts">
import logo from "$lib/assets/image/logo.png";
import type { PageProps } from "./$types";
let { data }: PageProps = $props();
</script>

<svelte:head>
<title>PurePy</title>
</svelte:head>

<section id="top" class="hero">
<h1><img class="hero-logo" src={logo} alt="PurePy" /></h1>
<h1>
<img class="hero-logo" src={data.config.logo} alt={data.config.name} />
</h1>
<p class="tagline">
A pure, functional subset of Python for scientific computing
</p>
Expand All @@ -16,27 +15,24 @@
reference checker for a side-effect-free subset of Python.
</p>
<div class="cta">
<a
class="button primary"
href="https://github.com/pure-py/pure-py-spec/releases/latest"
>Read the spec</a
>
<a class="button" href="https://github.com/pure-py/pure-py-spec">GitHub</a>
<a class="button primary" href={data.config.spec}>Read the spec</a>

<a class="button" href={data.config.github}>GitHub</a>
</div>
</section>

<section id="overview" class="prose">
<h2>Overview</h2>
<p>
PurePy defines a pure, side-effect-free subset of Python. It is aimed
initially at researchers in programming languages and pedagogy, and is
intended to grow into a common language for scientific computing, supporting
portable applications in modelling, data processing, analysis, and
visualisation.
{data.config.name} defines a pure, side-effect-free subset of Python. It is aimed
initially at researchers in programming languages and pedagogy, and is intended
to grow into a common language for scientific computing, supporting portable applications
in modelling, data processing, analysis, and visualisation.
</p>
<p>
The standard defines a versioned formal grammar, a formal semantics, and a
reference checker. Every compliant implementation accepts any valid PurePy
reference checker. Every compliant implementation accepts any valid {data
.config.name}
program and behaves according to the formal semantics.
</p>
</section>
Expand Down Expand Up @@ -75,7 +71,7 @@
</section>

<section id="features" class="features">
<h2>Why PurePy</h2>
<h2>Why {data.config.name}</h2>
<div class="grid">
<div class="card">
<h3>Pure &amp; functional</h3>
Expand All @@ -84,8 +80,8 @@
<div class="card">
<h3>Pythonic</h3>
<p>
A strict subset of Python: every valid PurePy program is valid Python,
and runs with exactly the same runtime behaviour.
A strict subset of Python: every valid {data.config.name} program is valid
Python, and runs with exactly the same runtime behaviour.
</p>
</div>
<div class="card">
Expand Down
3 changes: 3 additions & 0 deletions svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const config = {
kit: {
adapter: adapter(),
paths: { base: process.env.BASE_PATH ?? "" },
experimental: {
explicitEnvironmentVariables: true,
},
},
};

Expand Down
18 changes: 13 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,9 @@ __metadata:
languageName: node
linkType: hard

"@sveltejs/kit@npm:^2.49.1":
version: 2.66.0
resolution: "@sveltejs/kit@npm:2.66.0"
"@sveltejs/kit@npm:^2.70.3":
version: 2.70.3
resolution: "@sveltejs/kit@npm:2.70.3"
dependencies:
"@standard-schema/spec": "npm:^1.0.0"
"@sveltejs/acorn-typescript": "npm:^1.0.9"
Expand All @@ -593,7 +593,7 @@ __metadata:
optional: true
bin:
svelte-kit: svelte-kit.js
checksum: 10c0/c90f595b7ac67aecc70c7eb737b4dc0df2063ee7bbaa796eff53c9cdd7719baf00b5f5d472d9bb0f202044f7f3cfecea91589c2448088c8fbf11613db17da226
checksum: 10c0/af0888aa65bfe71ed18fb1450449de4be8096a910536eb3a2695b013c18b9a1b0efe7efc5dc2b1f52f4ff990bc8ea4471c365010d5cf5eb4e76bd5d5d91b1a84
languageName: node
linkType: hard

Expand Down Expand Up @@ -1797,7 +1797,7 @@ __metadata:
dependencies:
"@eslint/js": "npm:^10.0.1"
"@sveltejs/adapter-static": "npm:^3.0.10"
"@sveltejs/kit": "npm:^2.49.1"
"@sveltejs/kit": "npm:^2.70.3"
"@sveltejs/vite-plugin-svelte": "npm:^6.2.1"
"@types/node": "npm:^24"
eslint: "npm:^10.4.1"
Expand All @@ -1811,6 +1811,7 @@ __metadata:
typescript: "npm:^5.9.3"
typescript-eslint: "npm:^8.60.1"
vite: "npm:^7.2.6"
zod: "npm:^4.5.4"
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -2269,3 +2270,10 @@ __metadata:
checksum: 10c0/9470cbf22cefae975ab413c7158a119d082b354ddcf0da48a842f2f42246fa15943cd9b92c047de39db38015e3b866e32f383bc217e8e4f4192945c7d425536b
languageName: node
linkType: hard

"zod@npm:^4.5.4":
version: 4.5.4
resolution: "zod@npm:4.5.4"
checksum: 10c0/511a2a4d1a6f875dfdd70a1586989a8b14ef126776cd6218a2c760b9f65f14ef389ec20d92ee1aa4fcb4566d4ff3fa012956044f9dc503510d82e4c756a8ba92
languageName: node
linkType: hard