diff --git a/.github/workflows/releases.yml b/.github/workflows/releases.yml new file mode 100644 index 0000000..dc779a4 --- /dev/null +++ b/.github/workflows/releases.yml @@ -0,0 +1,26 @@ +name: Release + +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 setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + python setup.py sdist + twine upload --repository pypi dist/* diff --git a/MANIFEST.in b/MANIFEST.in index 17117d2..56880b1 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,4 @@ include funmotd/config.json +include funmotd.toml +include *.md +include LICENSE \ No newline at end of file diff --git a/README.md b/README.md index 30c82c3..144514b 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,18 @@ -![GitHub](https://img.shields.io/github/license/veerendra2/funmotd.svg?style=for-the-badge) -![GitHub stars](https://img.shields.io/github/stars/veerendra2/funmotd.svg?style=for-the-badge) -![PyPI - Status](https://img.shields.io/pypi/status/funmotd.svg?style=for-the-badge) -![PyPI](https://img.shields.io/pypi/v/funmotd.svg?style=for-the-badge) -![PyPI - Python Version](https://img.shields.io/pypi/pyversions/funmotd.svg?style=for-the-badge) +![PyPI - License](https://img.shields.io/pypi/l/funmotd) +![GitHub](https://img.shields.io/github/license/veerendra2/funmotd.svg) +![GitHub stars](https://img.shields.io/github/stars/veerendra2/funmotd.svg) +![PyPI - Status](https://img.shields.io/pypi/status/funmotd.svg) +![PyPI](https://img.shields.io/pypi/v/funmotd.svg) +![PyPI - Python Version](https://img.shields.io/pypi/pyversions/funmotd.svg) # Funny motd (funmotd) A cool tool to display random quotes from Movies and TV Shows as [`motd`](https://en.wikipedia.org/wiki/Motd_(Unix)) on Terminal when you open. -![Example](https://raw.githubusercontent.com/veerendra2/funmotd/master/example.gif) +![Example](https://user-images.githubusercontent.com/8393701/139233945-d44c1465-97fd-45ed-89f3-84ce19bcfeff.gif) ## Installation -#### Using `pip3` ``` $ pip3 install funmotd ``` -#### From source -``` -$ git clond https://github.com/veerendra2/funmotd.git -$ cd funmotd -$ python3 setup.py install -``` -**NOTE:** This package requires `python3` and `pip3` to install it. Install `pip3`: `sudo apt install python3-pip -y` ## How it works? The [`__init__.py`](https://github.com/veerendra2/funmotd/blob/master/funmotd/__init__.py) first picks a random `TV Shows/Movies` with [`weights`](https://docs.python.org/3/library/random.html#random.choices) and again picks a quote randomly from selected `TV Show/Moves`. You can see available of quotes in [`quotes_db.py`](https://github.com/veerendra2/funmotd/blob/master/funmotd/quotes_db.py) diff --git a/example.gif b/example.gif deleted file mode 100644 index 5ff678e..0000000 Binary files a/example.gif and /dev/null differ diff --git a/funmotd.toml b/funmotd.toml new file mode 100644 index 0000000..96ef009 --- /dev/null +++ b/funmotd.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools>=46.4.0", "wheel"] +build-backend = "setuptools.build_meta" \ No newline at end of file diff --git a/funmotd/__init__.py b/funmotd/__init__.py index 5b4f613..744b0a1 100644 --- a/funmotd/__init__.py +++ b/funmotd/__init__.py @@ -10,24 +10,15 @@ from .quotes_db import all_quotes -__author__ = "Veerendra Kakumanu (veerendra2)" +__author__ = "veerendra2" __license__ = "Apache 2.0" -__version__ = "0.3" -__maintainer__ = "Veerendra Kakumanu" +__version__ = "1.0" +__maintainer__ = "veerendra2" config_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'config.json') -def banner(): - print("+----------------------------------------------+") - print("|Funny MOTD (funmotd) v0.3 |") - print("|Author: Veerendra Kakumanu (veerendra2) |") - print("|Blog: https://veerendra2.github.io |") - print("|Repo: https://github.com/veerendra2/funmotd |") - print("+----------------------------------------------+\n") - - def read_config(): with open(config_file) as f: config = json.load(f) @@ -83,7 +74,7 @@ def show_motd(): quote = random.choice(all_quotes[name][0] + all_quotes[name][1]) else: quote = random.choice(all_quotes[name][1]) - print("### Quote of the Day ###\n") + print("*** Quote of the Day ***n") print(textwrap.fill('"'+quote["quote"]+'"', 90)) print(" ~{} ({})\n".format(quote["character"], quote["name"])) @@ -94,12 +85,9 @@ def main(): Configuration") arg.add_argument("-e", action="store", dest="modify", default=False, nargs=2, help="Modify Weights") arg.add_argument("-n", action="store", dest="nsfw", default=False, help="Enable/Disable NSFW Quotes") - arg.add_argument('-v', action='store_true', dest="version_info", default=False, help="Version and author \ - information") + arg.add_argument('-v', action='version', version='%(prog)s 1.0') results = arg.parse_args() - if results.version_info: - banner() - elif results.view: + if results.view: display_config() elif results.modify: if not results.modify[1].isdigit(): diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..7f910ca --- /dev/null +++ b/setup.cfg @@ -0,0 +1,3 @@ +[metadata] +version = attr: funmotd.__version__ +license_files = LICENSE \ No newline at end of file diff --git a/setup.py b/setup.py index d914947..88c16cd 100644 --- a/setup.py +++ b/setup.py @@ -10,6 +10,10 @@ sys.exit(1) +with open('README.md', 'r', encoding='utf-8') as fh: + long_description = fh.read() + + class PostInstall(install): def run(self): install.run(self) @@ -33,11 +37,18 @@ def run(self): setuptools.setup( name='funmotd', - version='0.3', + version='1.0', description='TV Show and Movie Quotes MOTD for Terminal', - url='https://github.com/veerendra2/funmotd', - author='Veerendra Kakumanu', - author_email='veerendrav2@gmail.com', + long_description=long_description, + long_description_content_type='text/markdown', + keywords='motd, funmotd, movies-quotes', + project_urls={ + 'Documentation': 'https://github.com/veerendra2/funmotd/blob/master/README.md', + 'Bug Reports': + 'https://github.com/veerendra2/funmotd/issues', + 'Source Code': 'https://github.com/veerendra2/funmotd', + }, + author='veerendra2', license='Apache 2.0', packages=setuptools.find_packages(), entry_points={'console_scripts': ['funmotd = funmotd:main']}, diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..87cfe13 --- /dev/null +++ b/tox.ini @@ -0,0 +1,4 @@ +[tox] +envlist = py{34,36,37,38,39} +minversion = 3.4.0 +isolated_build = true \ No newline at end of file