From 27b89d6d38403d0a51b52477ee8321ac1e4feae4 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Sun, 15 Oct 2023 11:00:29 +0300 Subject: [PATCH] Update packaging. --- .gitignore | 2 ++ README.md | 7 ++----- pyproject.toml | 38 ++++++++++++++++++++++++++++++++++++++ setup.py | 26 -------------------------- 4 files changed, 42 insertions(+), 31 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.gitignore b/.gitignore index f6120d8..831d0ea 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ !.gitignore __pycache__/ *.egg-info/ +/cista/_version.py +/dist diff --git a/README.md b/README.md index 68b51dc..7356e4b 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,10 @@ Development install: ```sh -python -m venv .venv # Create virtual env -. .venv/bin/activate -pip install -e . # Editable install -sanic cista --reload --dev # Runs on localhost:8000 +pip install hatch --break-system-packages +hatch run sanic cista --reload --dev # Runs on localhost:8000 ``` Environment variable `STORAGE=` may be used to choose which folder it serves. The default is current directory. No authentication is supported, so implement access control externally or be careful with your files. - diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..4f843fe --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,38 @@ +[build-system] +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" + +[project] +name = "cista" +dynamic = ["version"] +description = "Dropbox-like file server with modern web interface" +readme = "README.md" +license = "" +authors = [ + { name = "Vasanko lda" }, +] +classifiers = [ +] +dependencies = [ + "msgspec", + "pathvalidate", + "sanic", + "watchdog", +] + +[project.urls] +Homepage = "" + +[tool.hatch] +version.source = "vcs" + +[tool.hatch.build] +hooks.vcs.version-file = "cista/_version.py" +hooks.vcs.template = """ +# This file is automatically generated by hatch build. +version = {version!r} +version_tuple = {version_tuple!r} +""" +targets.sdist.include = [ + "/cista", +] diff --git a/setup.py b/setup.py deleted file mode 100644 index 01a2513..0000000 --- a/setup.py +++ /dev/null @@ -1,26 +0,0 @@ -# Install package -import setuptools -import pathlib - -doc = pathlib.Path(__file__).parent.joinpath('README.md').read_text(encoding="UTF-8") - -setuptools.setup( - name="cista", - version="0.0.1", - author="Vasanko lda", - description="Dropbox-like file server with modern web interface", - long_description=doc, - long_description_content_type="text/markdown", - url="", - packages=setuptools.find_packages(), - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: Apache Software License", - ], - install_requires=[ - "sanic", - "msgspec", - "watchdog", - "pathvalidate", - ], -)