diff --git a/.gitignore b/.gitignore index 563dd65..5b6fa58 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,8 @@ .*env .idea/ .nvim.lua +.pytest_cache/ .python-version .venv/ __pycache__/ -build/ dist/ -pssecret.egg-info/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5ffe399..28ea134 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,8 @@ # Installation ```console -$ git clone git@git.ivnglkv.me:root/pssecret.git -$ cd pssecret +$ git clone git@git.ivnglkv.me:root/pssecret-server.git +$ cd pssecret-server $ poetry install --with=dev ``` diff --git a/README.md b/README.md index 515e0a9..3b9201c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Pssecret +# Pssecret server [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) @@ -23,24 +23,24 @@ Service is built with Python, FastAPI and is using Redis for data storage. The recommended installation method is with the [pipx](https://pipx.pypa.io/stable/) ```console -$ pipx install pssecret +$ pipx install pssecret-server ``` For faster performance, install application with [hiredis](https://github.com/redis/hiredis) support. ```console -$ pipx install pssecret[hiredis] +$ pipx install pssecret-server[hiredis] ``` ### Running Pssecret server Make sure you have the Redis service running. -After installation is done, you can start pssecret with `pssecret` command. +After installation is done, you can start pssecret server with `pssecret-server` command. The web server will be started with `uvicorn` ASGI web server. ```console -$ pssecret +$ pssecret-server ``` ### Configuration diff --git a/pssecret/__init__.py b/pssecret_server/__init__.py similarity index 100% rename from pssecret/__init__.py rename to pssecret_server/__init__.py diff --git a/pssecret/cli.py b/pssecret_server/cli.py similarity index 100% rename from pssecret/cli.py rename to pssecret_server/cli.py diff --git a/pssecret/main.py b/pssecret_server/main.py similarity index 89% rename from pssecret/main.py rename to pssecret_server/main.py index e385268..45dadd3 100644 --- a/pssecret/main.py +++ b/pssecret_server/main.py @@ -4,9 +4,9 @@ from fastapi import Depends, FastAPI from fastapi.exceptions import HTTPException from redis.asyncio import Redis -from pssecret.models import Secret, SecretSaveResult -from pssecret.redis_db import get_redis -from pssecret.utils import save_secret +from pssecret_server.models import Secret, SecretSaveResult +from pssecret_server.redis_db import get_redis +from pssecret_server.utils import save_secret app = FastAPI() diff --git a/pssecret/models.py b/pssecret_server/models.py similarity index 100% rename from pssecret/models.py rename to pssecret_server/models.py diff --git a/pssecret/redis_db.py b/pssecret_server/redis_db.py similarity index 83% rename from pssecret/redis_db.py rename to pssecret_server/redis_db.py index 5244b0e..eba1261 100644 --- a/pssecret/redis_db.py +++ b/pssecret_server/redis_db.py @@ -4,7 +4,7 @@ from typing import Annotated from fastapi import Depends from redis import asyncio as aioredis -from pssecret.settings import Settings, get_settings +from pssecret_server.settings import Settings, get_settings def get_redis(settings: Annotated[Settings, Depends(get_settings)]) -> aioredis.Redis: diff --git a/pssecret/settings.py b/pssecret_server/settings.py similarity index 100% rename from pssecret/settings.py rename to pssecret_server/settings.py diff --git a/pssecret/utils.py b/pssecret_server/utils.py similarity index 91% rename from pssecret/utils.py rename to pssecret_server/utils.py index 6d5a324..01dacfc 100644 --- a/pssecret/utils.py +++ b/pssecret_server/utils.py @@ -2,7 +2,7 @@ from uuid import uuid4 from redis.asyncio import Redis -from pssecret.models import Secret +from pssecret_server.models import Secret async def get_new_key(redis: Redis) -> str: diff --git a/pyproject.toml b/pyproject.toml index 13e27c3..306ca87 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,13 +1,13 @@ [tool.poetry] -name = "pssecret" +name = "pssecret-server" version = "0.0.1" description = "API service for secrets sharing over network" authors = ["Ivan Golikov "] license = "MIT" readme = "README.md" -homepage = "https://git.ivnglkv.me/root/pssecret" -repository = "https://git.ivnglkv.me/root/pssecret" -documentation = "https://git.ivnglkv.me/root/pssecret/wiki" +homepage = "https://git.ivnglkv.me/root/pssecret-server" +repository = "https://git.ivnglkv.me/root/pssecret-server" +documentation = "https://git.ivnglkv.me/root/pssecret-server/wiki" classifiers = [ "Development Status :: 2 - Pre-Alpha", "Environment :: Web Environment", @@ -19,7 +19,7 @@ classifiers = [ ] [tool.poetry.scripts] -pssecret = 'pssecret.cli:cli' +pssecret-server = 'pssecret_server.cli:cli' [tool.poetry.dependencies] python = "^3.11" diff --git a/tests/conftest.py b/tests/conftest.py index 932d863..87da6ad 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,8 +5,8 @@ from fastapi.testclient import TestClient from pydantic_settings import SettingsConfigDict from redis import asyncio as aioredis -from pssecret.main import app -from pssecret.settings import Settings, get_settings +from pssecret_server.main import app +from pssecret_server.settings import Settings, get_settings class TestSettings(Settings): diff --git a/tests/factories.py b/tests/factories.py index ffd86ad..3c1ac13 100644 --- a/tests/factories.py +++ b/tests/factories.py @@ -1,6 +1,6 @@ from polyfactory.factories.pydantic_factory import ModelFactory -from pssecret.models import Secret +from pssecret_server.models import Secret class SecretFactory(ModelFactory[Secret]): ... diff --git a/tests/integration/test_utils.py b/tests/integration/test_utils.py index de84fdf..bef19c4 100644 --- a/tests/integration/test_utils.py +++ b/tests/integration/test_utils.py @@ -2,7 +2,7 @@ from unittest.mock import patch from redis.asyncio import Redis -from pssecret.utils import get_new_key, save_secret +from pssecret_server.utils import get_new_key, save_secret from ..factories import SecretFactory @@ -17,7 +17,7 @@ async def test_get_new_key_returns_free_key(redis_server: Redis) -> None: assert res -@patch("pssecret.utils.uuid4", side_effect=("used", "free")) +@patch("pssecret_server.utils.uuid4", side_effect=("used", "free")) async def test_get_new_key_skips_used_keys(_, redis_server: Redis) -> None: await redis_server.set("used", "")