diff options
Diffstat (limited to 'python-pandablob.spec')
| -rw-r--r-- | python-pandablob.spec | 291 |
1 files changed, 291 insertions, 0 deletions
diff --git a/python-pandablob.spec b/python-pandablob.spec new file mode 100644 index 0000000..fa029f3 --- /dev/null +++ b/python-pandablob.spec @@ -0,0 +1,291 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pandablob +Version: 0.0.5 +Release: 1 +Summary: Functions to easily transform Azure blobs into pandas DataFrames and vice versa. +License: MIT +URL: https://github.com/uijl/pandablob +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/44/b4/f0652652709c410ce3039df278757f807d01897db47a1b3e1cb915634872/pandablob-0.0.5a.tar.gz +BuildArch: noarch + + +%description + +[](https://pypi.org/project/pandablob/) +[](https://pepy.tech/project/pandablob) + +# PandaBlob + +Functions to easily transform Azure blobs into pandas DataFrames and vice versa. + +## Installation + +Installing PandaBlob via [pip](https://pip.pypa.io) is the preferred method, as it will always install the most recent stable release. If you do not have +[pip](https://pip.pypa.io) installed, this [Python installation guide](http://docs.python-guide.org/en/latest/starting/installation/) can guide you through the process. + +To install PandaBlob, run this command in your terminal: + +```bash +# Use pip to install PandaBlob +pip install pandablob +``` + +Downloading and installing PandaBlob from source is also possible, follow the code below. + +```bash +# Download the package +git clone https://github.com/uijl/pandablob + +# Go to the correct folder +cd pandablob + +# Install package +pip install -e . +``` + +## Usage + +The code snip below shows how you can use PandaBlob, all you need is a _[BlobClient](https://docs.microsoft.com/nl-nl/python/api/azure-storage-blob/azure.storage.blob.blobclient?view=azure-python)_ and possibly a pandas DataFrame or some keyword arguments for pandas. + +```python +# Import the Azure SDK and pandablob +import pandablob + +from azure.storage.blob import ContainerClient + +# Your Azure Credentials +account_url = "https://my_account_url.blob.core.windows.net/" +token = "your_key_string" +container = "your_container" +blobname = "your_blob_name.csv" + +container_client = ContainerClient(account_url, container, credential=token) +blob_client = container_client.get_blob_client(blob=blobname) + +# Specifiy your pandas keyword arguments +pandas_kwargs = {"index_col": 0} + +# Read the blob as a pandas DataFrame +df = pandablob.blob_to_df(blob_client, pandas_kwargs) +``` + +## Potential errors + +There are three common errors that can be returned. Two are related to the blob storage and one because of the current limitations of pandablob. + +- **ResourceExistsError** - If the specified blob is already on the blob, this error is returned. There are two options, you can add the `overwrite=True` argument to your `df_to_blob` function or you can catch the exception. If you wish to enter it in an except statement, you can import it using `from azure.core.exceptions import ResourceExistsError`; +- **ResourceNotFoundError** - If the specified blob is not found, this error is returned. If you wish to enter it in an except statement, you can import it using `from azure.core.exceptions import ResourceNotFoundError`; +- **TypeError** - This error is returned by pandablob if you want to upload or download an extensiontype that is not yet supported. Currently only the following extensions are supported: `.csv` `.json` `.txt`, `.xls` and `.xlsx`. + +## To do list: + +Some other stuff that needs to be done: + +- [ ] Include other files; +- [x] Easier downloading a .csv file; +- [x] Added MIT license. + +%package -n python3-pandablob +Summary: Functions to easily transform Azure blobs into pandas DataFrames and vice versa. +Provides: python-pandablob +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pandablob + +[](https://pypi.org/project/pandablob/) +[](https://pepy.tech/project/pandablob) + +# PandaBlob + +Functions to easily transform Azure blobs into pandas DataFrames and vice versa. + +## Installation + +Installing PandaBlob via [pip](https://pip.pypa.io) is the preferred method, as it will always install the most recent stable release. If you do not have +[pip](https://pip.pypa.io) installed, this [Python installation guide](http://docs.python-guide.org/en/latest/starting/installation/) can guide you through the process. + +To install PandaBlob, run this command in your terminal: + +```bash +# Use pip to install PandaBlob +pip install pandablob +``` + +Downloading and installing PandaBlob from source is also possible, follow the code below. + +```bash +# Download the package +git clone https://github.com/uijl/pandablob + +# Go to the correct folder +cd pandablob + +# Install package +pip install -e . +``` + +## Usage + +The code snip below shows how you can use PandaBlob, all you need is a _[BlobClient](https://docs.microsoft.com/nl-nl/python/api/azure-storage-blob/azure.storage.blob.blobclient?view=azure-python)_ and possibly a pandas DataFrame or some keyword arguments for pandas. + +```python +# Import the Azure SDK and pandablob +import pandablob + +from azure.storage.blob import ContainerClient + +# Your Azure Credentials +account_url = "https://my_account_url.blob.core.windows.net/" +token = "your_key_string" +container = "your_container" +blobname = "your_blob_name.csv" + +container_client = ContainerClient(account_url, container, credential=token) +blob_client = container_client.get_blob_client(blob=blobname) + +# Specifiy your pandas keyword arguments +pandas_kwargs = {"index_col": 0} + +# Read the blob as a pandas DataFrame +df = pandablob.blob_to_df(blob_client, pandas_kwargs) +``` + +## Potential errors + +There are three common errors that can be returned. Two are related to the blob storage and one because of the current limitations of pandablob. + +- **ResourceExistsError** - If the specified blob is already on the blob, this error is returned. There are two options, you can add the `overwrite=True` argument to your `df_to_blob` function or you can catch the exception. If you wish to enter it in an except statement, you can import it using `from azure.core.exceptions import ResourceExistsError`; +- **ResourceNotFoundError** - If the specified blob is not found, this error is returned. If you wish to enter it in an except statement, you can import it using `from azure.core.exceptions import ResourceNotFoundError`; +- **TypeError** - This error is returned by pandablob if you want to upload or download an extensiontype that is not yet supported. Currently only the following extensions are supported: `.csv` `.json` `.txt`, `.xls` and `.xlsx`. + +## To do list: + +Some other stuff that needs to be done: + +- [ ] Include other files; +- [x] Easier downloading a .csv file; +- [x] Added MIT license. + +%package help +Summary: Development documents and examples for pandablob +Provides: python3-pandablob-doc +%description help + +[](https://pypi.org/project/pandablob/) +[](https://pepy.tech/project/pandablob) + +# PandaBlob + +Functions to easily transform Azure blobs into pandas DataFrames and vice versa. + +## Installation + +Installing PandaBlob via [pip](https://pip.pypa.io) is the preferred method, as it will always install the most recent stable release. If you do not have +[pip](https://pip.pypa.io) installed, this [Python installation guide](http://docs.python-guide.org/en/latest/starting/installation/) can guide you through the process. + +To install PandaBlob, run this command in your terminal: + +```bash +# Use pip to install PandaBlob +pip install pandablob +``` + +Downloading and installing PandaBlob from source is also possible, follow the code below. + +```bash +# Download the package +git clone https://github.com/uijl/pandablob + +# Go to the correct folder +cd pandablob + +# Install package +pip install -e . +``` + +## Usage + +The code snip below shows how you can use PandaBlob, all you need is a _[BlobClient](https://docs.microsoft.com/nl-nl/python/api/azure-storage-blob/azure.storage.blob.blobclient?view=azure-python)_ and possibly a pandas DataFrame or some keyword arguments for pandas. + +```python +# Import the Azure SDK and pandablob +import pandablob + +from azure.storage.blob import ContainerClient + +# Your Azure Credentials +account_url = "https://my_account_url.blob.core.windows.net/" +token = "your_key_string" +container = "your_container" +blobname = "your_blob_name.csv" + +container_client = ContainerClient(account_url, container, credential=token) +blob_client = container_client.get_blob_client(blob=blobname) + +# Specifiy your pandas keyword arguments +pandas_kwargs = {"index_col": 0} + +# Read the blob as a pandas DataFrame +df = pandablob.blob_to_df(blob_client, pandas_kwargs) +``` + +## Potential errors + +There are three common errors that can be returned. Two are related to the blob storage and one because of the current limitations of pandablob. + +- **ResourceExistsError** - If the specified blob is already on the blob, this error is returned. There are two options, you can add the `overwrite=True` argument to your `df_to_blob` function or you can catch the exception. If you wish to enter it in an except statement, you can import it using `from azure.core.exceptions import ResourceExistsError`; +- **ResourceNotFoundError** - If the specified blob is not found, this error is returned. If you wish to enter it in an except statement, you can import it using `from azure.core.exceptions import ResourceNotFoundError`; +- **TypeError** - This error is returned by pandablob if you want to upload or download an extensiontype that is not yet supported. Currently only the following extensions are supported: `.csv` `.json` `.txt`, `.xls` and `.xlsx`. + +## To do list: + +Some other stuff that needs to be done: + +- [ ] Include other files; +- [x] Easier downloading a .csv file; +- [x] Added MIT license. + +%prep +%autosetup -n pandablob-0.0.5 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-pandablob -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 0.0.5-1 +- Package Spec generated |
