localbucket 1.2.1__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,5 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .ruff_cache/
4
+ build/
5
+ dist/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Selcuk Ayguney
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,107 @@
1
+ Metadata-Version: 2.5
2
+ Name: localbucket
3
+ Version: 1.2.1
4
+ Summary: Minimal S3-compatible server that stores buckets as plain folders on disk, for local development and testing.
5
+ Project-URL: Homepage, https://github.com/selcuk/localbucket
6
+ Project-URL: Issues, https://github.com/selcuk/localbucket/issues
7
+ Author: Selcuk Ayguney
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Keywords: aws,boto3,django,emulator,mock,s3,testing
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
18
+ Classifier: Topic :: Software Development :: Testing
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+
22
+ # LocalBucket
23
+
24
+ LocalBucket is a minimal S3-compatible HTTP server that stores buckets as
25
+ folders on a local directory. It is a single Python script for Python 3.10
26
+ and newer, with no dependencies beyond the standard library, meant for
27
+ local development and testing against S3 clients such as boto3 and the AWS
28
+ CLI.
29
+
30
+ Each bucket is a folder under the data directory and each object is a
31
+ regular file, so you can inspect and change the stored data with ordinary
32
+ file tools.
33
+
34
+ ## Installation
35
+
36
+ ```sh
37
+ uv tool install localbucket # or: pipx install localbucket
38
+ ```
39
+
40
+ You can also run it without installing, with `uvx localbucket ./data`, or
41
+ copy `localbucket.py` anywhere and run it with `python3 localbucket.py`.
42
+
43
+ ## Usage
44
+
45
+ ```sh
46
+ localbucket ./data
47
+ ```
48
+
49
+ This serves `./data` on `http://127.0.0.1:9000`. Use `--host` and `--port`
50
+ to change the address.
51
+
52
+ Point a client at the server with path-style addressing. Credentials are not
53
+ checked, so any access key and secret will do:
54
+
55
+ ```sh
56
+ aws --endpoint-url http://127.0.0.1:9000 s3 mb s3://mybucket
57
+ aws --endpoint-url http://127.0.0.1:9000 s3 cp file.txt s3://mybucket/
58
+ ```
59
+
60
+ ```python
61
+ import boto3
62
+ from botocore.config import Config
63
+
64
+ s3 = boto3.client(
65
+ "s3",
66
+ endpoint_url="http://127.0.0.1:9000",
67
+ aws_access_key_id="test",
68
+ aws_secret_access_key="test",
69
+ region_name="us-east-1",
70
+ config=Config(s3={"addressing_style": "path"}),
71
+ )
72
+ ```
73
+
74
+ ## Supported operations
75
+
76
+ - Buckets: ListBuckets, CreateBucket, HeadBucket, and DeleteBucket (empty
77
+ buckets only)
78
+ - Objects: ListObjects, ListObjectsV2, PutObject (including
79
+ `If-None-Match: *`), GetObject and HeadObject (including `Range` and
80
+ `response-*` header overrides such as `response-content-disposition`),
81
+ CopyObject, DeleteObject
82
+ - Multipart uploads: CreateMultipartUpload, UploadPart, UploadPartCopy,
83
+ CompleteMultipartUpload, AbortMultipartUpload
84
+ - GetObjectTagging, which always returns an empty tag set because tags are
85
+ not stored
86
+
87
+ Requests with any other query parameter, such as ACL or tagging changes,
88
+ return `501 NotImplemented` and do not change anything. Virtual-hosted-style
89
+ URLs, authentication and versioning are not supported. Object metadata is
90
+ not stored either: `Content-Type` is guessed from the key's file extension.
91
+
92
+ Unfinished multipart uploads are kept in `DATA_ROOT/.localbucket-uploads`.
93
+
94
+ CORS is open: requests from any origin are allowed, including `OPTIONS`
95
+ preflights, so browser code on your development site can call LocalBucket
96
+ directly. Any web page you open can also read from it while it runs, so
97
+ keep it on `127.0.0.1` and don't store anything sensitive in it.
98
+
99
+ ## Testing
100
+
101
+ The test suite starts LocalBucket on a temporary directory and checks its
102
+ behaviour with boto3. It is a [uv](https://docs.astral.sh/uv/) script that
103
+ declares its own dependencies:
104
+
105
+ ```sh
106
+ uv run test_localbucket.py
107
+ ```
@@ -0,0 +1,86 @@
1
+ # LocalBucket
2
+
3
+ LocalBucket is a minimal S3-compatible HTTP server that stores buckets as
4
+ folders on a local directory. It is a single Python script for Python 3.10
5
+ and newer, with no dependencies beyond the standard library, meant for
6
+ local development and testing against S3 clients such as boto3 and the AWS
7
+ CLI.
8
+
9
+ Each bucket is a folder under the data directory and each object is a
10
+ regular file, so you can inspect and change the stored data with ordinary
11
+ file tools.
12
+
13
+ ## Installation
14
+
15
+ ```sh
16
+ uv tool install localbucket # or: pipx install localbucket
17
+ ```
18
+
19
+ You can also run it without installing, with `uvx localbucket ./data`, or
20
+ copy `localbucket.py` anywhere and run it with `python3 localbucket.py`.
21
+
22
+ ## Usage
23
+
24
+ ```sh
25
+ localbucket ./data
26
+ ```
27
+
28
+ This serves `./data` on `http://127.0.0.1:9000`. Use `--host` and `--port`
29
+ to change the address.
30
+
31
+ Point a client at the server with path-style addressing. Credentials are not
32
+ checked, so any access key and secret will do:
33
+
34
+ ```sh
35
+ aws --endpoint-url http://127.0.0.1:9000 s3 mb s3://mybucket
36
+ aws --endpoint-url http://127.0.0.1:9000 s3 cp file.txt s3://mybucket/
37
+ ```
38
+
39
+ ```python
40
+ import boto3
41
+ from botocore.config import Config
42
+
43
+ s3 = boto3.client(
44
+ "s3",
45
+ endpoint_url="http://127.0.0.1:9000",
46
+ aws_access_key_id="test",
47
+ aws_secret_access_key="test",
48
+ region_name="us-east-1",
49
+ config=Config(s3={"addressing_style": "path"}),
50
+ )
51
+ ```
52
+
53
+ ## Supported operations
54
+
55
+ - Buckets: ListBuckets, CreateBucket, HeadBucket, and DeleteBucket (empty
56
+ buckets only)
57
+ - Objects: ListObjects, ListObjectsV2, PutObject (including
58
+ `If-None-Match: *`), GetObject and HeadObject (including `Range` and
59
+ `response-*` header overrides such as `response-content-disposition`),
60
+ CopyObject, DeleteObject
61
+ - Multipart uploads: CreateMultipartUpload, UploadPart, UploadPartCopy,
62
+ CompleteMultipartUpload, AbortMultipartUpload
63
+ - GetObjectTagging, which always returns an empty tag set because tags are
64
+ not stored
65
+
66
+ Requests with any other query parameter, such as ACL or tagging changes,
67
+ return `501 NotImplemented` and do not change anything. Virtual-hosted-style
68
+ URLs, authentication and versioning are not supported. Object metadata is
69
+ not stored either: `Content-Type` is guessed from the key's file extension.
70
+
71
+ Unfinished multipart uploads are kept in `DATA_ROOT/.localbucket-uploads`.
72
+
73
+ CORS is open: requests from any origin are allowed, including `OPTIONS`
74
+ preflights, so browser code on your development site can call LocalBucket
75
+ directly. Any web page you open can also read from it while it runs, so
76
+ keep it on `127.0.0.1` and don't store anything sensitive in it.
77
+
78
+ ## Testing
79
+
80
+ The test suite starts LocalBucket on a temporary directory and checks its
81
+ behaviour with boto3. It is a [uv](https://docs.astral.sh/uv/) script that
82
+ declares its own dependencies:
83
+
84
+ ```sh
85
+ uv run test_localbucket.py
86
+ ```