From 1e3514900d8b95875b176f8d448d0ca93b2637f6 Mon Sep 17 00:00:00 2001 From: SporeStack Date: Fri, 22 Apr 2022 01:10:34 +0000 Subject: [PATCH] 6.0.2: Switch from setuptools to flit --- .woodpecker.yml | 6 ++--- Makefile | 7 ++++-- pyproject.toml | 27 ++++++++++++++++++-- setup.cfg | 50 -------------------------------------- src/sporestack/__init__.py | 4 +++ src/sporestack/cli.py | 10 +++----- src/sporestack/version.py | 10 -------- 7 files changed, 40 insertions(+), 74 deletions(-) delete mode 100644 setup.cfg delete mode 100644 src/sporestack/version.py diff --git a/.woodpecker.yml b/.woodpecker.yml index 7539a33..876ceab 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -1,7 +1,7 @@ pipeline: python-3.7: group: test - image: python:3.7 + image: python:3.7-alpine commands: - pip install pipenv==2022.1.8 - pipenv install --dev --deploy @@ -20,7 +20,7 @@ pipeline: python-3.9: group: test - image: python:3.9 + image: python:3.9-alpine commands: - pip install pipenv==2022.1.8 pre-commit==2.17.0 - pre-commit run --all-files @@ -31,7 +31,7 @@ pipeline: python-3.10: group: test - image: python:3.10 + image: python:3.10-alpine commands: - pip install pipenv==2022.1.8 pre-commit==2.17.0 - pre-commit run --all-files diff --git a/Makefile b/Makefile index 935008c..69d3d00 100644 --- a/Makefile +++ b/Makefile @@ -9,8 +9,11 @@ test-pytest: build-dist: rm dist/* || true # This should result in a reproducible wheel. - SOURCE_DATE_EPOCH=1309379017 python -m build --no-isolation - python -m twine check --strict dist/* + SOURCE_DATE_EPOCH=$$(git log -1 --format=%ct) flit build + +# This shouldn't be needed often, but is nice for validation. +twine-check: + twine check --strict dist/* servedocs: pdoc sporestack diff --git a/pyproject.toml b/pyproject.toml index b71b328..44776d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,6 +25,29 @@ init_typed = true warn_required_dynamic_aliases = true warn_untyped_fields = true +[project] +name = "sporestack" +authors = [ {name = "SporeStack", email="support@sporestack.com"} ] +readme = "README.md" +requires-python = "~=3.7" +dynamic = ["version", "description"] +keywords = ["bitcoin", "monero", "vps"] +license = {file = "LICENSE.txt"} +dependencies = [ + "pydantic", + "requests[socks]>=2.22.0", + "segno", + "typer", +] + +[project.urls] +Homepage = "https://sporestack.com" +Source = "https://git.sporestack.com/SporeStack/sporestack-python" +Changelog = "https://git.sporestack.com/SporeStack/sporestack-python/src/branch/master/CHANGELOG.md" + +[project.scripts] +sporestack = "sporestack.cli:cli" + [build-system] -requires = ["setuptools", "wheel"] -build-backend = "setuptools.build_meta" +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 0f00680..0000000 --- a/setup.cfg +++ /dev/null @@ -1,50 +0,0 @@ -[metadata] -name = sporestack -version = 6.0.1 -description = SporeStack.com library and client. Launch servers with Monero or Bitcoin. -long_description = file: README.md -long_description_content_type = text/markdown -url = https://sporestack.com/ -author = SporeStack -author_email = admin@sporestack.com -license = Unlicense -license_file = LICENSE.txt -classifiers = - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 -keywords = - bitcoin - bitcoincash - bitcoinsv - monero - servers - infrastructure - vps - virtual private server - -[options] -packages = find: -install_requires = - pydantic - requests[socks]>=2.22.0 - segno - typer - importlib-metadata;python_version<"3.8" -python_requires = >=3.7 -package_dir = =src -zip_safe = False - -[options.packages.find] -where = src - -[options.entry_points] -console_scripts = - sporestack = sporestack.cli:cli - -[options.package_data] -sporestack = - py.typed diff --git a/src/sporestack/__init__.py b/src/sporestack/__init__.py index b54434c..18f46b2 100644 --- a/src/sporestack/__init__.py +++ b/src/sporestack/__init__.py @@ -1 +1,5 @@ +"""SporeStack API and CLI for launching servers with Bitcoin or Monero""" + __all__ = ["api", "api_client", "exceptions"] + +__version__ = "6.0.2" diff --git a/src/sporestack/cli.py b/src/sporestack/cli.py index a399dab..73feb12 100644 --- a/src/sporestack/cli.py +++ b/src/sporestack/cli.py @@ -12,14 +12,10 @@ from pathlib import Path from types import ModuleType from typing import TYPE_CHECKING, Any, Dict, Optional -if sys.version_info[:2] >= (3, 8): # pragma: nocover - from importlib.metadata import version as importlib_metadata_version -else: # pragma: nocover - # Python 3.7 doesn't have this. - from importlib_metadata import version as importlib_metadata_version - import typer +from . import __version__ + def lazy_import(name: str) -> ModuleType: """ @@ -604,7 +600,7 @@ def version() -> None: """ Returns the installed version. """ - typer.echo(importlib_metadata_version(__package__)) + typer.echo(__version__) @cli.command() diff --git a/src/sporestack/version.py b/src/sporestack/version.py deleted file mode 100644 index 108d161..0000000 --- a/src/sporestack/version.py +++ /dev/null @@ -1,10 +0,0 @@ -import sys - -if sys.version_info[:2] >= (3, 8): # pragma: nocover - from importlib.metadata import version as importlib_metadata_version -else: # pragma: nocover - # Python 3.7 doesn't have this. - from importlib_metadata import version as importlib_metadata_version - - -__version__ = importlib_metadata_version(__package__)