From c6d5aaf7c20c481d5d8420caa0f3f7bc3ef5a685 Mon Sep 17 00:00:00 2001 From: Dmytro Striletskyi Date: Tue, 9 Apr 2019 15:43:52 +0300 Subject: [PATCH] Release v0.1.1: version and help commands --- .codecov.yml | 7 ++++ .gitignore | 2 ++ .pypi-version.yml | 9 +++++ .travis.yml | 23 +++++++++++++ MANIFEST.in | 5 +++ README.md | 72 +++++++++++++++++++++++++++++++++++++++- cli/__init__.py | 0 cli/clis/__init__.py | 0 cli/entrypoint.py | 14 ++++++++ cli/services/__init__.py | 0 requirements-dev.txt | 11 ++++++ requirements-tests.txt | 3 ++ requirements.txt | 2 ++ setup.cfg | 20 +++++++++++ setup.py | 39 ++++++++++++++++++++++ tests/__init.py | 0 tests/test_entrypoint.py | 12 +++++++ 17 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 .codecov.yml create mode 100644 .pypi-version.yml create mode 100644 .travis.yml create mode 100644 MANIFEST.in create mode 100644 cli/__init__.py create mode 100644 cli/clis/__init__.py create mode 100644 cli/entrypoint.py create mode 100644 cli/services/__init__.py create mode 100644 requirements-dev.txt create mode 100644 requirements-tests.txt create mode 100644 requirements.txt create mode 100644 setup.cfg create mode 100644 setup.py create mode 100644 tests/__init.py create mode 100644 tests/test_entrypoint.py diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..4b80438 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,7 @@ +coverage: + precision: 2 + round: down + range: 70...100 + + status: + patch: off diff --git a/.gitignore b/.gitignore index 894a44c..f82a459 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,5 @@ venv.bak/ # mypy .mypy_cache/ + +.idea/ diff --git a/.pypi-version.yml b/.pypi-version.yml new file mode 100644 index 0000000..f62360b --- /dev/null +++ b/.pypi-version.yml @@ -0,0 +1,9 @@ +package: + name: remme-core-cli + +ci: + name: travis + +branches: + development: develop + release: master diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..3158565 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +language: python + +python: + - "3.4" + - "3.5" + - "3.6" + - "3.7-dev" + +install: + - pip install -r requirements.txt + - pip install -r requirements-dev.txt + - pip install -r requirements-tests.txt + +script: + - cat requirements.txt requirements-tests.txt requirements-dev.txt | safety check --stdin + - radon cc cli -nb --total-average + - isort -rc cli --diff && isort -rc tests --diff + - flake8 cli + - coverage run -m pytest -vv tests + +after_success: + - coverage report -m && coverage xml + - bash <(curl -s https://codecov.io/bash) diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..2d68eea --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,5 @@ +include *.md +include LICENSE +include requirements.txt +include requirements-dev.txt +include requirements-tests.txt diff --git a/README.md b/README.md index 3682f9d..1f29333 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,72 @@ # remme-core-cli -The command-line interface (CLI) that provides a set of commands to interact with Remme-core. + +[![Release](https://img.shields.io/github/release/Remmeauth/remme-core-cli.svg)](https://github.com/Remmeauth/remme-core-cli/releases) +[![PyPI version shields.io](https://img.shields.io/pypi/v/remme-core-cli.svg)](https://pypi.python.org/pypi/remme-core-cli/) +[![Build Status](https://travis-ci.com/Remmeauth/remme-core-cli.svg?branch=develop)](https://travis-ci.com/Remmeauth/remme-core-cli) +[![codecov](https://codecov.io/gh/Remmeauth/remme-core-cli/branch/develop/graph/badge.svg)](https://codecov.io/gh/Remmeauth/remme-core-cli) + +[![Downloads](https://pepy.tech/badge/remme-core-cli)](https://pepy.tech/project/remme-core-cli) +[![PyPI license](https://img.shields.io/pypi/l/remme-core-cli.svg)](https://pypi.python.org/pypi/remme-core-cli/) +[![PyPI pyversions](https://img.shields.io/pypi/pyversions/remme-core-cli.svg)](https://pypi.python.org/pypi/remme-core-cli/) + + * [Getting started](#getting-started) + * [Usage](#usage) + * [Service](#service) + * [Development](#development) + * [Production](#production) + +## Getting started + +Blank. + +## Usage + +### Service + +Get the version of the package — ``remme --version``: + +```bash +$ remme --version +remme, version 0.1.0 +``` + +Get all possible package's commands — ``remme --help``: + +```bash +$ remme --help +Usage: remme [OPTIONS] COMMAND [ARGS]... + + Command line interface for PyPi version checking. + +Options: + --version Show the version and exit. + --help Show this message and exit. + +... +``` + +## Development + +To run the tests, use the following command, being in the root of the project: + +```bash +$ pytest tests/ +``` + +To build the package to test of to be deployed, use the following commands: + +```bash +$ pip3 uninstall -y remme-core-cli && rm -rf dist/ remme_core_cli.egg-info && \ + python3 setup.py sdist && pip3 install dist/*.tar.gz +``` + +## Production + +To build the package and upload it to [PypI](https://pypi.org) to be accessible through [pip](https://github.com/pypa/pip), +use the following commands. [Twine](https://twine.readthedocs.io/en/latest/) requires the username and password of the +account package is going to be uploaded to. + +```build +$ python3 setup.py sdist +$ twine upload dist/* +``` diff --git a/cli/__init__.py b/cli/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cli/clis/__init__.py b/cli/clis/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/cli/entrypoint.py b/cli/entrypoint.py new file mode 100644 index 0000000..539a279 --- /dev/null +++ b/cli/entrypoint.py @@ -0,0 +1,14 @@ +""" +Provide implementation of the command line interface to interact with Remme-core. +""" +import click + + +@click.group() +@click.version_option() +@click.help_option() +def cli(): + """ + Command-line interface to interact with Remme-core. + """ + pass diff --git a/cli/services/__init__.py b/cli/services/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..70cff2d --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,11 @@ +add-trailing-comma==1.0.0 +flake8==3.7.7 +flake8-docstrings==1.3.0 +flake8-commas==2.0.0 +flake8-comprehensions==2.1.0 +flake8-per-file-ignores==0.8.1 +flake8-print==3.1.0 +isort==4.3.17 +pep8-naming==0.8.2 +safety==1.8.5 +radon==3.0.1 \ No newline at end of file diff --git a/requirements-tests.txt b/requirements-tests.txt new file mode 100644 index 0000000..5843f19 --- /dev/null +++ b/requirements-tests.txt @@ -0,0 +1,3 @@ +coverage==4.5.3 +pytest==4.4.0 +pytest-mock==1.10.3 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e2485e1 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +accessify==0.3.1 +click==7.0 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..1d6b680 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,20 @@ +[isort] +line_length=120 +multi_line_output=3 +include_trailing_comma=True +force_grid_wrap=True +combine_as_imports=True + +[flake8] +max-line-length=120 +ignore=D200, D413, D107 +per-file-ignores= + */__init__.py: D104, F401 + +[coverage:run] +omit = + */.virtualenvs/*, + */virtualenv/*, + + */__init__.py, + tests/* diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..67a74fb --- /dev/null +++ b/setup.py @@ -0,0 +1,39 @@ +""" +Setup the package. +""" +from setuptools import find_packages, setup + +with open('README.md', 'r') as read_me: + long_description = read_me.read() + +with open('requirements.txt', 'r') as f: + requirements = f.read().splitlines() + +setup( + version='0.1.0', + name='remme-core-cli', + description='The command-line interface (CLI) that provides a set of commands to interact with Remme-core.', + long_description=long_description, + long_description_content_type='text/markdown', + url='https://github.com/Remmeauth/remme-core-cli', + license='MIT', + author='Remme', + author_email='developers@remme.io', + packages=find_packages(), + install_requires=requirements, + entry_points={ + 'console_scripts': [ + 'remme = cli.entrypoint:cli', + ] + }, + classifiers=[ + 'Operating System :: OS Independent', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + ], +) diff --git a/tests/__init.py b/tests/__init.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_entrypoint.py b/tests/test_entrypoint.py new file mode 100644 index 0000000..857554a --- /dev/null +++ b/tests/test_entrypoint.py @@ -0,0 +1,12 @@ +""" +Provide tests for implementation of the entrypoint commands. +""" +from cli.entrypoint import cli + + +def test_name(): + """ + Case: get the name of the CLI entrypoint function. + Expect: the name is the same as in setup.py (`cli`). + """ + assert 'cli' == cli.name