diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..f090a69 --- /dev/null +++ b/.flake8 @@ -0,0 +1,3 @@ +[flake8] +max-line-length = 88 +extend-ignore = E203, B008 diff --git a/.gitignore b/.gitignore index b2c4cd9..a4dbcac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ venv/ .idea/ dist/ -rectes.egg-info/ +pssecret.egg-info/ build/ -conf/rectes.toml +conf/pssecret.toml __pycache__/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b75103d..63c854d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,29 +1,28 @@ repos: - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 24.10.0 hooks: - id: black language_version: python3.11 - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v5.0.0 hooks: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/pycqa/flake8 - rev: 4.0.1 + rev: 7.1.1 hooks: - id: flake8 - entry: pflake8 + args: [--config, .flake8] additional_dependencies: - flake8-bugbear - flake8-comprehensions - flake8-simplify - - pyproject-flake8 - repo: https://github.com/pycqa/isort - rev: 5.10.1 + rev: 5.13.2 hooks: - id: isort name: isort diff --git a/README.md b/README.md index d360349..4dea036 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -# Rectes +# Pssecret [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) -Rectes (anagram from "secret") is self-hosted service to share secrets (like passwords) with somebody +Pssecret is self-hosted service to share secrets (like passwords) with somebody over the network, but don't want them to appear in chats, unencrypted e-mails, etc. This service tries to be as anonymous as possible. The only personal information that will be stored @@ -23,7 +23,7 @@ Service is built with Python, FastAPI and is using Redis for data storage. #### TL/DR ```bash -$ git clone git@git.ivnglkv.ru:ivnglkv/rectes.git +$ git clone git@git.ivnglkv.me:root/pssecret.git $ python3 -m venv venv $ . ./venv/bin/activate $ pip install . @@ -31,33 +31,33 @@ $ pip install . --- -Steps to install Rectes: +Steps to install Pssecret: 1. Clone repository 2. (optional) Create virtual environment 3. Install package -### Running Rectes server +### Running Pssecret server -After installation is done, you can start rectes with `rectes` command. +After installation is done, you can start pssecret with `pssecret` command. The web server will be started with `uvicorn` ASGI web server. ```bash -$ rectes +$ pssecret ``` ### Configuration -Configuration is done through config file. By default, path is `/etc/rectes/rectes.toml`. -You can override this by setting environment variable `RECTES_CONF_FILE` value to actual file +Configuration is done through config file. By default, path is `/etc/pssecret/pssecret.toml`. +You can override this by setting environment variable `PSSECRET_CONF_FILE` value to actual file location, i.e.: ```bash -$ RECTES_CONF_FILE=/home/user/.conf/rectes.toml rectes +$ PSSECRET_CONF_FILE=/home/user/.conf/pssecret.toml pssecret ``` You can find all available configuration options in the example file, located -at [conf/rectes.toml.example](conf/rectes.toml.example) under Git root. +at [conf/pssecret.toml.example](conf/pssecret.toml.example) under Git root. ## Contributing @@ -66,7 +66,7 @@ Flake8 and isort. Prior to making any commits, install `pre-commit` tool and ins ```bash # Alternatively, you could use 'pip install ".[development]"' -$ pip install pre-commit==2.19.0 +$ pip install pre-commit $ pre-commit install ``` diff --git a/conf/rectes.toml.example b/conf/pssecret.toml.example similarity index 100% rename from conf/rectes.toml.example rename to conf/pssecret.toml.example diff --git a/pyproject.toml b/pyproject.toml index 869016d..db1cb73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,3 @@ build-backend = "setuptools.build_meta" [tool.isort] profile = "black" - -[tool.flake8] -max-line-length = 88 -extend-ignore = "E203, B008" diff --git a/setup.cfg b/setup.cfg index be2106f..fb8bfcd 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [metadata] -name = rectes +name = pssecret version = 0.1 [options] @@ -18,7 +18,7 @@ development = [options.entry_points] console_scripts = - rectes = rectes:cli + pssecret = pssecret:cli [options.packages.find] where = src diff --git a/src/rectes/__init__.py b/src/pssecret/__init__.py similarity index 100% rename from src/rectes/__init__.py rename to src/pssecret/__init__.py diff --git a/src/rectes/cli.py b/src/pssecret/cli.py similarity index 100% rename from src/rectes/cli.py rename to src/pssecret/cli.py diff --git a/src/rectes/main.py b/src/pssecret/main.py similarity index 84% rename from src/rectes/main.py rename to src/pssecret/main.py index 26d66b8..0097e93 100644 --- a/src/rectes/main.py +++ b/src/pssecret/main.py @@ -1,9 +1,9 @@ from fastapi import FastAPI from fastapi.exceptions import HTTPException -from rectes.models import Secret, SecretSaveResult -from rectes.redis_db import redis -from rectes.utils import get_new_key +from pssecret.models import Secret, SecretSaveResult +from pssecret.redis_db import redis +from pssecret.utils import get_new_key app = FastAPI() diff --git a/src/rectes/models.py b/src/pssecret/models.py similarity index 100% rename from src/rectes/models.py rename to src/pssecret/models.py diff --git a/src/rectes/redis_db.py b/src/pssecret/redis_db.py similarity index 78% rename from src/rectes/redis_db.py rename to src/pssecret/redis_db.py index 0cefcb3..8ec0494 100644 --- a/src/rectes/redis_db.py +++ b/src/pssecret/redis_db.py @@ -1,6 +1,6 @@ # noinspection PyUnresolvedReferences,PyProtectedMember from redis import asyncio as aioredis -from rectes.settings import settings +from pssecret.settings import settings redis = aioredis.from_url(settings.redis.url) diff --git a/src/rectes/settings.py b/src/pssecret/settings.py similarity index 85% rename from src/rectes/settings.py rename to src/pssecret/settings.py index 8502888..31178a9 100644 --- a/src/rectes/settings.py +++ b/src/pssecret/settings.py @@ -1,5 +1,4 @@ import os - import tomllib @@ -9,7 +8,7 @@ class Settings: self._data = data else: with open( - os.getenv("RECTES_CONF_FILE", "/etc/rectes/rectes.toml"), "rb" + os.getenv("PSSECRET_CONF_FILE", "/etc/pssecret/pssecret.toml"), "rb" ) as f: self._data = tomllib.load(f) diff --git a/src/rectes/utils.py b/src/pssecret/utils.py similarity index 83% rename from src/rectes/utils.py rename to src/pssecret/utils.py index 8fccdf2..f9fd015 100644 --- a/src/rectes/utils.py +++ b/src/pssecret/utils.py @@ -1,6 +1,6 @@ from uuid import uuid4 -from rectes.redis_db import redis +from pssecret.redis_db import redis async def get_new_key() -> str: