Skip to content

Commit

Permalink
new: setup.py update, github actions, bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
uburuntu committed May 16, 2020
1 parent cbdab1c commit 3d16338
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 14 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel twine readme_renderer[md]
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
10 changes: 5 additions & 5 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
aiohttp
codecov
pytest
pytest-asyncio
pytest-cov
aiohttp>=3.6
codecov>=2.0
pytest>=5.4
pytest-asyncio>=0.12
pytest-cov>=2.8
39 changes: 31 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,48 @@
import os
from importlib.machinery import SourceFileLoader

import setuptools
from pkg_resources import parse_requirements

module_name = 'throttler'

import throttler
module = SourceFileLoader(
module_name, os.path.join(module_name, '__init__.py')
).load_module()


def read(filename):
with open(filename) as file:
return file.read()


def load_requirements(filename: str) -> list:
requirements = []
for req in parse_requirements(read(filename)):
extras = '[{}]'.format(','.join(req.extras)) if req.extras else ''
requirements.append(
'{}{}{}'.format(req.name, extras, req.specifier)
)
return requirements


setuptools.setup(
name='throttler',
version=throttler.__version__,
author='uburuntu',
author_email='bekbulatov.ramzan@ya.ru',
url='https://github.com/uburuntu/throttler',
description='Zero-dependency Python package for simple throttling with asyncio support',
name=module_name,
version=module.__version__,
author=module.__author__,
author_email=module.__email__,
license=module.__license__,
description=module.__doc__,
platforms='all',
long_description=read('readme.md'),
long_description_content_type="text/markdown",
long_description_content_type='text/markdown',
url='https://github.com/uburuntu/throttler',
download_url='https://github.com/uburuntu/throttler/archive/master.zip',
packages=['throttler'],
requires_python='>=3.6',
install_requires=[],
extras_require={'dev': load_requirements('requirements-dev.txt')},
keywords=['throttle', 'rate limit'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Framework :: AsyncIO',
Expand Down
7 changes: 6 additions & 1 deletion throttler/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
"""Zero-dependency Python package for simple throttling with asyncio support"""
from .execution_timer import ExecutionTimer
from .throttler import Throttler
from .throttler_simultaneous import ThrottlerSimultaneous
from .timer import Timer

from .decorators import execution_timer, execution_timer_async, throttle, throttle_simultaneous, timer, timer_async

__version__ = '1.1'
__author__ = 'uburuntu'
__email__ = 'github@rmbk.me'

__license__ = 'MIT'
__version__ = '1.1.3'

0 comments on commit 3d16338

Please sign in to comment.