From 7c5919f073e114376df5cbd02f2e3da447627b33 Mon Sep 17 00:00:00 2001 From: Darryl Nixon Date: Tue, 23 May 2023 14:33:32 -0700 Subject: [PATCH] Migrate to pyproject, add black/flake8/bandit/etc. --- .env | 4 ++-- .flake8 | 3 +++ .pre-commit-config.yaml | 28 ++++++++++++++++++++++++++++ Dockerfile | 2 +- LICENSE | 2 +- README.md | 4 ++-- docker-compose.yml | 2 +- ghostforge/cli.py | 0 pyproject.toml | 30 ++++++++++++++++++++++++++++++ requirements.txt | 2 +- setup.py | 15 --------------- 11 files changed, 69 insertions(+), 23 deletions(-) create mode 100644 .flake8 create mode 100644 .pre-commit-config.yaml create mode 100644 ghostforge/cli.py create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.env b/.env index daa542a..1f45160 100644 --- a/.env +++ b/.env @@ -1,7 +1,7 @@ # GHOSTFORGE_*_WEB_PORT variables are used to determine what # port the web interface is served on within the container (INTERNAL) # and what port this will map to on the host (HOST). -# +# # If you're using a dockerized reverse proxy, you may want to remove # the port mapping entirely within docker-compose.yml. GHOSTFORGE_HOST_WEB_PORT=1337 @@ -15,4 +15,4 @@ GHOSTFORGE_ENV=prod # ghostforge postgresql database and to later access the data from # ghostforge execution. DATABASE_USER=ghost -DATABASE_NAME=ghostforge \ No newline at end of file +DATABASE_NAME=ghostforge diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..c8ef649 --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] +max-line-length = 160 +exclude = docs/*, .git, __pycache__ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..9d6f1b6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,28 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files +- repo: https://github.com/asottile/reorder_python_imports + rev: v3.9.0 + hooks: + - id: reorder-python-imports + args: [--application-directories, '.:ghostforge', --py39-plus] +- repo: https://github.com/psf/black + rev: 23.3.0 + hooks: + - id: black + language_version: python3.11 +- repo: https://github.com/PyCQA/bandit + rev: 1.7.5 + hooks: + - id: bandit + args: ["-c", "pyproject.toml"] + additional_dependencies: ["bandit[toml]"] +- repo: https://github.com/pycqa/flake8 + rev: 6.0.0 + hooks: + - id: flake8 diff --git a/Dockerfile b/Dockerfile index 47d789d..9c41fdd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,4 +14,4 @@ ENV GHOSTFORGE_INTERNAL_WEB_PORT=8080 ENV PYTHONPATH=/ghostforge/ghostforge EXPOSE ${GHOSTFORGE_INTERNAL_WEB_PORT} -CMD [ "ghostforge_serve" ] \ No newline at end of file +CMD [ "ghostforge_serve" ] diff --git a/LICENSE b/LICENSE index e64aedc..b755867 100644 --- a/LICENSE +++ b/LICENSE @@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. diff --git a/README.md b/README.md index 89e6963..3019662 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ghostforge Logo # ghostforge - + ghostforge manages **false identity information** for privacy prudent persons. tl;dr it's a fancy DB frontend with sensible design, tailored features, and a nice UX.
@@ -52,4 +52,4 @@ This tool was written as part of my coursework for CSC 842 - Security Tool Devel ## License -This project is licensed under the MIT License. See the `LICENSE` file for details. \ No newline at end of file +This project is licensed under the MIT License. See the `LICENSE` file for details. diff --git a/docker-compose.yml b/docker-compose.yml index e5dc6b0..3ab6d64 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,4 +18,4 @@ services: depends_on: [ghostforge-db] volumes: ghostforge-db-data: - name: ghostforge-db-data \ No newline at end of file + name: ghostforge-db-data diff --git a/ghostforge/cli.py b/ghostforge/cli.py new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..8ae3448 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,30 @@ +[build-system] +requires = ["setuptools>=61.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "ghostforge" +version = "0.0.1" +authors = [{ name = "ghostforge", email = "git@nixon.mozmail.com" }] +description = "A false identity information manager for privacy prudent persons" +readme = "README.md" +requires-python = ">=3.9" +dependencies = ["tornado", "queries"] +license = "MIT" + +[project.scripts] +ghostforge_serve = "ghostforge.cli:service" + +[project.urls] +"Homepage" = "https://github.com/DarrylNixon/ghostforge" +"Bug Tracker" = "https://github.com/DarrylNixon/ghostforge/issues" + +[tool.bandit] +exclude_dirs = ["/doc"] +skips = [] + +[tool.black] +line-length = 120 + +[tool.isort] +profile = "black" diff --git a/requirements.txt b/requirements.txt index 945c9b4..9c558e3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -. \ No newline at end of file +. diff --git a/setup.py b/setup.py deleted file mode 100644 index ff6e5f8..0000000 --- a/setup.py +++ /dev/null @@ -1,15 +0,0 @@ -from distutils.core import setup -from setuptools import find_packages -from ghostforge import _PROJECT, __version__ - -setup( - name=_PROJECT, - version=__version__, - packages=find_packages(), - license="MIT", - author="ghostforge", - description="False identity management web app", - long_description="A false identity information manager for privacy prudent persons", - keywords=["ghostforge", "persona", "red team", "tornado"], - install_requires=["tornado>=6.3.2", "queries>=2.1.1"], -)