pyaws-s3 1.0.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.
@@ -0,0 +1,49 @@
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
@@ -0,0 +1,99 @@
1
+ # PYAWS_S3
2
+
3
+ ## Description
4
+
5
+ `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.
6
+
7
+ ## Installation
8
+
9
+ Make sure you have installed:
10
+
11
+ ```bash
12
+ pip install pyaws_s3
13
+ ```
14
+
15
+ ### Env Variabiles
16
+
17
+ Make sure to add this environment variable:
18
+
19
+ ```bash
20
+ AWS_ACCESS_KEY_ID=<Your Access Key Id>
21
+ AWS_SECRET_ACCESS_KEY=<Your Secrect Access Key>
22
+ AWS_REGION=<Your Region>
23
+ AWS_BUCKET_NAME=<Your Bucket Name>
24
+ ```bash
25
+
26
+ ## Usage
27
+
28
+ ### Initialization
29
+
30
+ You can initialize the class by passing AWS credentials as parameters or via environment variables:
31
+
32
+ ```python
33
+ from s3_client import S3Client
34
+
35
+ s3 = S3Client(
36
+ aws_access_key_id=os.getenv("AWS_ACCESS_KEY_ID"),
37
+ aws_secret_access_key=os.getenv("AWS_SECRET_ACCESS_KEY"),
38
+ region_name=os.getenv("AWS_REGION"),
39
+ bucket_name=os.getenv("AWS_BUCKET_NAME")
40
+ )
41
+ ```
42
+
43
+ ### Main Methods
44
+
45
+ #### 1. `upload_image(fig, object_name, format_file=Literal["png", "jpeg", "svg", "html"])`
46
+
47
+ Uploads a figure (e.g., Matplotlib or Plotly) to S3 as an image (svg, png, jpeg, html).
48
+
49
+ ```python
50
+ url = s3.upload_image(fig, "folder/image.svg", format_file="svg")
51
+ ```
52
+
53
+ #### 2. `upload_from_dataframe(df, object_name, format_file=Literal["xlsx", "csv", "pdf"])`
54
+
55
+ Uploads a DataFrame to S3 as an Excel, CSV, or PDF file.
56
+
57
+ ```python
58
+ url = s3.upload_from_dataframe(df, "folder/data", format_file="csv")
59
+ ```
60
+
61
+ #### 3. `upload_to_pdf(text, object_name)`
62
+
63
+ Exports text to PDF and uploads it to S3.
64
+
65
+ ```python
66
+ url = s3.upload_to_pdf("Text to export", "folder/file.pdf")
67
+ ```
68
+
69
+ #### 4. `await delete_all(filter=None)`
70
+
71
+ Deletes all files from the bucket, optionally filtering by name.
72
+
73
+ ```python
74
+ import asyncio
75
+ await s3.delete_all(filter="your_filter")
76
+ ```
77
+
78
+ ## Notes
79
+
80
+ - All upload methods return a pre-signed URL for downloading the file.
81
+ - Integrated error handling with logging.
82
+ - For uploading images and DataFrames, utility functions are required (`bytes_from_figure`, `html_from_figure`).
83
+
84
+ ## Complete Example
85
+
86
+ ```python
87
+ import matplotlib.pyplot as plt
88
+ import pandas as pd
89
+
90
+ fig, ax = plt.subplots()
91
+ ax.plot([1, 2, 3], [4, 5, 6])
92
+
93
+ df = pd.DataFrame({"a": [1, 2], "b": [3, 4]})
94
+
95
+ s3 = S3Client(bucket_name="my-bucket")
96
+ img_url = s3.upload_image(fig, "test.svg")
97
+ df_url = s3.upload_from_dataframe(df, "mydata")
98
+ pdf_url = s3.upload_to_pdf("Hello PDF", "hello.pdf")
99
+ ```
@@ -0,0 +1,49 @@
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
@@ -0,0 +1,8 @@
1
+ README.md
2
+ pyproject.toml
3
+ setup.py
4
+ pyaws_s3.egg-info/PKG-INFO
5
+ pyaws_s3.egg-info/SOURCES.txt
6
+ pyaws_s3.egg-info/dependency_links.txt
7
+ pyaws_s3.egg-info/requires.txt
8
+ pyaws_s3.egg-info/top_level.txt
@@ -0,0 +1,36 @@
1
+ aioboto3==14.3.0
2
+ aiobotocore==2.22.0
3
+ aiofiles==24.1.0
4
+ aiohappyeyeballs==2.6.1
5
+ aiohttp==3.11.18
6
+ aioitertools==0.12.0
7
+ aiosignal==1.3.2
8
+ attrs==25.3.0
9
+ boto3==1.37.3
10
+ botocore==1.37.3
11
+ contourpy==1.3.2
12
+ cycler==0.12.1
13
+ fonttools==4.58.0
14
+ fpdf==1.7.2
15
+ frozenlist==1.6.0
16
+ idna==3.10
17
+ jmespath==1.0.1
18
+ kiwisolver==1.4.8
19
+ matplotlib==3.10.3
20
+ multidict==6.4.3
21
+ narwhals==1.39.1
22
+ numpy==2.2.5
23
+ packaging==25.0
24
+ pandas==2.2.3
25
+ pillow==11.2.1
26
+ plotly==6.1.0
27
+ propcache==0.3.1
28
+ pyparsing==3.2.3
29
+ python-dateutil==2.9.0.post0
30
+ pytz==2025.2
31
+ s3transfer==0.11.3
32
+ six==1.17.0
33
+ tzdata==2025.2
34
+ urllib3==2.4.0
35
+ wrapt==1.17.2
36
+ yarl==1.20.0
@@ -0,0 +1,53 @@
1
+ [build-system]
2
+ requires = ["setuptools >= 77.0.3"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pyaws_s3"
7
+ version = "1.0.0"
8
+ description = "A Python package for AWS S3 utilities"
9
+ authors = [
10
+ { name="Giuseppe Zileni", email="giuseppe.zileni@gmail.com" }
11
+ ]
12
+ readme = {file = "README.txt", content-type = "text/markdown"}
13
+ requires-python = ">=3.12"
14
+ license = {text = "MIT"}
15
+ classifiers = ['Programming Language :: Python :: 3', 'Operating System :: OS Independent']
16
+ dependencies = [
17
+ "aioboto3==14.3.0",
18
+ "aiobotocore==2.22.0",
19
+ "aiofiles==24.1.0",
20
+ "aiohappyeyeballs==2.6.1",
21
+ "aiohttp==3.11.18",
22
+ "aioitertools==0.12.0",
23
+ "aiosignal==1.3.2",
24
+ "attrs==25.3.0",
25
+ "boto3==1.37.3",
26
+ "botocore==1.37.3",
27
+ "contourpy==1.3.2",
28
+ "cycler==0.12.1",
29
+ "fonttools==4.58.0",
30
+ "fpdf==1.7.2",
31
+ "frozenlist==1.6.0",
32
+ "idna==3.10",
33
+ "jmespath==1.0.1",
34
+ "kiwisolver==1.4.8",
35
+ "matplotlib==3.10.3",
36
+ "multidict==6.4.3",
37
+ "narwhals==1.39.1",
38
+ "numpy==2.2.5",
39
+ "packaging==25.0",
40
+ "pandas==2.2.3",
41
+ "pillow==11.2.1",
42
+ "plotly==6.1.0",
43
+ "propcache==0.3.1",
44
+ "pyparsing==3.2.3",
45
+ "python-dateutil==2.9.0.post0",
46
+ "pytz==2025.2",
47
+ "s3transfer==0.11.3",
48
+ "six==1.17.0",
49
+ "tzdata==2025.2",
50
+ "urllib3==2.4.0",
51
+ "wrapt==1.17.2",
52
+ "yarl==1.20.0"
53
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,54 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="pyaws_s3",
5
+ version="1.0.0",
6
+ description="A package for AWS S3 utilities",
7
+ author="Giuseppe Zileni",
8
+ author_email="giuseppe.zileni@gmail,com",
9
+ packages=find_packages(),
10
+ install_requires=[
11
+ "aioboto3==14.3.0",
12
+ "aiobotocore==2.22.0",
13
+ "aiofiles==24.1.0",
14
+ "aiohappyeyeballs==2.6.1",
15
+ "aiohttp==3.11.18",
16
+ "aioitertools==0.12.0",
17
+ "aiosignal==1.3.2",
18
+ "attrs==25.3.0",
19
+ "boto3==1.37.3",
20
+ "botocore==1.37.3",
21
+ "contourpy==1.3.2",
22
+ "cycler==0.12.1",
23
+ "fonttools==4.58.0",
24
+ "fpdf==1.7.2",
25
+ "frozenlist==1.6.0",
26
+ "idna==3.10",
27
+ "jmespath==1.0.1",
28
+ "kiwisolver==1.4.8",
29
+ "matplotlib==3.10.3",
30
+ "multidict==6.4.3",
31
+ "narwhals==1.39.1",
32
+ "numpy==2.2.5",
33
+ "packaging==25.0",
34
+ "pandas==2.2.3",
35
+ "pillow==11.2.1",
36
+ "plotly==6.1.0",
37
+ "propcache==0.3.1",
38
+ "pyparsing==3.2.3",
39
+ "python-dateutil==2.9.0.post0",
40
+ "pytz==2025.2",
41
+ "s3transfer==0.11.3",
42
+ "six==1.17.0",
43
+ "tzdata==2025.2",
44
+ "urllib3==2.4.0",
45
+ "wrapt==1.17.2",
46
+ "yarl==1.20.0"
47
+ ],
48
+ python_requires=">=3.12",
49
+ classifiers=[
50
+ "Programming Language :: Python :: 3",
51
+ "License :: OSI Approved :: MIT License",
52
+ "Operating System :: OS Independent",
53
+ ],
54
+ )