necro 0.0.0.dev0__tar.gz → 0.0.0.dev1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,39 @@
1
+ # Zig
2
+ .zig-cache/
3
+ zig-out/
4
+
5
+ # Cross-compile sysroots (Python headers/libs — regenerate from a base image)
6
+ sysroot/
7
+
8
+ # Python
9
+ __pycache__/
10
+ *.py[cod]
11
+ *$py.class
12
+ *.so
13
+ *.egg-info/
14
+ *.egg
15
+ build/
16
+ dist/
17
+ wheels/
18
+ .eggs/
19
+ .pytest_cache/
20
+ .mypy_cache/
21
+ .ruff_cache/
22
+ .tox/
23
+ .coverage
24
+ .coverage.*
25
+ htmlcov/
26
+ .hypothesis/
27
+
28
+ # venvs
29
+ .venv/
30
+ venv/
31
+ env/
32
+ .env
33
+
34
+ # editors / OS
35
+ .vscode/
36
+ .idea/
37
+ *.swp
38
+ *.swo
39
+ .DS_Store
@@ -1,13 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: necro
3
- Version: 0.0.0.dev0
3
+ Version: 0.0.0.dev1
4
4
  Summary: The fastest Python web framework.
5
5
  Author: Dzara Melcone
6
6
  License-Expression: MIT
7
+ License-File: LICENSE
7
8
  Requires-Python: >=3.14
8
9
  Description-Content-Type: text/markdown
9
- License-File: LICENSE
10
- Dynamic: license-file
11
10
 
12
11
  # necro
13
12
 
@@ -0,0 +1,49 @@
1
+ const std = @import("std");
2
+
3
+ fn linkPython(m: *std.Build.Module) void {
4
+ const target = m.resolved_target.?.result;
5
+ switch (target.os.tag) {
6
+ .macos => {
7
+ m.addIncludePath(.{ .cwd_relative = "/opt/homebrew/opt/python@3.14/Frameworks/Python.framework/Versions/3.14/include/python3.14" });
8
+ m.addLibraryPath(.{ .cwd_relative = "/opt/homebrew/opt/python@3.14/Frameworks/Python.framework/Versions/3.14/lib" });
9
+ },
10
+ .linux => switch (target.cpu.arch) {
11
+ .aarch64 => {
12
+ m.addIncludePath(.{ .cwd_relative = "sysroot/linux-aarch64/include/python3.14" });
13
+ m.addLibraryPath(.{ .cwd_relative = "sysroot/linux-aarch64/lib" });
14
+ },
15
+ .x86_64 => {
16
+ m.addIncludePath(.{ .cwd_relative = "sysroot/linux-x86_64/include/python3.14" });
17
+ m.addLibraryPath(.{ .cwd_relative = "sysroot/linux-x86_64/lib" });
18
+ },
19
+ else => @panic("necro only supports linux on aarch64 or x86_64"),
20
+ },
21
+ else => @panic("necro only supports macos and linux"),
22
+ }
23
+ m.linkSystemLibrary("python3.14", .{});
24
+ m.link_libc = true;
25
+ }
26
+
27
+ pub fn build(b: *std.Build) void {
28
+ const target = b.standardTargetOptions(.{});
29
+ const optimize = b.standardOptimizeOption(.{});
30
+ const metrics = b.option(bool, "metrics", "Enable pipeline metrics") orelse false;
31
+
32
+ const pyext = b.addLibrary(.{
33
+ .linkage = .dynamic,
34
+ .name = "core",
35
+ .root_module = b.createModule(.{
36
+ .root_source_file = b.path("src/root.zig"),
37
+ .target = target,
38
+ .optimize = optimize,
39
+ .strip = true,
40
+ }),
41
+ });
42
+ const options = b.addOptions();
43
+ options.addOption(bool, "metrics", metrics);
44
+ pyext.root_module.addOptions("build_options", options);
45
+ pyext.want_lto = true;
46
+ pyext.link_gc_sections = true;
47
+ linkPython(pyext.root_module);
48
+ b.installArtifact(pyext);
49
+ }
@@ -0,0 +1,7 @@
1
+ .{
2
+ .name = .necro,
3
+ .version = "0.0.1",
4
+ .minimum_zig_version = "0.15.2",
5
+ .paths = .{""},
6
+ .fingerprint = 0x664d2bc4d8526ed9,
7
+ }
@@ -1,10 +1,10 @@
1
1
  [build-system]
