Merge pull request #13 from ParthS007/new

Add Support of gh-actions
This commit is contained in:
Parth Shandilya
2020-12-29 12:05:34 +01:00
committed by Parth Shandilya
6 changed files with 115 additions and 45 deletions
+4
View File
@@ -0,0 +1,4 @@
# These are supported funding model platforms
github: ParthS007
patreon: parthshandilya
ko_fi: parthshandilya
+28
View File
@@ -0,0 +1,28 @@
name: CI
on:
push:
branches: master
pull_request:
branches: master
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Check python code formatting
run: |
pip install black
black --check .
- name: Check compliance with pep8, pyflakes and circular complexity
run: |
pip install flake8
flake8 .
+31
View File
@@ -0,0 +1,31 @@
name: Publish
on:
push:
tags:
- v*
jobs:
Publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: pip install setuptools wheel
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@v1.4.1
with:
user: __token__
password: ${{ secrets.pypi_token }}
+9 -3
View File
@@ -1,6 +1,14 @@
Background: run stuff in the background
.. image:: https://img.shields.io/pypi/pyversions/background.svg
:target: https://pypi.org/pypi/background
.. image:: https://github.com/ParthS007/background/workflows/CI/badge.svg
:target: https://github.com/ParthS007/background/actions
Background
=======================================
It runs stuff in the background.
"An elegant decorator-based abstraction around Python 3's concurrent.futures ThreadPoolExecutor class"
— Simon Willison
@@ -8,8 +16,6 @@ Background: run stuff in the background
This module makes it stupidly simple to run things in the background of your
application, be it a CLI app, or a web app.
.. image:: https://farm5.staticflickr.com/4296/36137232912_7276365f2e_k_d.jpg
Basic Usage
-----------
+2
View File
@@ -7,6 +7,7 @@ import concurrent.futures
def default_n():
return multiprocessing.cpu_count()
n = default_n()
pool = concurrent.futures.ThreadPoolExecutor(max_workers=n)
callbacks = []
@@ -32,6 +33,7 @@ def task(f):
result.add_done_callback(cb)
return result
return do_task
+41 -42
View File
@@ -12,41 +12,40 @@ from shutil import rmtree
from setuptools import setup, Command
# Package meta-data.
NAME = 'background'
DESCRIPTION = 'It does what it says it does.'
URL = 'https://github.com/kennethreitz/background'
EMAIL = 'me@kennethreitz.org'
AUTHOR = 'Kenneth Reitz'
VERSION = '0.1.1'
NAME = "background"
DESCRIPTION = "It does what it says it does."
URL = "https://github.com/kennethreitz/background"
EMAIL = "me@kennethreitz.org"
AUTHOR = "Kenneth Reitz"
VERSION = "0.2.0"
MAINTAINER = "Parth Shandilya"
MAINTAINER_EMAIL = "parth1989shandilya@gmail.com"
# What packages are required for this module to be executed?
REQUIRED = [
"futures; python_version<'3.2'"
# 'requests', 'maya', 'records',
]
REQUIRED = ["futures; python_version<'3.2'"]
# The rest you shouldn't have to touch too much :)
# ------------------------------------------------
# Except, perhaps the License and Trove Classifiers!
here = os.path.abspath(os.path.dirname(__file__))
# Import the README and use it as the long-description.
# Note: this will only work if 'README.rst' is present in your MANIFEST.in file!
with io.open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = '\n' + f.read()
# Note: this will only work if 'README.rst' is present
# in your MANIFEST.in file
with io.open(os.path.join(here, "README.rst"), encoding="utf-8") as f:
long_description = "\n" + f.read()
class PublishCommand(Command):
"""Support setup.py publish."""
description = 'Build and publish the package.'
description = "Build and publish the package."
user_options = []
@staticmethod
def status(s):
"""Prints things in bold."""
print('\033[1m{0}\033[0m'.format(s))
print("\033[1m{0}\033[0m".format(s))
def initialize_options(self):
pass
@@ -56,16 +55,18 @@ class PublishCommand(Command):
def run(self):
try:
self.status('Removing previous builds…')
rmtree(os.path.join(here, 'dist'))
self.status("Removing previous builds…")
rmtree(os.path.join(here, "dist"))
except FileNotFoundError:
pass
self.status('Building Source and Wheel (universal) distribution…')
os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
self.status("Building Source and Wheel (universal) distribution…")
os.system(
"{0} setup.py sdist bdist_wheel --universal".format(sys.executable)
) # noqa
self.status('Uploading the package to PyPi via Twine…')
os.system('twine upload dist/*')
self.status("Uploading the package to PyPi via Twine…")
os.system("twine upload dist/*")
sys.exit()
@@ -79,32 +80,30 @@ setup(
author=AUTHOR,
author_email=EMAIL,
url=URL,
maintainer=MAINTAINER,
maintainer_email=MAINTAINER_EMAIL,
# If your package is a single module, use this instead of 'packages':
py_modules=['background'],
# entry_points={
# 'console_scripts': ['mycli=mymodule:cli'],
# },
py_modules=["background"],
install_requires=REQUIRED,
include_package_data=True,
license='ISC',
license="ISC",
classifiers=[
# Trove classifiers
# Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
# 'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy'
"Programming Language :: Python",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
],
# $ setup.py publish support.
cmdclass={
'publish': PublishCommand,
"publish": PublishCommand,
},
)