pyaws-s3 1.0.0__py3-none-any.whl → 1.0.1__py3-none-any.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.
@@ -0,0 +1,149 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyaws_s3
3
+ Version: 1.0.1
4
+ Summary: A Python package for AWS S3 utilities
5
+ Author: Giuseppe Zileni
6
+ Author-email: Giuseppe Zileni <giuseppe.zileni@gmail.com>
7
+ Keywords: aws,s3,utilities
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.12
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: aioboto3==14.3.0
13
+ Requires-Dist: aiobotocore==2.22.0
14
+ Requires-Dist: aiofiles==24.1.0
15
+ Requires-Dist: aiohappyeyeballs==2.6.1
16
+ Requires-Dist: aiohttp==3.11.18
17
+ Requires-Dist: aioitertools==0.12.0
18
+ Requires-Dist: aiosignal==1.3.2
19
+ Requires-Dist: attrs==25.3.0
20
+ Requires-Dist: boto3==1.37.3
21
+ Requires-Dist: botocore==1.37.3
22
+ Requires-Dist: contourpy==1.3.2
23
+ Requires-Dist: cycler==0.12.1
24
+ Requires-Dist: fonttools==4.58.0
25
+ Requires-Dist: fpdf==1.7.2
26
+ Requires-Dist: frozenlist==1.6.0
27
+ Requires-Dist: idna==3.10
28
+ Requires-Dist: jmespath==1.0.1
29
+ Requires-Dist: kiwisolver==1.4.8
30
+ Requires-Dist: matplotlib==3.10.3
31
+ Requires-Dist: multidict==6.4.3
32
+ Requires-Dist: narwhals==1.39.1
33
+ Requires-Dist: numpy==2.2.5
34
+ Requires-Dist: packaging==25.0
35
+ Requires-Dist: pandas==2.2.3
36
+ Requires-Dist: pillow==11.2.1
37
+ Requires-Dist: plotly==6.1.0
38
+ Requires-Dist: propcache==0.3.1
39
+ Requires-Dist: pyparsing==3.2.3
40
+ Requires-Dist: python-dateutil==2.9.0.post0
41
+ Requires-Dist: pytz==2025.2
42
+ Requires-Dist: s3transfer==0.11.3
43
+ Requires-Dist: six==1.17.0
44
+ Requires-Dist: tzdata==2025.2
45
+ Requires-Dist: urllib3==2.4.0
46
+ Requires-Dist: wrapt==1.17.2
47
+ Requires-Dist: yarl==1.20.0
48
+ Dynamic: author
49
+ Dynamic: requires-python
50
+
51
+ # PYAWS_S3
52
+
53
+ ## Description
54
+
55
+ `S3Client` is a Python class that simplifies interaction with AWS S3 for uploading, managing, and deleting files. It supports uploading images, DataFrames, PDFs, and generating pre-signed URLs.
56
+
57
+ ## Installation
58
+
59
+ Make sure you have installed:
60
+
61
+ ```bash
62
+ pip install pyaws_s3
63
+ ```
64
+
65
+ ### Env Variabiles
66
+
67
+ Make sure to add this environment variable:
68
+
69
+ ```bash
70
+ AWS_ACCESS_KEY_ID=<Your Access Key Id>
71
+ AWS_SECRET_ACCESS_KEY=<Your Secrect Access Key>
72
+ AWS_REGION=<Your Region>
73
+ AWS_BUCKET_NAME=<Your Bucket Name>
74
+ ```bash
75
+
76
+ ## Usage
77
+
78
+ ### Initialization
79
+
80
+ You can initialize the class by passing AWS credentials as parameters or via environment variables:
81
+
82
+ ```python
83
+ from s3_client import S3Client
84
+
85
+ s3 = S3Client(
86
+ aws_access_key_id=os.getenv("AWS_ACCESS_KEY_ID"),
87
+ aws_secret_access_key=os.getenv("AWS_SECRET_ACCESS_KEY"),
88
+ region_name=os.getenv("AWS_REGION"),
89
+ bucket_name=os.getenv("AWS_BUCKET_NAME")
90
+ )
91
+ ```
92
+
93
+ ### Main Methods
94
+
95
+ #### 1. `upload_image(fig, object_name, format_file=Literal["png", "jpeg", "svg", "html"])`
96
+
97
+ Uploads a figure (e.g., Matplotlib or Plotly) to S3 as an image (svg, png, jpeg, html).
98
+
99
+ ```python
100
+ url = s3.upload_image(fig, "folder/image.svg", format_file="svg")
101
+ ```
102
+
103
+ #### 2. `upload_from_dataframe(df, object_name, format_file=Literal["xlsx", "csv", "pdf"])`
104
+
105
+ Uploads a DataFrame to S3 as an Excel, CSV, or PDF file.
106
+
107
+ ```python
108
+ url = s3.upload_from_dataframe(df, "folder/data", format_file="csv")
109
+ ```
110
+
111
+ #### 3. `upload_to_pdf(text, object_name)`
112
+
113
+ Exports text to PDF and uploads it to S3.
114
+
115
+ ```python
116
+ url = s3.upload_to_pdf("Text to export", "folder/file.pdf")
117
+ ```
118
+
119
+ #### 4. `await delete_all(filter=None)`
120
+
121
+ Deletes all files from the bucket, optionally filtering by name.
122
+
123
+ ```python
124
+ import asyncio
125
+ await s3.delete_all(filter="your_filter")
126
+ ```
127
+
128
+ ## Notes
129
+
130
+ - All upload methods return a pre-signed URL for downloading the file.
131
+ - Integrated error handling with logging.
132
+ - For uploading images and DataFrames, utility functions are required (`bytes_from_figure`, `html_from_figure`).
133
+
134
+ ## Complete Example
135
+
136
+ ```python
137
+ import matplotlib.pyplot as plt
138
+ import pandas as pd
139
+
140
+ fig, ax = plt.subplots()
141
+ ax.plot([1, 2, 3], [4, 5, 6])
142
+
143
+ df = pd.DataFrame({"a": [1, 2], "b": [3, 4]})
144
+
145
+ s3 = S3Client(bucket_name="my-bucket")
146
+ img_url = s3.upload_image(fig, "test.svg")
147
+ df_url = s3.upload_from_dataframe(df, "mydata")
148
+ pdf_url = s3.upload_to_pdf("Hello PDF", "hello.pdf")
149
+ ```
@@ -0,0 +1,4 @@
1
+ pyaws_s3-1.0.1.dist-info/METADATA,sha256=Ge4YAe5dhTIncFBbgVRo7riwORP79SChW_04OermkF4,3940
2
+ pyaws_s3-1.0.1.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
3
+ pyaws_s3-1.0.1.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
4
+ pyaws_s3-1.0.1.dist-info/RECORD,,
@@ -1,49 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pyaws_s3
3
- Version: 1.0.0
4
- Summary: A Python package for AWS S3 utilities
5
- Author: Giuseppe Zileni
6
- Author-email: Giuseppe Zileni <giuseppe.zileni@gmail.com>
7
- License: MIT
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Operating System :: OS Independent
10
- Requires-Python: >=3.12
11
- Description-Content-Type: text/markdown
12
- Requires-Dist: aioboto3==14.3.0
13
- Requires-Dist: aiobotocore==2.22.0
14
- Requires-Dist: aiofiles==24.1.0
15
- Requires-Dist: aiohappyeyeballs==2.6.1
16
- Requires-Dist: aiohttp==3.11.18
17
- Requires-Dist: aioitertools==0.12.0
18
- Requires-Dist: aiosignal==1.3.2
19
- Requires-Dist: attrs==25.3.0
20
- Requires-Dist: boto3==1.37.3
21
- Requires-Dist: botocore==1.37.3
22
- Requires-Dist: contourpy==1.3.2
23
- Requires-Dist: cycler==0.12.1
24
- Requires-Dist: fonttools==4.58.0
25
- Requires-Dist: fpdf==1.7.2
26
- Requires-Dist: frozenlist==1.6.0
27
- Requires-Dist: idna==3.10
28
- Requires-Dist: jmespath==1.0.1
29
- Requires-Dist: kiwisolver==1.4.8
30
- Requires-Dist: matplotlib==3.10.3
31
- Requires-Dist: multidict==6.4.3
32
- Requires-Dist: narwhals==1.39.1
33
- Requires-Dist: numpy==2.2.5
34
- Requires-Dist: packaging==25.0
35
- Requires-Dist: pandas==2.2.3
36
- Requires-Dist: pillow==11.2.1
37
- Requires-Dist: plotly==6.1.0
38
- Requires-Dist: propcache==0.3.1
39
- Requires-Dist: pyparsing==3.2.3
40
- Requires-Dist: python-dateutil==2.9.0.post0
41
- Requires-Dist: pytz==2025.2
42
- Requires-Dist: s3transfer==0.11.3
43
- Requires-Dist: six==1.17.0
44
- Requires-Dist: tzdata==2025.2
45
- Requires-Dist: urllib3==2.4.0
46
- Requires-Dist: wrapt==1.17.2
47
- Requires-Dist: yarl==1.20.0
48
- Dynamic: author
49
- Dynamic: requires-python
@@ -1,4 +0,0 @@
1
- pyaws_s3-1.0.0.dist-info/METADATA,sha256=jwsrs5Xej4q1G08GjYU1-S9G0geqOZv3b74DSvM3ZxQ,1526
2
- pyaws_s3-1.0.0.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
3
- pyaws_s3-1.0.0.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
4
- pyaws_s3-1.0.0.dist-info/RECORD,,