From 37f8b5443b971a63198df3bd88b59d891f0a1387 Mon Sep 17 00:00:00 2001 From: Dominic Ricottone Date: Tue, 13 Sep 2022 16:02:13 -0500 Subject: [PATCH] Toolchain updates Upgrading from legacy setuptools system (setup.cfg, setup.py) to pyproject.toml. Also reworked the Makefile significantly. --- Makefile | 46 ++++++++++++++++++++++++++++++++++++++-------- README.md | 7 ++----- pyproject.toml | 20 ++++++++++++++++++++ setup.py | 24 ------------------------ 4 files changed, 60 insertions(+), 37 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/Makefile b/Makefile index 6bc3e7f..691b541 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,50 @@ -python = python3 +VERSION=1.0.1 +PY_COMPILE_BIN=python -m py_compile + +#BUILD_BIN=python -m build +BUILD_BIN=pyproject-build + +#UNITTEST_FILE_BIN=python -m unittest +#UNITTEST_DIR_BIN=python -m unittest discover --top-level-directory . +UNITTEST_FILE_BIN=unittest --color +UNITTEST_DIR_BIN=unittest --color --working-directory . + +#MYPY_BIN=python -m mypy +MYPY_BIN=MYPY_CACHE_DIR=gap/__mypycache__ mypy + +#PIPX_BIN=python -m pipx +PIPX_BIN=pipx + +.PHONY: clean clean: - rm -rf **/__pycache__ **/__mypycache__ **/*.pyc build dist neopaste.egg-info + rm -rf **/__pycache__ **/__mypycache__ **/*.pyc build *.egg-info +neopaste/cli.py: neopaste/cli.toml + gap neopaste/cli.toml -o neopaste/cli.py + +.PHONY: test test: - $(python) -m py_compile neopaste/*.py + $(PY_COMPILE_BIN) gap/*.py -build: - gap neopaste/cli.toml -o neopaste/cli.py - $(python) setup.py sdist bdist_wheel +PY_FILES=neopaste/cli.py neopaste/__main__.py neopaste/columnar.py neopaste/internals.py +PYBUILD_FILES=pyproject.toml LICENSE.md README.md + +build/neopaste-$(VERSION)-py3-none-any.whl: $(PY_FILES) $(PYBUILD_FILES) + mkdir -p build + $(BUILD_BIN) --wheel --no-isolation --outdir build/ + +.PHONY: build +build: build/neopaste-$(VERSION)-py3-none-any.whl +.PHONY: reinstall reinstall: uninstall install -install: - pipx install . +.PHONY: install +install: build/neopaste-$(VERSION)-py3-none-any.whl + $(PIPX_BIN) install build/neopaste-$(VERSION)-py3-none-any.whl +.PHONY: uninstall uninstall: pipx uninstall neopaste diff --git a/README.md b/README.md index d394f98..ab9f106 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ Paste file streams side-by-side, without concern for Unicode wide characters or ANSI color codes. + ### Usage ``` @@ -41,8 +42,6 @@ Filesystem Size Used Avail Use% Mounted on June 2020 Weather 28 29 30 ʻ ʻ ʻ ʻ 0.0 in/h ``` ----- - ## Dependencies @@ -52,9 +51,7 @@ manage runtime dependencies for you. The only runtime dependency is **wcwidth**, available from PyPI through pip. Testing and build dependencies are **setuptools** and -[gap](https://git.dominic-ricottone.com/gap). - ----- +[gap](https://git.dominic-ricottone.com/~dricottone/gap). ## Licensing diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1546a2a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,20 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[project] +name = "neopaste" +description = "Paste file streams side-by-side" +readme = "README.md" +version = "1.0.1" +authors = [ { name = "Dominic Ricottone", email = "me@dominic-ricottone.com" } ] +urls = { source = "git.dominic-ricottone.com/~dricottone/neopaste" } +license = { file = "LICENSE.md" } +requires-python = ">=3.6" +dependencies = [ + "wcwidth >= 0.2.4", +] + +[project.scripts] +npaste = "neopaste.__main__:main" + diff --git a/setup.py b/setup.py deleted file mode 100644 index 1c3283f..0000000 --- a/setup.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python3 - -from setuptools import setup - -long_description = None -with open('README.md', encoding='utf-8') as f: - long_description = f.read() - -setup( - name="neopaste", - packages=["neopaste"], - version="1.0.0", - license="GPL", - description="Paste file streams side-by-side", - long_description=long_description, - long_description_content_type='text/markdown', - author="Dominic Ricottone", - author_email="me@dominic-ricottone.com", - url="git.dominic-ricottone.com/neopaste", - entry_points={"console_scripts": ["npaste = neopaste.__main__:main"]}, - install_requires=["wcwidth>=0.2.4"], - python_requires=">=3.6", -) - -- 2.45.2