diff --git a/core/db.py b/core/db.py index dc7fb9d..b7e3d5e 100644 --- a/core/db.py +++ b/core/db.py @@ -128,10 +128,13 @@ class Database(Compat): database_uri = f"sqlite:///{self.path}" self.type = SQLITE else: - raise NotADirectoryError( - f"db_location named {self.db_location} was not created" - f" - please 'mkdir {self.db_location}' and try again" - ) + print(f"Creating database directory: {self.db_location}") + if not os.path.exists(self.db_location): + os.makedirs(self.db_location) + # raise NotADirectoryError( + # f"db_location named {self.db_location} was not created" + # f" - please 'mkdir {self.db_location}' and try again" + # ) self.schema = self.name if self.name.startswith("ext_"): self.schema = self.name[4:] diff --git a/core/settings.py b/core/settings.py index d07f2cb..b8159aa 100644 --- a/core/settings.py +++ b/core/settings.py @@ -9,12 +9,12 @@ LIGHTNING_FEE_PERCENT = env.float("LIGHTNING_FEE_PERCENT", default=1.0) assert LIGHTNING_FEE_PERCENT >= 0, "LIGHTNING_FEE_PERCENT must be at least 0" LIGHTNING_RESERVE_FEE_MIN = env.float("LIGHTNING_RESERVE_FEE_MIN", default=4000) -MINT_PRIVATE_KEY = env.str("MINT_PRIVATE_KEY") +MINT_PRIVATE_KEY = env.str("MINT_PRIVATE_KEY", default=None) MINT_SERVER_HOST = env.str("MINT_SERVER_HOST", default="127.0.0.1") MINT_SERVER_PORT = env.int("MINT_SERVER_PORT", default=3338) -MINT_HOST = env.str("MINT_HOST", default="127.0.0.1") +MINT_HOST = env.str("MINT_HOST", default="8333.space") MINT_PORT = env.int("MINT_PORT", default=3338) if MINT_HOST in ["localhost", "127.0.0.1"]: diff --git a/pyproject.toml b/pyproject.toml index 183aa3e..0c96694 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ authors = ["calle "] license = "MIT" [tool.poetry.dependencies] -python = "^3.8" +python = "^3.7" requests = "2.27.1" pytest-asyncio = "0.19.0" SQLAlchemy = "1.3.24" diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..e17b215 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,49 @@ +anyio==3.6.1 ; python_version >= "3.7" and python_version < "4.0" +asgiref==3.5.2 ; python_version >= "3.7" and python_version < "4.0" +attrs==22.1.0 ; python_version >= "3.7" and python_version < "4.0" +bech32==1.2.0 ; python_version >= "3.7" and python_version < "4.0" +bitstring==3.1.9 ; python_version >= "3.7" and python_version < "4.0" +certifi==2022.9.14 ; python_version >= "3.7" and python_version < "4.0" +cffi==1.15.1 ; python_version >= "3.7" and python_version < "4.0" +charset-normalizer==2.0.12 ; python_version >= "3.7" and python_version < "4.0" +click==8.0.4 ; python_version >= "3.7" and python_version < "4.0" +colorama==0.4.5 ; python_version >= "3.7" and python_version < "4.0" and platform_system == "Windows" or python_version >= "3.7" and python_version < "4.0" and sys_platform == "win32" +ecdsa==0.18.0 ; python_version >= "3.7" and python_version < "4.0" +environs==9.5.0 ; python_version >= "3.7" and python_version < "4.0" +fastapi==0.83.0 ; python_version >= "3.7" and python_version < "4.0" +flask==2.2.2 ; python_version >= "3.7" and python_version < "4.0" +h11==0.13.0 ; python_version >= "3.7" and python_version < "4.0" +idna==3.3 ; python_version >= "3.7" and python_version < "4.0" +importlib-metadata==4.12.0 ; python_version >= "3.7" and python_version < "3.10" +iniconfig==1.1.1 ; python_version >= "3.7" and python_version < "4.0" +itsdangerous==2.1.1 ; python_version >= "3.7" and python_version < "4.0" +jinja2==3.0.3 ; python_version >= "3.7" and python_version < "4.0" +loguru==0.6.0 ; python_version >= "3.7" and python_version < "4.0" +markupsafe==2.1.1 ; python_version >= "3.7" and python_version < "4.0" +marshmallow==3.18.0 ; python_version >= "3.7" and python_version < "4.0" +outcome==1.2.0 ; python_version >= "3.7" and python_version < "4.0" +packaging==21.3 ; python_version >= "3.7" and python_version < "4.0" +pluggy==1.0.0 ; python_version >= "3.7" and python_version < "4.0" +psycopg2-binary==2.9.3 ; python_version >= "3.7" and python_version < "4.0" +py==1.11.0 ; python_version >= "3.7" and python_version < "4.0" +pycparser==2.21 ; python_version >= "3.7" and python_version < "4.0" +pydantic==1.10.2 ; python_version >= "3.7" and python_version < "4.0" +pyparsing==3.0.9 ; python_version >= "3.7" and python_version < "4.0" +pytest-asyncio==0.19.0 ; python_version >= "3.7" and python_version < "4.0" +pytest==7.1.3 ; python_version >= "3.7" and python_version < "4.0" +python-dotenv==0.21.0 ; python_version >= "3.7" and python_version < "4.0" +represent==1.6.0.post0 ; python_version >= "3.7" and python_version < "4.0" +requests==2.27.1 ; python_version >= "3.7" and python_version < "4.0" +secp256k1==0.14.0 ; python_version >= "3.7" and python_version < "4.0" +six==1.16.0 ; python_version >= "3.7" and python_version < "4.0" +sniffio==1.3.0 ; python_version >= "3.7" and python_version < "4.0" +sqlalchemy-aio==0.17.0 ; python_version >= "3.7" and python_version < "4.0" +sqlalchemy==1.3.24 ; python_version >= "3.7" and python_version < "4.0" +starlette==0.19.1 ; python_version >= "3.7" and python_version < "4.0" +tomli==2.0.1 ; python_version >= "3.7" and python_version < "4.0" +typing-extensions==4.3.0 ; python_version >= "3.7" and python_version < "4.0" +urllib3==1.26.12 ; python_version >= "3.7" and python_version < "4" +uvicorn==0.18.3 ; python_version >= "3.7" and python_version < "4.0" +werkzeug==2.2.2 ; python_version >= "3.7" and python_version < "4.0" +win32-setctime==1.1.0 ; python_version >= "3.7" and python_version < "4.0" and sys_platform == "win32" +zipp==3.8.1 ; python_version >= "3.7" and python_version < "3.10" diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..0f75582 --- /dev/null +++ b/setup.py @@ -0,0 +1,34 @@ +import setuptools + +from os import path + +this_directory = path.abspath(path.dirname(__file__)) +with open(path.join(this_directory, "README.md"), encoding="utf-8") as f: + long_description = f.read() + +with open("requirements.txt") as f: + requirements = f.read().splitlines() + +entry_points = {"console_scripts": ["cashu = wallet.cashu:cli"]} + +setuptools.setup( + name="cashu", + version="0.1.3", + description="Ecash wallet and mint with Bitcoin Lightning support", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/callebtc/cashu", + author="Calle", + author_email="calle@protonmail.com", + license="MIT", + packages=setuptools.find_packages(), + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], + python_requires=">=3.7", + install_requires=requirements, + include_package_data=True, + entry_points=entry_points, +)