pavro 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.
- pavro-1.0.0/LICENSE +21 -0
- pavro-1.0.0/PKG-INFO +21 -0
- pavro-1.0.0/README.md +4 -0
- pavro-1.0.0/pyproject.toml +3 -0
- pavro-1.0.0/setup.cfg +30 -0
- pavro-1.0.0/src/pavro/__init__.py +3 -0
- pavro-1.0.0/src/pavro/avro.py +61 -0
- pavro-1.0.0/src/pavro.egg-info/PKG-INFO +21 -0
- pavro-1.0.0/src/pavro.egg-info/SOURCES.txt +11 -0
- pavro-1.0.0/src/pavro.egg-info/dependency_links.txt +1 -0
- pavro-1.0.0/src/pavro.egg-info/requires.txt +1 -0
- pavro-1.0.0/src/pavro.egg-info/top_level.txt +1 -0
pavro-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Asinerum Conlang Project
|
|
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.
|
pavro-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pavro
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Apache Avro Home Lib
|
|
5
|
+
Home-page: https://github.com/asinerum/pavro
|
|
6
|
+
Author: Asinerum Conlang Project
|
|
7
|
+
Author-email: asinerum.com@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.7
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: formatize>=1.0.14
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
Detailed tips, tricks, and examples, can be found at project's repository
|
|
19
|
+
https://github.com/asinerum/pavro
|
|
20
|
+
|
|
21
|
+
(C) 2026 Asinerum Conlang Project
|
pavro-1.0.0/README.md
ADDED
pavro-1.0.0/setup.cfg
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[metadata]
|
|
2
|
+
name = pavro
|
|
3
|
+
version = 1.0.0
|
|
4
|
+
author = Asinerum Conlang Project
|
|
5
|
+
author_email = asinerum.com@gmail.com
|
|
6
|
+
description = Apache Avro Home Lib
|
|
7
|
+
long_description = file: README.md
|
|
8
|
+
long_description_content_type = text/markdown
|
|
9
|
+
url = https://github.com/asinerum/pavro
|
|
10
|
+
license = MIT
|
|
11
|
+
classifiers =
|
|
12
|
+
Programming Language :: Python :: 3
|
|
13
|
+
License :: OSI Approved :: MIT License
|
|
14
|
+
Operating System :: OS Independent
|
|
15
|
+
|
|
16
|
+
[options]
|
|
17
|
+
package_dir =
|
|
18
|
+
= src
|
|
19
|
+
packages = find:
|
|
20
|
+
python_requires = >=3.7
|
|
21
|
+
install_requires =
|
|
22
|
+
formatize >= 1.0.14
|
|
23
|
+
|
|
24
|
+
[options.packages.find]
|
|
25
|
+
where = src
|
|
26
|
+
|
|
27
|
+
[egg_info]
|
|
28
|
+
tag_build =
|
|
29
|
+
tag_date = 0
|
|
30
|
+
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from formatize.data import *
|
|
2
|
+
|
|
3
|
+
def read_avro_file(filepath: str) -> pd.DataFrame:
|
|
4
|
+
return read_avros_list([filepath])
|
|
5
|
+
|
|
6
|
+
def read_avro_url(url: str) -> pd.DataFrame:
|
|
7
|
+
import io
|
|
8
|
+
import requests
|
|
9
|
+
records = []
|
|
10
|
+
try:
|
|
11
|
+
response = requests.get(url)
|
|
12
|
+
if response.status_code == 200:
|
|
13
|
+
avro_file = io.BytesIO(response.content)
|
|
14
|
+
avro_reader = reader(avro_file)
|
|
15
|
+
for record in avro_reader:
|
|
16
|
+
records.append(record)
|
|
17
|
+
return pd.DataFrame(records)
|
|
18
|
+
except Exception as e:
|
|
19
|
+
return print(f'Error: {str(e)}')
|
|
20
|
+
|
|
21
|
+
def read_avros_folder(folder: str='./') -> pd.DataFrame:
|
|
22
|
+
import glob
|
|
23
|
+
file_list = glob.glob(f'{folder}/*.avro')
|
|
24
|
+
return read_avros_list(file_list)
|
|
25
|
+
|
|
26
|
+
def read_avros_list(file_list: list) -> pd.DataFrame:
|
|
27
|
+
## this may need df.fillna('something')
|
|
28
|
+
records = []
|
|
29
|
+
try:
|
|
30
|
+
for file_path in file_list:
|
|
31
|
+
with open(file_path, 'rb') as fo:
|
|
32
|
+
avro_reader = reader(fo)
|
|
33
|
+
for record in avro_reader:
|
|
34
|
+
records.append(record)
|
|
35
|
+
return pd.DataFrame(records)
|
|
36
|
+
except Exception as e:
|
|
37
|
+
return print(f'Error: {str(e)}')
|
|
38
|
+
|
|
39
|
+
def avro_save(df: pd.DataFrame, filepath: str, schema: dict=None) -> bool:
|
|
40
|
+
if not schema:
|
|
41
|
+
schema = {
|
|
42
|
+
'type': 'record',
|
|
43
|
+
'name': 'Record',
|
|
44
|
+
'fields': [{'name': k, 'type': ['string', 'null']} for k in df.columns]
|
|
45
|
+
}
|
|
46
|
+
try:
|
|
47
|
+
parsed_schema = parse_schema(schema)
|
|
48
|
+
records = df.to_dict('records')
|
|
49
|
+
with open(filepath, 'wb') as out:
|
|
50
|
+
writer(out, parsed_schema, records, codec='deflate')
|
|
51
|
+
return True
|
|
52
|
+
except Exception as e:
|
|
53
|
+
return print(f'Error: {str(e)}')
|
|
54
|
+
|
|
55
|
+
def avro_file_insert(filepath, **kwargs) -> bool:
|
|
56
|
+
res = save_raw_avro(filepath, **kwargs)
|
|
57
|
+
if not res[ERROR]: return True
|
|
58
|
+
return print(f'Error: {res[ERROR]}')
|
|
59
|
+
|
|
60
|
+
def avro_file_delete(filepath: str, count: int=1) -> bool:
|
|
61
|
+
return delete_avro_rows(filepath=filepath, count=count)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pavro
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Apache Avro Home Lib
|
|
5
|
+
Home-page: https://github.com/asinerum/pavro
|
|
6
|
+
Author: Asinerum Conlang Project
|
|
7
|
+
Author-email: asinerum.com@gmail.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.7
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Requires-Dist: formatize>=1.0.14
|
|
16
|
+
Dynamic: license-file
|
|
17
|
+
|
|
18
|
+
Detailed tips, tricks, and examples, can be found at project's repository
|
|
19
|
+
https://github.com/asinerum/pavro
|
|
20
|
+
|
|
21
|
+
(C) 2026 Asinerum Conlang Project
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.cfg
|
|
5
|
+
src/pavro/__init__.py
|
|
6
|
+
src/pavro/avro.py
|
|
7
|
+
src/pavro.egg-info/PKG-INFO
|
|
8
|
+
src/pavro.egg-info/SOURCES.txt
|
|
9
|
+
src/pavro.egg-info/dependency_links.txt
|
|
10
|
+
src/pavro.egg-info/requires.txt
|
|
11
|
+
src/pavro.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
formatize>=1.0.14
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pavro
|