From bf44d42c110c86e88d84348332b4f6b0f40ce5f2 Mon Sep 17 00:00:00 2001 From: Dominic Ricottone Date: Tue, 13 Sep 2022 16:33:45 -0500 Subject: [PATCH] Toolchain updates Upgrading from old-style setup.py system to pyproject.toml. Also reworked the Makefile significantly. --- Makefile | 53 +++++++++++++++++++++++++++++++++--------------- README.md | 12 +---------- pyproject.toml | 21 +++++++++++++++++++ requirements.txt | 2 -- setup.py | 23 --------------------- 5 files changed, 59 insertions(+), 52 deletions(-) create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 setup.py diff --git a/Makefile b/Makefile index 1d420cc..fe88d15 100644 --- a/Makefile +++ b/Makefile @@ -1,32 +1,53 @@ +VERSION=1.0.2 -unittest = unittest --color -#unittest = python -m unittest -unittest_discover = unittest --color --working-directory . -#unittest_discover = python -m unittest discover tests --top-level-directory . --start-directory -python = python3 +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 filters.egg-info + rm -rf **/__pycache__ **/__mypycache__ **/*.pyc build *.egg-info +.PHONY: test test: - $(python) -m py_compile filter/*.py rng/*.py - #$(unittest_discover) tests + $(PY_COMPILE_BIN) filter/*.py rng/*.py -build: +filter/cli.py: filter/cli.toml gap filter/cli.toml --no-debug-mode --output=filter/cli.py + +rng/cli.py: rng/cli.toml gap rng/cli.toml --no-debug-mode --output=rng/cli.py - $(python) setup.py sdist bdist_wheel -unittest: - $(unittest_discover) tests --verbose - $(unittest) tests/generated_syntax_tests.py --verbose +PY_FILES=rng/__main__.py rng/cli.py rng/internals.py rng/normal.py rng/notrandom.py rng/uniform.py filter/__main__.py filter/ab.py filter/cli.py filter/convolve.py filter/internals.py filter/kalman.py +PYBUILD_FILES=pyproject.toml README.md LICENSE.md + +build/filters-$(VERSION)-py3-none-any.whl: $(PY_FILES) $(PYBUILD_FILES) + mkdir -p build + $(BUILD_BIN) --wheel --no-isolation --outdir build/ +.PHONY: build +build: build/filters-$(VERSION)-py3-none-any.whl + +.PHONY: reinstall reinstall: uninstall install -install: - pipx install . +.PHONY: install +install: build/filters-$(VERSION)-py3-none-any.whl + pipx install build/filters-$(VERSION)-py3-none-any.whl +.PHONY: uninstall uninstall: pipx uninstall filters - diff --git a/README.md b/README.md index fd0c498..012bb33 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # filters -## Commands - -### filter +## Usage ``` filter METHOD [OPTIONS] @@ -12,10 +10,6 @@ Command line data filtering. Available `METHOD`s are: `ab`, `kalman`, and `convolve`. Use `filter METHOD --help` to see available options. - - -### rng - ``` rng DISTRIBUTION [OPTIONS] ``` @@ -25,8 +19,6 @@ Command line data generation. Available `DISTRIBUTION`s are: `normal`, `uniform`, and `notrandom`. Use `rng DISTRIBUTION --help` to see available options. ----- - ## Example ```sh @@ -50,8 +42,6 @@ Raw: Est.: ``` ----- - ## Licensing This software is distributed under the GPL license. diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..cf652fc --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,21 @@ +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +packages = ["filter", "rng"] + +[project] +name = "filters" +description = "Command line data filtering and generation" +readme = "README.md" +version = "1.0.2" +authors = [ { name = "Dominic Ricottone", email = "me@dominic-ricottone.com" } ] +urls = { source = "git.dominic-ricottone.com/~dricottone/filters" } +license = { file = "LICENSE.md" } +requires-python = ">=3.6" + +[project.scripts] +filter = "filter.__main__:main" +rng = "rng.__main__:main" + diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index c83104e..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -setuptools>=47.1.1 - diff --git a/setup.py b/setup.py deleted file mode 100644 index 143f702..0000000 --- a/setup.py +++ /dev/null @@ -1,23 +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="filters", - packages=["filter", "rng"], - version="1.0.1", - license="GPL", - description="Data filters", - long_description=long_description, - long_description_content_type='text/markdown', - author="Dominic Ricottone", - author_email="me@dominic-ricottone.com", - url="git.dominic-ricottone.com/filters", - entry_points={"console_scripts": ["filter = filter.__main__:main", "rng = rng.__main__:main"]}, - python_requires=">=3.6", -) - -- 2.45.2