Migrate to pyproject, add black/flake8/bandit/etc.

This commit is contained in:
Darryl Nixon 2023-05-23 14:33:32 -07:00
parent eb99384b1e
commit 7c5919f073
11 changed files with 69 additions and 23 deletions

4
.env
View file

@ -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
DATABASE_NAME=ghostforge

3
.flake8 Normal file
View file

@ -0,0 +1,3 @@
[flake8]
max-line-length = 160
exclude = docs/*, .git, __pycache__

28
.pre-commit-config.yaml Normal file
View file

@ -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

View file

@ -14,4 +14,4 @@ ENV GHOSTFORGE_INTERNAL_WEB_PORT=8080
ENV PYTHONPATH=/ghostforge/ghostforge
EXPOSE ${GHOSTFORGE_INTERNAL_WEB_PORT}
CMD [ "ghostforge_serve" ]
CMD [ "ghostforge_serve" ]

View file

@ -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.
SOFTWARE.

View file

@ -2,7 +2,7 @@
<img src="doc/ghostforge.png" alt="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.<br/>
@ -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.
This project is licensed under the MIT License. See the `LICENSE` file for details.

View file

@ -18,4 +18,4 @@ services:
depends_on: [ghostforge-db]
volumes:
ghostforge-db-data:
name: ghostforge-db-data
name: ghostforge-db-data

0
ghostforge/cli.py Normal file
View file

30
pyproject.toml Normal file
View file

@ -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"

View file

@ -1 +1 @@
.
.

View file

@ -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"],
)