2
- requires = ["setuptools>=68"]
3
- build-backend = "setuptools.build_meta"
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "necro"
7
- version = "0.0.0.dev0"
7
+ version = "0.0.0.dev1"
8
8
  description = "The fastest Python web framework."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.14"
@@ -12,8 +12,5 @@ license = "MIT"
12
12
  license-files = ["LICENSE"]
13
13
  authors = [{ name = "Dzara Melcone" }]
14
14
 
15
- [tool.setuptools]
16
- package-dir = { "" = "python" }
17
-
18
- [tool.setuptools.packages.find]
19
- where = ["python"]
15
+ [tool.hatch.build.targets.wheel]
16
+ packages = ["python/necro"]
@@ -0,0 +1,50 @@
1
+ //! Custom log function for necro.
2
+ //!
3
+ //! Format: [timestamp] [t:thread_id] [loop:N] [LEVEL] scope | message
4
+ //! debug level is stripped in ReleaseFast (zero cost).
5
+ //!
6
+ //! The loop counter tracks event loop iterations (reap cycles).
7
+ //! Call bumpLoop() from the reap point to increment it.
8
+ //!
9
+ //! Log lines are capped at 4096 bytes to preserve POSIX PIPE_BUF atomicity —
10
+ //! writes at or below PIPE_BUF will not interleave with other threads' writes
11
+ //! when stderr is piped. Oversized lines are dropped rather than split.
12
+
13
+ const std = @import("std");
14
+
15
+ const prefix_fmt = "[{d}] [t:{d}] [loop:{d}] [{s}] {s} | ";
16
+
17
+ threadlocal var loop_count: u64 = 0;
18
+
19
+ pub fn bumpLoop() void {
20
+ loop_count += 1;
21
+ }
22
+
23
+ pub fn getLoopCount() u64 {
24
+ return loop_count;
25
+ }
26
+
27
+ pub fn logFn(
28
+ comptime level: std.log.Level,
29
+ comptime scope: @TypeOf(.enum_literal),
30
+ comptime fmt: []const u8,
31
+ args: anytype,
32
+ ) void {
33
+ const level_name = comptime @tagName(level);
34
+ const scope_name = if (@tagName(scope).len > 0) @tagName(scope) else "necro";
35
+
36
+ const prefix_args = .{
37
+ std.time.milliTimestamp(),
38
+ std.Thread.getCurrentId(),
39
+ loop_count,
40
+ level_name,
41
+ scope_name,
42
+ };
43
+
44
+ var buf: [4096]u8 = undefined;
45
+ var w = std.Io.Writer.fixed(&buf);
46
+ w.print(prefix_fmt ++ fmt ++ "\n", prefix_args ++ args) catch return;
47
+
48
+ const stderr = std.fs.File.stderr();
49
+ stderr.writeAll(w.buffered()) catch return;
50
+ }
@@ -0,0 +1,19 @@
1
+ //! Necro — Python extension module entry point.
2
+ //!
3
+ //! This file is the root of the `core.so` shared library inside the `necro`
4
+ //! Python package. Python's extension loader finds `PyInit_core` as a C symbol
5
+ //! in the .so at import time;
6
+ //! the comptime reference below keeps the linker from stripping it under
7
+ //! LTO + --gc-sections.
8
+
9
+ const std = @import("std");
10
+ const log = @import("log.zig");
11
+ const module = @import("python/module.zig");
12
+
13
+ pub const std_options: std.Options = .{
14
+ .logFn = log.logFn,
15
+ };
16
+
17
+ comptime {
18
+ _ = &module.PyInit_core;
19
+ }
necro-0.0.0.dev0/PKG-INFO DELETED
@@ -1,14 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: necro
3
- Version: 0.0.0.dev0
4
- Summary: The fastest Python web framework.
5
- Author: Dzara Melcone
6
- License-Expression: MIT
7
- Requires-Python: >=3.14
8
- Description-Content-Type: text/markdown
9
- License-File: LICENSE
10
- Dynamic: license-file
11
-
12
- # necro
13
-
14
- The fastest Python web framework.
@@ -1,8 +0,0 @@
1
- LICENSE
2
- README.md
3
- pyproject.toml
4
- python/necro/__init__.py
5
- python/necro.egg-info/PKG-INFO
6
- python/necro.egg-info/SOURCES.txt
7
- python/necro.egg-info/dependency_links.txt
8
- python/necro.egg-info/top_level.txt
@@ -1 +0,0 @@
1
- necro
@@ -1,4 +0,0 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
File without changes
File without changes