diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7048636..9477373 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,28 +24,29 @@ jobs: if: failure() run: git diff - tests: - name: Test-${{ matrix.os }}-Py${{ matrix.python-version }} - needs: pre-commit - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - python-version: [ '3.6', '3.7' ] - steps: - - name: Checkout to master - uses: actions/checkout@master - - - name: Setup Python-${{ matrix.python-version }} - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - architecture: x64 - - - name: Setup Package - run: python -m pip install . - - - name: Unit Tests - run: | - python -m pip install pytest - py.test -v +# For future use +# tests: +# name: Test-${{ matrix.os }}-Py${{ matrix.python-version }} +# needs: pre-commit +# runs-on: ${{ matrix.os }} +# strategy: +# matrix: +# os: [ubuntu-latest, windows-latest, macos-latest] +# python-version: [ '3.6', '3.7' ] +# steps: +# - name: Checkout to master +# uses: actions/checkout@master +# +# - name: Setup Python-${{ matrix.python-version }} +# uses: actions/setup-python@v1 +# with: +# python-version: ${{ matrix.python-version }} +# architecture: x64 +# +# - name: Setup Package +# run: python -m pip install . +# +# - name: Unit Tests +# run: | +# python -m pip install pytest +# py.test -v diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9605dbd..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: python -python: -- '3.7' -install: -- pip install -r requirements.txt -- pip install flake8 -- pip install rstcheck -script: -- flake8 --ignore=E128,W191,E117,E101 --max-line-length 100 genpass/*.py setup.py -- rstcheck README.rst - - diff --git a/README.rst b/README.rst index ab1f71e..64f2d7d 100644 --- a/README.rst +++ b/README.rst @@ -3,8 +3,6 @@ PyGenpass - Command Line Password Generator and Manager Tool How to run project? =================== - - * Create a virtual environment on your local machine .. code-block:: bash @@ -27,22 +25,19 @@ How to run project? $ git clone https://github.com/paint-it/pygenpass.git +* Install using pip or setup.py -* Install setup.py or install using pip - .. code-block:: bash - + $ pip install pygenpass $ python3 setup.py install - * Use command **pygenpass** Command line options ==================== - .. code-block:: bash $ pygenpass @@ -62,7 +57,6 @@ Command line options Examples ======== - * This command will ask for portal name and will create random password .. code-block:: bash @@ -107,5 +101,4 @@ Dependencies How to contribute to this project? ================================== - * Please read `contributing.md `_ diff --git a/contributing.md b/contributing.md index 4353868..19a7d0b 100644 --- a/contributing.md +++ b/contributing.md @@ -1,29 +1,22 @@ -# Steps to contribute: +# Steps to contribute: * Fork this project on your GitHub account - * Create virtual environment on your local machine ```nashorn js $ python3 -m venv env - -``` -* Activate virtual environment +``` +* Activate virtual environment ```nashorn js - $ source env/bin/activate - ``` * Make a local directory - * Clone project in your directory ```nashorn js $ git clone https://github.com/paint-it/pygenpass.git - ``` - * Update with your changes and install project locally using **setup.py** file ```nashorn js $ python3 setup.py install ``` -* After successful installation; try **pygenpass** command +* After successful installation; try **pygenpass** command * Commit this changes and make a PR * Be a part of **PyGenpass!!!** diff --git a/pygenpass/__init__.py b/pygenpass/__init__.py index 9cc6611..c7a5372 100644 --- a/pygenpass/__init__.py +++ b/pygenpass/__init__.py @@ -19,15 +19,15 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ - import click + +from pygenpass.password import allpass from pygenpass.password import createpass +from pygenpass.password import delpass +from pygenpass.password import modpass from pygenpass.password import savepass from pygenpass.password import showpass -from pygenpass.password import delpass from pygenpass.password import version -from pygenpass.password import modpass -from pygenpass.password import allpass @click.group() diff --git a/pygenpass/database.py b/pygenpass/database.py index 03da862..1bcd879 100644 --- a/pygenpass/database.py +++ b/pygenpass/database.py @@ -19,7 +19,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ - import sqlite3 # library for database @@ -32,10 +31,10 @@ def __init__(self): self.con = sqlite3.connect("generated_password.db") self.cursor_obj = self.con.cursor() self.cursor_obj.execute( - """CREATE TABLE IF NOT EXISTS passwords - (id integer PRIMARY KEY,portal_name text NOT NULL UNIQUE, password varchar, - creation_date varchar, email varchar, portal_url varchar) - """ + """CREATE TABLE IF NOT EXISTS passwords( + id integer PRIMARY KEY,portal_name text NOT NULL UNIQUE, password varchar, + creation_date varchar, email varchar, portal_url varchar) + """ ) self.con.commit() @@ -50,7 +49,7 @@ def insert_data(self, portal_name, password, creation_date, email, portal_url): """INSERT INTO passwords (portal_name, password, creation_date, email, portal_url) VALUES (?, ?, ?, ?, ?)""", - (self.portal_name, self.password, self.creation_date, self.email, self.portal_url,), + (self.portal_name, self.password, self.creation_date, self.email, self.portal_url), ) self.con.commit() @@ -76,7 +75,7 @@ def show_data(self, portal_name): """All inserted data will showed""" self.portal_name = portal_name self.cursor_obj.execute( - """SELECT password FROM passwords WHERE portal_name=?""", (self.portal_name,), + """SELECT password FROM passwords WHERE portal_name=?""", (self.portal_name,) ) rows = self.cursor_obj.fetchall() diff --git a/pygenpass/password.py b/pygenpass/password.py index cd3d301..3ee29a8 100644 --- a/pygenpass/password.py +++ b/pygenpass/password.py @@ -19,14 +19,21 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -import click # Used for command line interface -import diceware # Used for creating password -from pygenpass.database import DatabaseConnection from datetime import date -from beautifultable import BeautifulTable # display output in table format +import click +import diceware +from beautifultable import BeautifulTable + +from pygenpass.database import DatabaseConnection db_obj = DatabaseConnection() +table = BeautifulTable() +table.left_border_char = "|" +table.right_border_char = "|" +table.top_border_char = "=" +table.header_separator_char = "=" +table.column_headers = ["ID", "PORTAL_NAME", "PASSWORD", "DATE", "EMAIL", "PORTAL_URL"] @click.command(help="Show Version") @@ -39,15 +46,9 @@ def allpass(): all_pass = db_obj.show_all_data() if all_pass == []: print("No records found") - table = BeautifulTable() - table.left_border_char = "|" - table.right_border_char = "|" - table.top_border_char = "=" - table.header_separator_char = "=" - table.column_headers = ["ID", "PORTAL_NAME", "PASSWORD", "DATE", "EMAIL", "PORTAL_URL"] for row in all_pass: table.append_row([row[0], row[1], row[2], row[3], row[4], row[5]]) - print(table) + print(table) @click.command(help="Delete password")