papyrust 0.1.0a1__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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jacob Wilkinson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,58 @@
1
+ Metadata-Version: 2.4
2
+ Name: papyrust
3
+ Version: 0.1.0a1
4
+ Summary: Rust-style Python, with full static typing.
5
+ Keywords: rust,error-handling,monad,typing
6
+ Author: Jacob Wilkinson
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Programming Language :: Python :: 3.15
17
+ Classifier: Typing :: Typed
18
+ Requires-Python: >=3.12
19
+ Project-URL: Homepage, https://github.com/wilkinsonjacob/papyrust
20
+ Project-URL: Repository, https://github.com/wilkinsonjacob/papyrust
21
+ Project-URL: Issues, https://github.com/wilkinsonjacob/papyrust/issues
22
+ Description-Content-Type: text/markdown
23
+
24
+ # papyrust
25
+
26
+ Rust-style Python, built for static type checkers.
27
+
28
+ > **Status: alpha.** The API is incomplete and will change between releases.
29
+
30
+ ## Installation
31
+
32
+ ```sh
33
+ pip install papyrust
34
+ # or
35
+ uv add papyrust
36
+ ```
37
+
38
+ Requires Python 3.12 or newer. No runtime dependencies.
39
+
40
+ ## Development
41
+
42
+ This project uses [uv](https://docs.astral.sh/uv/).
43
+
44
+ ```sh
45
+ uv sync # install dependencies
46
+ uv run pre-commit install # install git hooks
47
+ uv run pytest # run tests
48
+ uv run ty check # type check
49
+ uv run ruff check && uv run ruff format # lint and format
50
+ ```
51
+
52
+ Commits follow [Conventional Commits](https://www.conventionalcommits.org/).
53
+ Use `uv run cz commit` for an interactive prompt, and `uv run cz bump` to cut a
54
+ release.
55
+
56
+ ## License
57
+
58
+ [MIT](LICENSE)
@@ -0,0 +1,35 @@
1
+ # papyrust
2
+
3
+ Rust-style Python, built for static type checkers.
4
+
5
+ > **Status: alpha.** The API is incomplete and will change between releases.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ pip install papyrust
11
+ # or
12
+ uv add papyrust
13
+ ```
14
+
15
+ Requires Python 3.12 or newer. No runtime dependencies.
16
+
17
+ ## Development
18
+
19
+ This project uses [uv](https://docs.astral.sh/uv/).
20
+
21
+ ```sh
22
+ uv sync # install dependencies
23
+ uv run pre-commit install # install git hooks
24
+ uv run pytest # run tests
25
+ uv run ty check # type check
26
+ uv run ruff check && uv run ruff format # lint and format
27
+ ```
28
+
29
+ Commits follow [Conventional Commits](https://www.conventionalcommits.org/).
30
+ Use `uv run cz commit` for an interactive prompt, and `uv run cz bump` to cut a
31
+ release.
32
+
33
+ ## License
34
+
35
+ [MIT](LICENSE)
@@ -0,0 +1,70 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.13.5,<0.14"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "papyrust"
7
+ version = "0.1.0a1"
8
+ description = "Rust-style Python, with full static typing."
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ keywords = [
14
+ "rust",
15
+ "error-handling",
16
+ "monad",
17
+ "typing",
18
+ ]
19
+ classifiers = [
20
+ "Development Status :: 3 - Alpha",
21
+ "Intended Audience :: Developers",
22
+ "Operating System :: OS Independent",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Programming Language :: Python :: 3.14",
27
+ "Programming Language :: Python :: 3.15",
28
+ "Typing :: Typed",
29
+ ]
30
+ dependencies = []
31
+
32
+ [[project.authors]]
33
+ name = "Jacob Wilkinson"
34
+
35
+ [project.urls]
36
+ Homepage = "https://github.com/wilkinsonjacob/papyrust"
37
+ Repository = "https://github.com/wilkinsonjacob/papyrust"
38
+ Issues = "https://github.com/wilkinsonjacob/papyrust/issues"
39
+
40
+ [tool.pytest.ini_options]
41
+ pythonpath = ["src"]
42
+ testpaths = ["tests"]
43
+
44
+ [tool.ty.environment]
45
+ root = ["./src"]
46
+
47
+ [tool.ruff.lint]
48
+ select = [
49
+ "E",
50
+ "F",
51
+ "I",
52
+ "UP",
53
+ "B",
54
+ ]
55
+
56
+ [tool.commitizen]
57
+ name = "cz_conventional_commits"
58
+ version_provider = "uv"
59
+ tag_format = "v$version"
60
+ update_changelog_on_bump = true
61
+ major_version_zero = true
62
+
63
+ [dependency-groups]
64
+ dev = [
65
+ "commitizen>=4.19.3",
66
+ "pre-commit>=4.7.0",
67
+ "pytest>=9.2.0",
68
+ "ruff>=0.17.4",
69
+ "ty>=0.0.100",
70
+ ]
@@ -0,0 +1,57 @@
1
+ [build-system]
2
+ requires = ["uv_build>=0.13.5,<0.14"]
3
+ build-backend = "uv_build"
4
+
5
+ [project]
6
+ name = "papyrust"
7
+ version = "0.1.0a1"
8
+ description = "Rust-style Python, with full static typing."
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Jacob Wilkinson" }]
14
+ keywords = ["rust", "error-handling", "monad", "typing"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Developers",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "Programming Language :: Python :: 3.14",
23
+ "Programming Language :: Python :: 3.15",
24
+ "Typing :: Typed",
25
+ ]
26
+ dependencies = []
27
+
28
+ [project.urls]
29
+ Homepage = "https://github.com/wilkinsonjacob/papyrust"
30
+ Repository = "https://github.com/wilkinsonjacob/papyrust"
31
+ Issues = "https://github.com/wilkinsonjacob/papyrust/issues"
32
+
33
+ [tool.pytest.ini_options]
34
+ pythonpath = ["src"]
35
+ testpaths = ["tests"]
36
+
37
+ [dependency-groups]
38
+ dev = [
39
+ "commitizen>=4.19.3",
40
+ "pre-commit>=4.7.0",
41
+ "pytest>=9.2.0",
42
+ "ruff>=0.17.4",
43
+ "ty>=0.0.100",
44
+ ]
45
+
46
+ [tool.ty.environment]
47
+ root = ["./src"]
48
+
49
+ [tool.ruff.lint]
50
+ select = ["E", "F", "I", "UP", "B"]
51
+
52
+ [tool.commitizen]
53
+ name = "cz_conventional_commits"
54
+ version_provider = "uv"
55
+ tag_format = "v$version"
56
+ update_changelog_on_bump = true
57
+ major_version_zero = true
@@ -0,0 +1,3 @@
1
+ from .result import Err, Ok, Result
2
+
3
+ __all__ = ["Err", "Ok", "Result"]
File without changes
@@ -0,0 +1,5 @@
1
+ from .err import Err
2
+ from .ok import Ok
3
+ from .result import Result
4
+
5
+ __all__ = ["Err", "Ok", "Result"]
@@ -0,0 +1,17 @@
1
+ from collections.abc import Callable
2
+ from dataclasses import dataclass
3
+ from typing import Never
4
+
5
+
6
+ @dataclass(frozen=True, slots=True)
7
+ class Err[E]:
8
+ error: E
9
+
10
+ def map(self, f: Callable[[Never], object]) -> "Err[E]":
11
+ return self
12
+
13
+ def is_ok(self) -> bool:
14
+ return False
15
+
16
+ def is_err(self) -> bool:
17
+ return True
@@ -0,0 +1,16 @@
1
+ from collections.abc import Callable
2
+ from dataclasses import dataclass
3
+
4
+
5
+ @dataclass(frozen=True, slots=True)
6
+ class Ok[T]:
7
+ value: T
8
+
9
+ def map[U](self, f: Callable[[T], U]) -> "Ok[U]":
10
+ return Ok(f(self.value))
11
+
12
+ def is_ok(self) -> bool:
13
+ return True
14
+
15
+ def is_err(self) -> bool:
16
+ return False
@@ -0,0 +1,4 @@
1
+ from .err import Err
2
+ from .ok import Ok
3
+
4
+ type Result[T, E] = Ok[T] | Err[E]