Skip to content

Commit

Permalink
make into pip installable package
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavis-xyz committed Dec 15, 2019
1 parent 99c9de7 commit 7509360
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 5 deletions.
File renamed without changes.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ for element in function(Bucket='my-bucket'):

This library provides that function.

## Installation and usage
## Installation

Download `wrapper.py`, save it in the same directory as the file calling it.
(I'll eventually make it `pip` installable.)
`pip install bbp`

## Usage

Here's an example of how to use it for the [Lambda `ListFunctions` paginator](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambda.Paginator.ListFunctions).

Expand Down Expand Up @@ -72,4 +73,7 @@ for obj in paginator('s3', 'list_objects_v2', 'Contents', Bucket='mybucket'):
* `Bucket='mybucket'` and any other `name=value` arguments are what get passed to [the paginator](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Paginator.ListObjectsV2).


## Packaging

This is my first ever package on PyPI.
I used [this guide](https://medium.com/@joel.barmettler/how-to-upload-your-python-package-to-pypi-65edc5fe9c56) to learn how to do this.
1 change: 1 addition & 0 deletions bbp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .wrapper import paginator
File renamed without changes.
2 changes: 1 addition & 1 deletion lambda_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from wrapper import paginator
from bbp import paginator
from pprint import pprint
for lam in paginator('lambda', 'list_functions', 'Functions'):
pprint(lam) # process a single resource
2 changes: 1 addition & 1 deletion s3_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from wrapper import paginator
from bbp import paginator
from pprint import pprint
bucket_name = 'reddit-amp-bot-code'
for obj in paginator('s3', 'list_objects_v2', 'Contents', Bucket=bucket_name):
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Inside of setup.cfg
[metadata]
description-file = README.md
25 changes: 25 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from distutils.core import setup
setup(
name = 'bbp', # How you named your package folder (MyLib)
packages = ['bbp'], # Chose the same as "name"
version = '0.1', # Start with a small number and increase it with every change you make
license='GPLv3',
description = 'A wrapper for boto3 paginators to iterate per resource',
author = 'Matthew Davis',
author_email = '[email protected]',
url = 'https://github.com/mlda065/bbp', # Provide either the link to your github or to your website
download_url = 'https://github.com/mlda065/bbp/archive/v_01.tar.gz',
keywords = ['boto3', 'boto', 'AWS', 'Amazon', 'paginator', 'pagination', 'page', 'api', 'cloud'],
install_requires=['boto3'],
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: GPLv3 License',
'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7'
],
)

0 comments on commit 7509360

Please sign in to comment.