fs-s3fs-next 0.1.0__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.
- fs_s3fs_next-0.1.0/LICENSE +21 -0
- fs_s3fs_next-0.1.0/MANIFEST.in +2 -0
- fs_s3fs_next-0.1.0/PKG-INFO +206 -0
- fs_s3fs_next-0.1.0/README.rst +163 -0
- fs_s3fs_next-0.1.0/fs_s3fs/__init__.py +2 -0
- fs_s3fs_next-0.1.0/fs_s3fs/_s3fs.py +835 -0
- fs_s3fs_next-0.1.0/fs_s3fs/_version.py +1 -0
- fs_s3fs_next-0.1.0/fs_s3fs/opener.py +38 -0
- fs_s3fs_next-0.1.0/fs_s3fs_next.egg-info/PKG-INFO +206 -0
- fs_s3fs_next-0.1.0/fs_s3fs_next.egg-info/SOURCES.txt +18 -0
- fs_s3fs_next-0.1.0/fs_s3fs_next.egg-info/dependency_links.txt +1 -0
- fs_s3fs_next-0.1.0/fs_s3fs_next.egg-info/entry_points.txt +2 -0
- fs_s3fs_next-0.1.0/fs_s3fs_next.egg-info/requires.txt +3 -0
- fs_s3fs_next-0.1.0/fs_s3fs_next.egg-info/top_level.txt +1 -0
- fs_s3fs_next-0.1.0/pyproject.toml +6 -0
- fs_s3fs_next-0.1.0/setup.cfg +6 -0
- fs_s3fs_next-0.1.0/setup.py +49 -0
- fs_s3fs_next-0.1.0/tests/test_fs_next.py +69 -0
- fs_s3fs_next-0.1.0/tests/test_helpers.py +40 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017 PyFilesystem
|
|
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,206 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fs-s3fs-next
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Amazon S3 filesystem for FS Next, an independent fs-s3fs maintenance fork
|
|
5
|
+
Home-page: https://github.com/kmsk99/fs-s3fs-next
|
|
6
|
+
Author: Will McGugan
|
|
7
|
+
Author-email: willmcgugan@gmail.com
|
|
8
|
+
Maintainer: Mason Kim
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: pyfilesystem,Amazon,s3
|
|
11
|
+
Platform: any
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
22
|
+
Classifier: Topic :: System :: Filesystems
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/x-rst
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: boto3~=1.9
|
|
27
|
+
Requires-Dist: fs-next<0.2,>=0.1.1
|
|
28
|
+
Requires-Dist: six~=1.10
|
|
29
|
+
Dynamic: author
|
|
30
|
+
Dynamic: author-email
|
|
31
|
+
Dynamic: classifier
|
|
32
|
+
Dynamic: description
|
|
33
|
+
Dynamic: description-content-type
|
|
34
|
+
Dynamic: home-page
|
|
35
|
+
Dynamic: keywords
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
Dynamic: license-expression
|
|
38
|
+
Dynamic: maintainer
|
|
39
|
+
Dynamic: platform
|
|
40
|
+
Dynamic: requires-dist
|
|
41
|
+
Dynamic: requires-python
|
|
42
|
+
Dynamic: summary
|
|
43
|
+
|
|
44
|
+
FS S3FS Next
|
|
45
|
+
============
|
|
46
|
+
|
|
47
|
+
S3FS is a `PyFilesystem <https://www.pyfilesystem.org/>`__ interface to
|
|
48
|
+
Amazon S3 cloud storage.
|
|
49
|
+
|
|
50
|
+
As a PyFilesystem concrete class,
|
|
51
|
+
`S3FS <http://fs-s3fs.readthedocs.io/en/latest/>`__ allows you to work
|
|
52
|
+
with S3 in the same way as any other supported filesystem.
|
|
53
|
+
|
|
54
|
+
Independent maintenance fork of `PyFilesystem/s3fs <https://github.com/PyFilesystem/s3fs>`_
|
|
55
|
+
by Will McGugan and contributors. Original MIT license and Git history are
|
|
56
|
+
preserved. This is not an official PyFilesystem release. Requires Python 3.10+;
|
|
57
|
+
uses `FS Next <https://github.com/kmsk99/fs-next>`_ while retaining the
|
|
58
|
+
``fs_s3fs`` import and ``s3://`` opener.
|
|
59
|
+
|
|
60
|
+
Migration
|
|
61
|
+
---------
|
|
62
|
+
|
|
63
|
+
Create a fresh virtual environment and replace ``fs-s3fs`` with
|
|
64
|
+
``fs-s3fs-next`` and ``fs`` with ``fs-next`` in your dependency declarations.
|
|
65
|
+
Regenerate lock files. Do not install either pair together: they provide the
|
|
66
|
+
same Python modules, and uninstalling one can break the other. Packages that
|
|
67
|
+
still require ``fs`` or ``fs-s3fs`` must update their dependency metadata first.
|
|
68
|
+
A constraints file cannot substitute distribution names.
|
|
69
|
+
|
|
70
|
+
::
|
|
71
|
+
|
|
72
|
+
python -m venv .venv-next
|
|
73
|
+
# Activate the environment, then:
|
|
74
|
+
python -m pip install fs-s3fs-next==0.1.0
|
|
75
|
+
python -m pip check
|
|
76
|
+
|
|
77
|
+
For uv or Poetry projects, make the same declaration replacements, regenerate
|
|
78
|
+
the lock, and sync into a fresh environment. The fork uses its own version
|
|
79
|
+
series: 0.1.0 is based on upstream 1.1.1 plus compatibility fixes.
|
|
80
|
+
To roll back, restore the previous declarations and lock into another fresh
|
|
81
|
+
environment rather than co-installing the packages.
|
|
82
|
+
|
|
83
|
+
Installing
|
|
84
|
+
----------
|
|
85
|
+
|
|
86
|
+
You can install S3FS from pip as follows:
|
|
87
|
+
|
|
88
|
+
::
|
|
89
|
+
|
|
90
|
+
python -m pip install fs-s3fs-next
|
|
91
|
+
|
|
92
|
+
Opening a S3FS
|
|
93
|
+
--------------
|
|
94
|
+
|
|
95
|
+
Open an S3FS by explicitly using the constructor:
|
|
96
|
+
|
|
97
|
+
.. code:: python
|
|
98
|
+
|
|
99
|
+
from fs_s3fs import S3FS
|
|
100
|
+
s3fs = S3FS('mybucket')
|
|
101
|
+
|
|
102
|
+
Or with a FS URL:
|
|
103
|
+
|
|
104
|
+
.. code:: python
|
|
105
|
+
|
|
106
|
+
from fs import open_fs
|
|
107
|
+
s3fs = open_fs('s3://mybucket')
|
|
108
|
+
|
|
109
|
+
Downloading Files
|
|
110
|
+
-----------------
|
|
111
|
+
|
|
112
|
+
To *download* files from an S3 bucket, open a file on the S3 filesystem
|
|
113
|
+
for reading, then write the data to a file on the local filesystem.
|
|
114
|
+
Here's an example that copies a file ``example.mov`` from S3 to your HD:
|
|
115
|
+
|
|
116
|
+
.. code:: python
|
|
117
|
+
|
|
118
|
+
from fs.tools import copy_file_data
|
|
119
|
+
with s3fs.open('example.mov', 'rb') as remote_file:
|
|
120
|
+
with open('example.mov', 'wb') as local_file:
|
|
121
|
+
copy_file_data(remote_file, local_file)
|
|
122
|
+
|
|
123
|
+
Although it is preferable to use the higher-level functionality in the
|
|
124
|
+
``fs.copy`` module. Here's an example:
|
|
125
|
+
|
|
126
|
+
.. code:: python
|
|
127
|
+
|
|
128
|
+
from fs.copy import copy_file
|
|
129
|
+
copy_file(s3fs, 'example.mov', './', 'example.mov')
|
|
130
|
+
|
|
131
|
+
Uploading Files
|
|
132
|
+
---------------
|
|
133
|
+
|
|
134
|
+
You can *upload* files in the same way. Simply copy a file from a source
|
|
135
|
+
filesystem to the S3 filesystem. See `Moving and
|
|
136
|
+
Copying <https://docs.pyfilesystem.org/en/latest/guide.html#moving-and-copying>`__
|
|
137
|
+
for more information.
|
|
138
|
+
|
|
139
|
+
ExtraArgs
|
|
140
|
+
---------
|
|
141
|
+
|
|
142
|
+
S3 objects have additional properties, beyond a traditional filesystem.
|
|
143
|
+
These options can be set using the ``upload_args`` and ``download_args``
|
|
144
|
+
properties. which are handed to upload and download methods, as
|
|
145
|
+
appropriate, for the lifetime of the filesystem instance.
|
|
146
|
+
|
|
147
|
+
For example, to set the ``cache-control`` header of all objects uploaded
|
|
148
|
+
to a bucket:
|
|
149
|
+
|
|
150
|
+
.. code:: python
|
|
151
|
+
|
|
152
|
+
import fs, fs.mirror
|
|
153
|
+
s3fs = S3FS('example', upload_args={"CacheControl": "max-age=2592000", "ACL": "public-read"})
|
|
154
|
+
fs.mirror.mirror('/path/to/mirror', s3fs)
|
|
155
|
+
|
|
156
|
+
see `the Boto3
|
|
157
|
+
docs <https://boto3.readthedocs.io/en/latest/reference/customizations/s3.html#boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS>`__
|
|
158
|
+
for more information.
|
|
159
|
+
|
|
160
|
+
``acl`` and ``cache_control`` are exposed explicitly for convenience,
|
|
161
|
+
and can be used in URLs. It is important to URL-Escape the
|
|
162
|
+
``cache_control`` value in a URL, as it may contain special characters.
|
|
163
|
+
|
|
164
|
+
.. code:: python
|
|
165
|
+
|
|
166
|
+
import fs, fs.mirror
|
|
167
|
+
with fs.open_fs('s3://example?acl=public-read&cache_control=max-age%3D2592000%2Cpublic') as s3fs:
|
|
168
|
+
fs.mirror.mirror('/path/to/mirror', s3fs)
|
|
169
|
+
|
|
170
|
+
S3 URLs
|
|
171
|
+
-------
|
|
172
|
+
|
|
173
|
+
You can get a public URL to a file on a S3 bucket as follows:
|
|
174
|
+
|
|
175
|
+
.. code:: python
|
|
176
|
+
|
|
177
|
+
movie_url = s3fs.geturl('example.mov')
|
|
178
|
+
|
|
179
|
+
Documentation
|
|
180
|
+
-------------
|
|
181
|
+
|
|
182
|
+
- `PyFilesystem Wiki <https://www.pyfilesystem.org>`__
|
|
183
|
+
- `S3FS Reference <http://fs-s3fs.readthedocs.io/en/latest/>`__
|
|
184
|
+
- `PyFilesystem
|
|
185
|
+
Reference <https://docs.pyfilesystem.org/en/latest/reference/base.html>`__
|
|
186
|
+
|
|
187
|
+
FS Next migration for Python 3.10+
|
|
188
|
+
----------------------------------
|
|
189
|
+
|
|
190
|
+
The migration includes ``preserve_time`` argument compatibility, safe same-path
|
|
191
|
+
copy/move handling and binary stream ``mode`` / ``readinto`` corrections.
|
|
192
|
+
S3 controls LastModified timestamps; ``preserve_time=True`` is best effort and
|
|
193
|
+
does not preserve S3's LastModified value (``setinfo`` cannot change it).
|
|
194
|
+
|
|
195
|
+
To run the complete FS Next contract on bucket roots and prefixes without an
|
|
196
|
+
AWS account or credentials::
|
|
197
|
+
|
|
198
|
+
python -m pip install . pytest "moto[s3]==5.2.3"
|
|
199
|
+
python -m pip check
|
|
200
|
+
python -I -m pytest tests/test_fs_next.py -q -ra
|
|
201
|
+
|
|
202
|
+
Moto exercises local S3 API behavior. It does not certify live AWS IAM,
|
|
203
|
+
network failures or provider-specific behavior. This package is independently maintained and released. Related upstream fixes
|
|
204
|
+
were already proposed in `PR #81 <https://github.com/PyFilesystem/s3fs/pull/81>`_
|
|
205
|
+
(readinto) and `PR #92 <https://github.com/PyFilesystem/s3fs/pull/92>`_
|
|
206
|
+
(preserve_time); the contract suite reproduces those failures.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
FS S3FS Next
|
|
2
|
+
============
|
|
3
|
+
|
|
4
|
+
S3FS is a `PyFilesystem <https://www.pyfilesystem.org/>`__ interface to
|
|
5
|
+
Amazon S3 cloud storage.
|
|
6
|
+
|
|
7
|
+
As a PyFilesystem concrete class,
|
|
8
|
+
`S3FS <http://fs-s3fs.readthedocs.io/en/latest/>`__ allows you to work
|
|
9
|
+
with S3 in the same way as any other supported filesystem.
|
|
10
|
+
|
|
11
|
+
Independent maintenance fork of `PyFilesystem/s3fs <https://github.com/PyFilesystem/s3fs>`_
|
|
12
|
+
by Will McGugan and contributors. Original MIT license and Git history are
|
|
13
|
+
preserved. This is not an official PyFilesystem release. Requires Python 3.10+;
|
|
14
|
+
uses `FS Next <https://github.com/kmsk99/fs-next>`_ while retaining the
|
|
15
|
+
``fs_s3fs`` import and ``s3://`` opener.
|
|
16
|
+
|
|
17
|
+
Migration
|
|
18
|
+
---------
|
|
19
|
+
|
|
20
|
+
Create a fresh virtual environment and replace ``fs-s3fs`` with
|
|
21
|
+
``fs-s3fs-next`` and ``fs`` with ``fs-next`` in your dependency declarations.
|
|
22
|
+
Regenerate lock files. Do not install either pair together: they provide the
|
|
23
|
+
same Python modules, and uninstalling one can break the other. Packages that
|
|
24
|
+
still require ``fs`` or ``fs-s3fs`` must update their dependency metadata first.
|
|
25
|
+
A constraints file cannot substitute distribution names.
|
|
26
|
+
|
|
27
|
+
::
|
|
28
|
+
|
|
29
|
+
python -m venv .venv-next
|
|
30
|
+
# Activate the environment, then:
|
|
31
|
+
python -m pip install fs-s3fs-next==0.1.0
|
|
32
|
+
python -m pip check
|
|
33
|
+
|
|
34
|
+
For uv or Poetry projects, make the same declaration replacements, regenerate
|
|
35
|
+
the lock, and sync into a fresh environment. The fork uses its own version
|
|
36
|
+
series: 0.1.0 is based on upstream 1.1.1 plus compatibility fixes.
|
|
37
|
+
To roll back, restore the previous declarations and lock into another fresh
|
|
38
|
+
environment rather than co-installing the packages.
|
|
39
|
+
|
|
40
|
+
Installing
|
|
41
|
+
----------
|
|
42
|
+
|
|
43
|
+
You can install S3FS from pip as follows:
|
|
44
|
+
|
|
45
|
+
::
|
|
46
|
+
|
|
47
|
+
python -m pip install fs-s3fs-next
|
|
48
|
+
|
|
49
|
+
Opening a S3FS
|
|
50
|
+
--------------
|
|
51
|
+
|
|
52
|
+
Open an S3FS by explicitly using the constructor:
|
|
53
|
+
|
|
54
|
+
.. code:: python
|
|
55
|
+
|
|
56
|
+
from fs_s3fs import S3FS
|
|
57
|
+
s3fs = S3FS('mybucket')
|
|
58
|
+
|
|
59
|
+
Or with a FS URL:
|
|
60
|
+
|
|
61
|
+
.. code:: python
|
|
62
|
+
|
|
63
|
+
from fs import open_fs
|
|
64
|
+
s3fs = open_fs('s3://mybucket')
|
|
65
|
+
|
|
66
|
+
Downloading Files
|
|
67
|
+
-----------------
|
|
68
|
+
|
|
69
|
+
To *download* files from an S3 bucket, open a file on the S3 filesystem
|
|
70
|
+
for reading, then write the data to a file on the local filesystem.
|
|
71
|
+
Here's an example that copies a file ``example.mov`` from S3 to your HD:
|
|
72
|
+
|
|
73
|
+
.. code:: python
|
|
74
|
+
|
|
75
|
+
from fs.tools import copy_file_data
|
|
76
|
+
with s3fs.open('example.mov', 'rb') as remote_file:
|
|
77
|
+
with open('example.mov', 'wb') as local_file:
|
|
78
|
+
copy_file_data(remote_file, local_file)
|
|
79
|
+
|
|
80
|
+
Although it is preferable to use the higher-level functionality in the
|
|
81
|
+
``fs.copy`` module. Here's an example:
|
|
82
|
+
|
|
83
|
+
.. code:: python
|
|
84
|
+
|
|
85
|
+
from fs.copy import copy_file
|
|
86
|
+
copy_file(s3fs, 'example.mov', './', 'example.mov')
|
|
87
|
+
|
|
88
|
+
Uploading Files
|
|
89
|
+
---------------
|
|
90
|
+
|
|
91
|
+
You can *upload* files in the same way. Simply copy a file from a source
|
|
92
|
+
filesystem to the S3 filesystem. See `Moving and
|
|
93
|
+
Copying <https://docs.pyfilesystem.org/en/latest/guide.html#moving-and-copying>`__
|
|
94
|
+
for more information.
|
|
95
|
+
|
|
96
|
+
ExtraArgs
|
|
97
|
+
---------
|
|
98
|
+
|
|
99
|
+
S3 objects have additional properties, beyond a traditional filesystem.
|
|
100
|
+
These options can be set using the ``upload_args`` and ``download_args``
|
|
101
|
+
properties. which are handed to upload and download methods, as
|
|
102
|
+
appropriate, for the lifetime of the filesystem instance.
|
|
103
|
+
|
|
104
|
+
For example, to set the ``cache-control`` header of all objects uploaded
|
|
105
|
+
to a bucket:
|
|
106
|
+
|
|
107
|
+
.. code:: python
|
|
108
|
+
|
|
109
|
+
import fs, fs.mirror
|
|
110
|
+
s3fs = S3FS('example', upload_args={"CacheControl": "max-age=2592000", "ACL": "public-read"})
|
|
111
|
+
fs.mirror.mirror('/path/to/mirror', s3fs)
|
|
112
|
+
|
|
113
|
+
see `the Boto3
|
|
114
|
+
docs <https://boto3.readthedocs.io/en/latest/reference/customizations/s3.html#boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS>`__
|
|
115
|
+
for more information.
|
|
116
|
+
|
|
117
|
+
``acl`` and ``cache_control`` are exposed explicitly for convenience,
|
|
118
|
+
and can be used in URLs. It is important to URL-Escape the
|
|
119
|
+
``cache_control`` value in a URL, as it may contain special characters.
|
|
120
|
+
|
|
121
|
+
.. code:: python
|
|
122
|
+
|
|
123
|
+
import fs, fs.mirror
|
|
124
|
+
with fs.open_fs('s3://example?acl=public-read&cache_control=max-age%3D2592000%2Cpublic') as s3fs:
|
|
125
|
+
fs.mirror.mirror('/path/to/mirror', s3fs)
|
|
126
|
+
|
|
127
|
+
S3 URLs
|
|
128
|
+
-------
|
|
129
|
+
|
|
130
|
+
You can get a public URL to a file on a S3 bucket as follows:
|
|
131
|
+
|
|
132
|
+
.. code:: python
|
|
133
|
+
|
|
134
|
+
movie_url = s3fs.geturl('example.mov')
|
|
135
|
+
|
|
136
|
+
Documentation
|
|
137
|
+
-------------
|
|
138
|
+
|
|
139
|
+
- `PyFilesystem Wiki <https://www.pyfilesystem.org>`__
|
|
140
|
+
- `S3FS Reference <http://fs-s3fs.readthedocs.io/en/latest/>`__
|
|
141
|
+
- `PyFilesystem
|
|
142
|
+
Reference <https://docs.pyfilesystem.org/en/latest/reference/base.html>`__
|
|
143
|
+
|
|
144
|
+
FS Next migration for Python 3.10+
|
|
145
|
+
----------------------------------
|
|
146
|
+
|
|
147
|
+
The migration includes ``preserve_time`` argument compatibility, safe same-path
|
|
148
|
+
copy/move handling and binary stream ``mode`` / ``readinto`` corrections.
|
|
149
|
+
S3 controls LastModified timestamps; ``preserve_time=True`` is best effort and
|
|
150
|
+
does not preserve S3's LastModified value (``setinfo`` cannot change it).
|
|
151
|
+
|
|
152
|
+
To run the complete FS Next contract on bucket roots and prefixes without an
|
|
153
|
+
AWS account or credentials::
|
|
154
|
+
|
|
155
|
+
python -m pip install . pytest "moto[s3]==5.2.3"
|
|
156
|
+
python -m pip check
|
|
157
|
+
python -I -m pytest tests/test_fs_next.py -q -ra
|
|
158
|
+
|
|
159
|
+
Moto exercises local S3 API behavior. It does not certify live AWS IAM,
|
|
160
|
+
network failures or provider-specific behavior. This package is independently maintained and released. Related upstream fixes
|
|
161
|
+
were already proposed in `PR #81 <https://github.com/PyFilesystem/s3fs/pull/81>`_
|
|
162
|
+
(readinto) and `PR #92 <https://github.com/PyFilesystem/s3fs/pull/92>`_
|
|
163
|
+
(preserve_time); the contract suite reproduces those failures.
|