From 94aeeba88d09d3d0eac680bb2aa82a07a783c0e6 Mon Sep 17 00:00:00 2001 From: 132ikl <132@ikl.sh> Date: Fri, 24 Feb 2023 16:11:13 -0500 Subject: [PATCH] Switch to pyproject.toml structure --- liteshort/__init__.py | 0 pyproject.toml | 33 ++++++++++++++++++ setup.py | 30 ---------------- src/liteshort/__init__.py | 1 + {liteshort => src/liteshort}/config.py | 0 .../liteshort}/config.template.yml | 0 .../main.py => src/liteshort/liteshort.py | 4 --- .../liteshort}/static/GitHub.svg | 0 .../liteshort}/static/favicon.ico | Bin .../liteshort}/static/styles.css | 0 .../liteshort}/templates/main.html | 0 {liteshort => src/liteshort}/util.py | 0 {liteshort => src/liteshort}/wsgi.py | 0 13 files changed, 34 insertions(+), 34 deletions(-) delete mode 100644 liteshort/__init__.py create mode 100644 pyproject.toml delete mode 100644 setup.py create mode 100644 src/liteshort/__init__.py rename {liteshort => src/liteshort}/config.py (100%) rename {liteshort => src/liteshort}/config.template.yml (100%) rename liteshort/main.py => src/liteshort/liteshort.py (99%) rename {liteshort => src/liteshort}/static/GitHub.svg (100%) rename {liteshort => src/liteshort}/static/favicon.ico (100%) rename {liteshort => src/liteshort}/static/styles.css (100%) rename {liteshort => src/liteshort}/templates/main.html (100%) rename {liteshort => src/liteshort}/util.py (100%) rename {liteshort => src/liteshort}/wsgi.py (100%) diff --git a/liteshort/__init__.py b/liteshort/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..bc30cb2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,33 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "liteshort" +version = "1.2.3" +dependencies = [ + "appdirs~=1.4", + "bcrypt~=4.0", + "flask~=2.2", + "pyyaml~=6.0", + "requests~=2.28", +] +authors = [ + {name = "Rose Spangler", email = "rose@ikl.sh"}, +] +description = "User-friendly, actually lightweight, and configurable URL shortener" +readme = "README.md" +requires-python = ">=3.8" +classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: MIT License", + "Operating System :: POSIX :: Linux", +] +license = {text = "MIT"} + +[project.scripts] +liteshort = "liteshort:app.run" +lshash = "liteshort.util:hash_passwd" + +[tool.setuptools.package-data] +liteshort = ["templates/*", "static/*", "config.template.yml"] diff --git a/setup.py b/setup.py deleted file mode 100644 index 564bc16..0000000 --- a/setup.py +++ /dev/null @@ -1,30 +0,0 @@ -import setuptools - -with open("README.md", "r") as fh: - long_description = fh.read() - -setuptools.setup( - name="liteshort", - version="1.2.3", - author="Rose Spangler", - author_email="132@ikl.sh", - description="User-friendly, actually lightweight, and configurable URL shortener", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://git.ikl.sh/132ikl/liteshort", - packages=setuptools.find_packages(), - package_data={"liteshort": ["templates/*", "static/*", "config.template.yml"]}, - entry_points={ - "console_scripts": [ - "liteshort = liteshort.main:app.run", - "lshash = liteshort.util:hash_passwd", - ] - }, - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - "Operating System :: POSIX :: Linux", - ], - install_requires=["flask~=1.1.2", "bcrypt~=3.1.7", "pyyaml", "appdirs~=1.4.3"], - python_requires=">=3.8", -) diff --git a/src/liteshort/__init__.py b/src/liteshort/__init__.py new file mode 100644 index 0000000..9a34f86 --- /dev/null +++ b/src/liteshort/__init__.py @@ -0,0 +1 @@ +from .liteshort import app diff --git a/liteshort/config.py b/src/liteshort/config.py similarity index 100% rename from liteshort/config.py rename to src/liteshort/config.py diff --git a/liteshort/config.template.yml b/src/liteshort/config.template.yml similarity index 100% rename from liteshort/config.template.yml rename to src/liteshort/config.template.yml diff --git a/liteshort/main.py b/src/liteshort/liteshort.py similarity index 99% rename from liteshort/main.py rename to src/liteshort/liteshort.py index 045d8ed..d3c2f87 100644 --- a/liteshort/main.py +++ b/src/liteshort/liteshort.py @@ -356,7 +356,3 @@ def main_post(): return response(request, get_baseUrl() + short, "Error: Failed to generate") else: return response(request, None, "Long URL required") - - -if __name__ == "__main__": - app.run() diff --git a/liteshort/static/GitHub.svg b/src/liteshort/static/GitHub.svg similarity index 100% rename from liteshort/static/GitHub.svg rename to src/liteshort/static/GitHub.svg diff --git a/liteshort/static/favicon.ico b/src/liteshort/static/favicon.ico similarity index 100% rename from liteshort/static/favicon.ico rename to src/liteshort/static/favicon.ico diff --git a/liteshort/static/styles.css b/src/liteshort/static/styles.css similarity index 100% rename from liteshort/static/styles.css rename to src/liteshort/static/styles.css diff --git a/liteshort/templates/main.html b/src/liteshort/templates/main.html similarity index 100% rename from liteshort/templates/main.html rename to src/liteshort/templates/main.html diff --git a/liteshort/util.py b/src/liteshort/util.py similarity index 100% rename from liteshort/util.py rename to src/liteshort/util.py diff --git a/liteshort/wsgi.py b/src/liteshort/wsgi.py similarity index 100% rename from liteshort/wsgi.py rename to src/liteshort/wsgi.py