fastar 0.2.0__cp312-cp312-macosx_11_0_arm64.whl

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.

Potentially problematic release.


This version of fastar might be problematic. Click here for more details.

fastar/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ from .fastar import *
2
+
3
+ __doc__ = fastar.__doc__
4
+ if hasattr(fastar, "__all__"):
5
+ __all__ = fastar.__all__
fastar/__init__.pyi ADDED
@@ -0,0 +1,128 @@
1
+ from typing import Literal, overload
2
+ from typing_extensions import Self
3
+ from pathlib import Path
4
+ from os import PathLike
5
+
6
+ class ArchiveWriter:
7
+ """A tar archive writer that supports compressed and uncompressed formats."""
8
+
9
+ @classmethod
10
+ def open(
11
+ cls, path: str | Path | PathLike[str], mode: Literal["w", "w:gz"] = "w:gz"
12
+ ) -> Self:
13
+ """
14
+ Open a tar archive for writing.
15
+
16
+ Args:
17
+ path: Path to the archive file to create
18
+ mode: Write mode - 'w' for uncompressed, 'w:gz' for gzip compressed (default)
19
+
20
+ Returns:
21
+ An ArchiveWriter instance
22
+
23
+ Raises:
24
+ RuntimeError: If an unsupported mode is provided
25
+ """
26
+
27
+ def add(
28
+ self,
29
+ path: str | Path | PathLike[str],
30
+ arcname: str | None = None,
31
+ recursive: bool = True,
32
+ dereference: bool = False,
33
+ ) -> None:
34
+ """
35
+ Add a file or directory to the archive.
36
+
37
+ Args:
38
+ path: Path to the file or directory to add
39
+ arcname: Name to use in the archive (defaults to the filename)
40
+ recursive: If True and path is a directory, add all contents recursively
41
+ dereference: If True, add the target of symlinks instead of the symlink itself
42
+
43
+ Raises:
44
+ RuntimeError: If the archive is closed or the path doesn't exist
45
+ """
46
+
47
+ def close(self) -> None:
48
+ """
49
+ Close the archive and flush all pending writes.
50
+
51
+ Raises:
52
+ RuntimeError: If there's an error flushing the writer
53
+ """
54
+
55
+ def __enter__(self) -> Self:
56
+ """Enter the context manager."""
57
+
58
+ def __exit__(self, exc_type, exc_value, traceback) -> bool:
59
+ """Exit the context manager, closing the archive."""
60
+
61
+ class ArchiveReader:
62
+ """A tar archive reader that supports compressed and uncompressed formats."""
63
+
64
+ @classmethod
65
+ def open(
66
+ cls, path: str | Path | PathLike[str], mode: Literal["r", "r:gz"] = "r:gz"
67
+ ) -> Self:
68
+ """
69
+ Open a tar archive for reading.
70
+
71
+ Args:
72
+ path: Path to the archive file to read
73
+ mode: Read mode - 'r' for uncompressed, 'r:gz' for gzip compressed (default)
74
+
75
+ Returns:
76
+ An ArchiveReader instance
77
+
78
+ Raises:
79
+ RuntimeError: If an unsupported mode is provided
80
+ IOError: If the file cannot be opened
81
+ """
82
+
83
+ def extract(self, to: str | Path | PathLike[str]) -> None:
84
+ """
85
+ Extract all contents of the archive to the specified directory.
86
+
87
+ Args:
88
+ to: Destination directory path
89
+
90
+ Raises:
91
+ RuntimeError: If the archive is closed
92
+ IOError: If extraction fails
93
+ """
94
+
95
+ def close(self) -> None:
96
+ """Close the archive."""
97
+
98
+ def __enter__(self) -> Self:
99
+ """Enter the context manager."""
100
+
101
+ def __exit__(self, exc_type, exc_value, traceback) -> bool:
102
+ """Exit the context manager, closing the archive."""
103
+
104
+ @overload
105
+ def open(path: str | Path | PathLike[str], mode: Literal["w", "w:gz"]) -> ArchiveWriter:
106
+ """
107
+ Open a tar archive for writing.
108
+
109
+ Args:
110
+ path: Path to the archive file to create
111
+ mode: Write mode - 'w' for uncompressed, 'w:gz' for gzip compressed
112
+
113
+ Returns:
114
+ An ArchiveWriter instance
115
+ """
116
+
117
+ @overload
118
+ def open(path: str | Path | PathLike[str], mode: Literal["r", "r:gz"]) -> ArchiveReader:
119
+ """
120
+ Open a tar archive for reading.
121
+
122
+ Args:
123
+ path: Path to the archive file to read
124
+ mode: Read mode - 'r' for uncompressed, 'r:gz' for gzip compressed
125
+
126
+ Returns:
127
+ An ArchiveReader instance
128
+ """
Binary file
fastar/py.typed ADDED
File without changes
@@ -0,0 +1,82 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastar
3
+ Version: 0.2.0
4
+ Classifier: Intended Audience :: Developers
5
+ Classifier: License :: OSI Approved :: MIT License
6
+ Classifier: Operating System :: OS Independent
7
+ Classifier: Programming Language :: Rust
8
+ Classifier: Programming Language :: Python
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Classifier: Programming Language :: Python :: Implementation :: CPython
16
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
17
+ Classifier: Topic :: Software Development :: Libraries
18
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
+ License-File: LICENSE
20
+ Summary: High-level bindings for the Rust tar crate
21
+ Author-email: Jonathan Ehwald <github@ehwald.info>
22
+ License-Expression: MIT
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
25
+ Project-URL: homepage, https://github.com/DoctorJohn/fastar
26
+ Project-URL: repository, https://github.com/DoctorJohn/fastar
27
+ Project-URL: documentation, https://github.com/DoctorJohn/fastar
28
+
29
+ # Fastar
30
+
31
+ [![Versions][versions-image]][versions-url]
32
+ [![PyPI][pypi-image]][pypi-url]
33
+ [![Downloads][downloads-image]][downloads-url]
34
+ [![License][license-image]][license-url]
35
+
36
+ [versions-image]: https://img.shields.io/pypi/pyversions/fastar
37
+ [versions-url]: https://github.com/DoctorJohn/fastar/blob/main/pyproject.toml
38
+ [pypi-image]: https://img.shields.io/pypi/v/fastar
39
+ [pypi-url]: https://pypi.org/project/fastar/
40
+ [downloads-image]: https://img.shields.io/pypi/dm/fastar
41
+ [downloads-url]: https://pypi.org/project/fastar/
42
+ [license-image]: https://img.shields.io/pypi/l/fastar
43
+ [license-url]: https://github.com/DoctorJohn/fastar/blob/main/LICENSE
44
+
45
+ High-level bindings for the Rust [tar](https://crates.io/crates/tar) crate.
46
+
47
+ ## Installation
48
+
49
+ ```sh
50
+ pip install fastar
51
+ ```
52
+
53
+ ## Usage
54
+
55
+ ```python
56
+ import fastar
57
+ from pathlib import Path
58
+
59
+
60
+ some_file = Path('file.txt')
61
+ some_file.write_text('Hello, Fastar!')
62
+
63
+
64
+ with fastar.open('archive.tar', 'w') as archive:
65
+ archive.add(some_file)
66
+
67
+
68
+ with fastar.open('archive.tar', 'r') as archive:
69
+ archive.extract(Path("extracted/"))
70
+
71
+
72
+ extracted_file = Path('extracted/file.txt')
73
+ print(extracted_file.read_text()) # Hello, Fastar!
74
+ ```
75
+
76
+ ## Development
77
+
78
+ 1. Install dependencies into a virtual env: `uv sync`
79
+ 2. Make changes to the code and tests
80
+ 3. Build the package: `uv run maturin develop`
81
+ 4. Run the tests: `uv run pytest`
82
+
@@ -0,0 +1,8 @@
1
+ fastar-0.2.0.dist-info/METADATA,sha256=wo4Mqaa5FAdt40s7FyalyHOcd5F4RKWhx0R5G9gE_7o,2637
2
+ fastar-0.2.0.dist-info/WHEEL,sha256=nw13728gRokCivwI6SCanennWBgDOflh2lHvovMwAi8,104
3
+ fastar-0.2.0.dist-info/licenses/LICENSE,sha256=rYGQpMiiUoV5IPve_SRv0E-Ci8BMj0TaNs5jSu3d6xo,1054
4
+ fastar/__init__.py,sha256=mU2iZJ--coorw9PWKBK1JbU9C_N5EqCZQ-b7YvPFBWw,107
5
+ fastar/__init__.pyi,sha256=DWpgf68qq1JbG8AmYn7FTkvyawIF1oVloZ5UhrQZ1Zw,3677
6
+ fastar/fastar.cpython-312-darwin.so,sha256=UU_yLeX4q4A2Obt4ahfI6YFa1teSAWmbcKHQC_FJIZs,837184
7
+ fastar/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ fastar-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.9.6)
3
+ Root-Is-Purelib: false
4
+ Tag: cp312-cp312-macosx_11_0_arm64
@@ -0,0 +1,7 @@
1
+ Copyright 2025 Jonathan Ehwald
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.