https://github.com/cthoyt/more_click

Extra stuff for click I use in basically every repo

https://github.com/cthoyt/more_click

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.2%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Extra stuff for click I use in basically every repo

Basic Info
  • Host: GitHub
  • Owner: cthoyt
  • License: mit
  • Language: Python
  • Default Branch: main
  • Size: 33.2 KB
Statistics
  • Stars: 5
  • Watchers: 2
  • Forks: 1
  • Open Issues: 0
  • Releases: 5
Created over 5 years ago · Last pushed almost 3 years ago
Metadata Files
Readme License

README.md

more_click

PyPI PyPI - Python Version PyPI - License DOI

Extra stuff for click I use in basically every repo

More Options

The module more_click.options has several options (pre-defined instances of click.option()) that I use often. First, verbose_option makes it easy to adjust the logger of your package using -v.

There are also several that are useful for web stuff, including

| Name | Type | Flag | | ------------------------ | ---- | -------- | | more_click.host_option | str | --host | | more_click.port_option | str | --port |

Web Tools

In many packages, I've included a Flask web application in wsgi.py. I usually use the following form inside cli.py file to import the web application and keep it insulated from other package-related usages:

```python

cli.py

import click from moreclick import hostoption, port_option

@click.command() @hostoption @portoption def web(host: str, port: str): from .wsgi import app # modify to point to your module-level flask.Flask instance app.run(host=host, port=port)

if name == 'main': web() ```

However, sometimes I want to make it possible to run via gunicorn from the CLI, so I would use the following extensions to automatically determine if it should be run with Flask's development server or gunicorn.

```python

cli.py

import click from moreclick import hostoption, portoption, withgunicornoption, workersoption, run_app

@click.command() @hostoption @portoption @withgunicornoption @workersoption def web(host: str, port: str, withgunicorn: bool, workers: int): from .wsgi import app # modify to point to your module-level flask.Flask instance runapp(app=app, withgunicorn=with_gunicorn, host=host, port=port, workers=workers)

if name == 'main': web() ```

For ultimate lazy mode, I've written a wrapper around the second:

```python

cli.py

from moreclick import makeweb_command

web = makewebcommand('mypackagename.wsgi:app')

if name == 'main': web() ```

This uses a standard wsgi-style string to locate the app, since you don't want to be eagerly importing the app in your CLI since it might rely on optional dependencies like Flask. If your CLI has other stuff, you can include the web command in a group like:

```python

cli.py

import click from moreclick import makeweb_command

@click.group() def main(): """My awesome CLI."""

makewebcommand('mypackagename.wsgi:app', group=main)

if name == 'main': main() ```

Owner

  • Name: Charles Tapley Hoyt
  • Login: cthoyt
  • Kind: user
  • Location: Bonn, Germany
  • Company: RWTH Aachen University

GitHub Events

Total
Last Year

Committers

Last synced: over 3 years ago

All Time
  • Total Commits: 43
  • Total Committers: 2
  • Avg Commits per committer: 21.5
  • Development Distribution Score (DDS): 0.023
Top Committers
Name Email Commits
Charles Tapley Hoyt c****t@g****m 42
Max Berrendorf b****f@d****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 3
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 hour
  • Total issue authors: 0
  • Total pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 1.67
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • cthoyt (2)
  • mberr (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 115,617 last-month
  • Total docker downloads: 176
  • Total dependent packages: 19
  • Total dependent repositories: 63
  • Total versions: 9
  • Total maintainers: 1
pypi.org: more-click

More click.

  • Versions: 9
  • Dependent Packages: 19
  • Dependent Repositories: 63
  • Downloads: 115,617 Last month
  • Docker Downloads: 176
Rankings
Dependent packages count: 0.7%
Dependent repos count: 1.9%
Downloads: 2.1%
Docker downloads count: 3.3%
Average: 8.7%
Stargazers count: 21.5%
Forks count: 22.6%
Maintainers (1)
Last synced: 11 months ago

Dependencies

.github/workflows/tests.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • codecov/codecov-action v1 composite
pyproject.toml pypi