-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from william-cass-wright/first
cookiecutter click app
- Loading branch information
Showing
10 changed files
with
239 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
types: [ labeled ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
label-lint: | ||
if: ${{ github.event.label.name == 'lint' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Python Linter | ||
uses: sunnysid3up/python-linter@master | ||
with: | ||
source: "secrets_mgmt_cli" | ||
mypy-options: "--ignore-missing-imports --show-error-codes" | ||
isort-options: "-w 100" | ||
black-options: "-l 120" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Publish Python Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
publish-test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9", "3.10"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/cache@v3 | ||
name: Configure pip caching | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
pip install -e '.[test]' | ||
- name: Run tests | ||
run: | | ||
pytest | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: [test] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- uses: actions/cache@v3 | ||
name: Configure pip caching | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-publish-pip-${{ hashFiles('**/setup.py') }} | ||
restore-keys: | | ||
${{ runner.os }}-publish-pip- | ||
- name: Install dependencies | ||
run: | | ||
pip install setuptools wheel twine build | ||
- name: Publish | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
run: | | ||
python -m build | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Test | ||
|
||
on: | ||
pull_request: | ||
types: [ labeled ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
label-test: | ||
if: ${{ github.event.label.name == 'test' }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9", "3.10"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/cache@v3 | ||
name: Configure pip caching | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
pip install -e '.[test]' | ||
- name: Run tests | ||
run: | | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,41 @@ | ||
# secrets-mgmt-cli | ||
A simple CLI for managing secrets in AWS Secrets Manager | ||
|
||
[![PyPI](https://img.shields.io/pypi/v/secrets-mgmt-cli.svg)](https://pypi.org/project/secrets-mgmt-cli/) | ||
[![Changelog](https://img.shields.io/github/v/release/william-cass-wright/secrets-mgmt-cli?include_prereleases&label=changelog)](https://github.com/william-cass-wright/secrets-mgmt-cli/releases) | ||
[![Tests](https://github.com/william-cass-wright/secrets-mgmt-cli/workflows/Test/badge.svg)](https://github.com/william-cass-wright/secrets-mgmt-cli/actions?query=workflow%3ATest) | ||
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/william-cass-wright/secrets-mgmt-cli/blob/master/LICENSE) | ||
|
||
A simple CLI for managing secrets in AWS Secrets Manager | ||
|
||
## Installation | ||
|
||
Install this tool using `pip`: | ||
|
||
pip install secrets-mgmt-cli | ||
|
||
## Usage | ||
|
||
For help, run: | ||
|
||
secrets-mgmt-cli --help | ||
|
||
You can also use: | ||
|
||
python -m secrets_mgmt_cli --help | ||
|
||
## Development | ||
|
||
To contribute to this tool, first checkout the code. Then create a new virtual environment: | ||
|
||
cd secrets-mgmt-cli | ||
python -m venv venv | ||
source venv/bin/activate | ||
|
||
Now install the dependencies and test dependencies: | ||
|
||
pip install -e '.[test]' | ||
|
||
To run the tests: | ||
|
||
pytest |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from .cli import cli | ||
|
||
if __name__ == "__main__": | ||
cli() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import click | ||
|
||
|
||
@click.group() | ||
@click.version_option() | ||
def cli(): | ||
"A simple CLI for managing secrets in AWS Secrets Manager" | ||
|
||
|
||
@cli.command(name="command") | ||
@click.argument("example") | ||
@click.option( | ||
"-o", | ||
"--option", | ||
help="An example option", | ||
) | ||
def first_command(example, option): | ||
"Command description goes here" | ||
click.echo("Here is some output") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from setuptools import setup | ||
import os | ||
|
||
VERSION = "0.1" | ||
|
||
|
||
def get_long_description(): | ||
with open( | ||
os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md"), | ||
encoding="utf8", | ||
) as fp: | ||
return fp.read() | ||
|
||
|
||
setup( | ||
name="secrets-mgmt-cli", | ||
description="A simple CLI for managing secrets in AWS Secrets Manager", | ||
long_description=get_long_description(), | ||
long_description_content_type="text/markdown", | ||
author="Will Wright", | ||
url="https://github.com/william-cass-wright/secrets-mgmt-cli", | ||
project_urls={ | ||
"Issues": "https://github.com/william-cass-wright/secrets-mgmt-cli/issues", | ||
"CI": "https://github.com/william-cass-wright/secrets-mgmt-cli/actions", | ||
"Changelog": "https://github.com/william-cass-wright/secrets-mgmt-cli/releases", | ||
}, | ||
license="Apache License, Version 2.0", | ||
version=VERSION, | ||
packages=["secrets_mgmt_cli"], | ||
entry_points=""" | ||
[console_scripts] | ||
secrets-mgmt-cli=secrets_mgmt_cli.cli:cli | ||
""", | ||
install_requires=["click"], | ||
extras_require={ | ||
"test": ["pytest"] | ||
}, | ||
python_requires=">=3.7", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from click.testing import CliRunner | ||
from secrets_mgmt_cli.cli import cli | ||
|
||
|
||
def test_version(): | ||
runner = CliRunner() | ||
with runner.isolated_filesystem(): | ||
result = runner.invoke(cli, ["--version"]) | ||
assert result.exit_code == 0 | ||
assert result.output.startswith("cli, version ") |