diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..862c72b --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,20 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer +- repo: https://github.com/psf/black + rev: "22.1.0" + hooks: + - id: black +- repo: local + hooks: + - id: pylint + name: pylint + entry: pylint + language: system + types: [python] + args: [ + "--rcfile=.pylintrc", # Link to your config file + ] diff --git a/.vscode/settings.json b/.vscode/settings.json index 90f8752..804208b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -38,4 +38,4 @@ "**/__pycache__": true, "**/pwsync.egg-info": true, } -} \ No newline at end of file +} diff --git a/MANIFEST.in b/MANIFEST.in index 86def09..6a25f22 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1 @@ -prune tests* \ No newline at end of file +prune tests* diff --git a/README.md b/README.md index 09a873b..71635c8 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,15 @@ _pwsync_ is a low level command line tool that synchronizes _password databases_. `pwsync` grew from a personal need to simplify credential usage for online services -(e.g. for web shops, banks, cloud services, ...) +(e.g. for web shops, banks, cloud services, ...) on different platforms (Ubuntu, iPad, Android mobile, ...). -Keepass feels outdated for such use-cases. +Keepass feels outdated for such use-cases. Bitwarden (and alikes) simplify authentication thanks to its [browser extension](https://bitwarden.com/help/article/getting-started-browserext/). -Due to the personal use case, `pwsync` only supports +Due to the personal use case, `pwsync` only supports [_Keepass_](https://keepass.info/) database files and [_Bitwarden_](https://bitwarden.com/) online database. -But anybody can add support for other cloud password services +But anybody can add support for other cloud password services if their (public) REST API is known with a Pull Request. These properties of the password database features are handled (the _lowest common denominator_): @@ -38,7 +38,7 @@ These properties of the password database features are handled (the _lowest comm (Keepass keeps this in its attributes property as _pws_sync_) Support for fields, icons, expiration date, the automatic creation of organizations, -changes on a credential's collection set, Bitwarden's reprompt, +changes on a credential's collection set, Bitwarden's reprompt, Bitwarden's multiple urls and matching patterns, privately hosted Bitwarden etc. _is currently missing_! @@ -68,8 +68,6 @@ pwsync -h This tool and its installation description can be found [here](https://bitwarden.com/help/article/cli/#download-and-install). -Take care! The Bitwarden-cli version 1.21.1 regressed since 1.19.1. -Find the issue here: https://github.com/bitwarden/cli/issues/490. So use version 1.19.1! ```bash npm install -g @bitwarden/cli@1.19.1 ``` @@ -106,19 +104,22 @@ python -m pip install --upgrade -e .[dev] # and/or with tools for building a distribution python -m pip install --upgrade .[build] + +# install a git pre-commit hooks according to .pre-commit-config.yaml +pre-commit install ``` ### Development ```bash -# format the source code (configuration in pyproject.toml) +# format the source code (configuration in pyproject.toml) (done by pre-commit hook) python -m black pwsync/*.py tests/*.py -# linting and source code analysis +# linting and source code analysis (ran in pre-commit hook) python -m pylint pwsync tests || echo "FAILED" python -m pylama pwsync/*.py -# tests with an xml coverage report for pwsync +# tests with an xml coverage report for pwsync # the test_bwc requires an online account; provide the credentials in env. vars. export TEST_BW_CLIENT_ID= export TEST_BW_CLIENT_SECRET= @@ -130,7 +131,7 @@ python -m pytest -s -vvv --cov=pwsync --cov-report=xml:cov.xml tests || echo "FA python -m build # upload on testpypi -twine check dist/* # basic check +twine check --strict dist/* # basic check # do a minimal test of the package in a new venv deactivate diff --git a/setup.py b/setup.py index c0502ce..c0ae4d9 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ setup( name="pwsync", license="GPL3", - license_files=('LICENSE',), + license_files=("LICENSE",), author="Francis Meyvis", author_email="pwsync@mikmak.fun", description="Synchronize password databases", @@ -35,7 +35,7 @@ install_requires=[ "pykeepass==4.0.1", "diffsync==1.4.2", - "prompt-toolkit==3.0.28" + "prompt-toolkit==3.0.28", ], extras_require={ "dev": [ @@ -47,13 +47,14 @@ "pytz", "types-python-dateutil", "types-pytz", + "pre-commit", ], "build": [ "setuptools>=45.0", "wheel", "build", - "twine" - ] + "twine", + ], }, entry_points={ "console_scripts": ["pwsync=pwsync.main:main"],