aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-09-18 18:04:51 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-09-18 18:07:15 +0200
commit560d5191c8df27e35be57e889cccbde1a7a9635c (patch)
tree6a7bcdafd63f37097cf21372ba99d8cfe090262a
parentUpdate readme. (diff)
downloadrainbow-parenthesis-560d5191c8df27e35be57e889cccbde1a7a9635c.tar.gz
rainbow-parenthesis-560d5191c8df27e35be57e889cccbde1a7a9635c.tar.xz
Work on making program ready for packaging.v0.2
-rw-r--r--Makefile35
-rw-r--r--pyproject.toml23
-rw-r--r--rainbow_parenthesis/__init__.py2
3 files changed, 36 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index ded6dda..b665b00 100644
--- a/Makefile
+++ b/Makefile
@@ -1,36 +1,26 @@
-.PHONY: check build wheel install clean sphinx-apidoc documentation
+.PHONY: check check-style check-type \
+ build wheel install clean sphinx-apidoc documentation
PYTHON = python
-BUILDER = $(PYTHON) -m build
-INSTALLER = $(PYTHON) -m installer
-VERSION = $(shell $(PYTHON) -c 'print(__import__("toml").load(open("pyproject.toml"))["project"]["version"])')
-WHEEL = dist/rainbow_parenthesis-$(VERSION)-py3-none-any.whl
DOC_OUTPUT = doc.rendered
DESTDIR = /
PREFIX = /usr
-INSTALL_FLAGS = --destdir=$(DESTDIR) \
- --prefix=$(PREFIX)
-
-build: $(WHEEL)
-
-$(WHEEL): pyproject.toml $(shell find rainbow_parenthesis -type f -name '*.py')
- $(BUILDER) --no-isolation --wheel
+build: pyproject.toml $(shell find rainbow_parenthesis -type f -name '*.py')
+ $(PYTHON) -m build --no-isolation --wheel
install: build
- @echo "WHEEL=$(WHEEL)"
- $(INSTALLER) $(INSTALL_FLAGS) $(WHEEL)
-
-clean:
- -rm -r build
- -rm -r dist
- -rm -r rainbow_parenthesis.egg-info/
+ $(PYTHON) -m installer --destdir=$(DESTDIR) --prefix=$(PREFIX) dist/*.whl
-check:
+check-style:
flake8 rainbow_parenthesis
+
+check-type:
mypy -p rainbow_parenthesis
+check: check-style check-type
+
# Generate some rst files from our source code
sphinx-apidoc:
sphinx-apidoc --separate --force -o doc rainbow_parenthesis
@@ -40,3 +30,8 @@ $(DOC_OUTPUT)/index.html: sphinx-apidoc
sphinx-build -b dirhtml doc $(DOC_OUTPUT)
documentation: sphinx-apidoc
+
+clean:
+ -rm -r build
+ -rm -r dist
+ -rm -r rainbow_parenthesis.egg-info/
diff --git a/pyproject.toml b/pyproject.toml
index c95cc69..6e701ae 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,5 @@
[project]
name = "rainbow-parenthesis"
-version = "0.1"
description = "Add rainbow parenthesis to strings."
# Might work with lower, possibly test this.
requires-python = ">=3.10"
@@ -8,14 +7,16 @@ license = { file = "LICENSE" }
authors = [
{ name = "Hugo Hörnquist", email = "hugo@lysator.liu.se" },
]
+keywords = []
classifiers = [
"Programming Language :: Python :: 3",
"Development Status :: 4 - Beta",
"Environment :: Console",
-# "License :: OSI Approved :: GNU General Public License v3 or latel (GPLv3+)",
+ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
"Intended Audience :: Developers",
"Typing :: Typed",
]
+dynamic = ["version"]
[project.urls]
homepage = "https://git.hornquist.se/rainbow-parenthesis"
@@ -24,11 +25,25 @@ repository = "https://git.hornquist.se/rainbow-parenthesis"
[project.scripts]
rainbow = "rainbow_parenthesis.__main__:main"
+[project.optional-dependencies]
+doc = [
+ 'sphinx'
+]
+check = [
+ "mypy",
+ "flake8",
+]
[build-system]
-requires = ["setuptools"]
+requires = [
+ "setuptools",
+ "wheel",
+]
build-backend = "setuptools.build_meta"
# requires = ["setuptools>=40.6.0"]
[tool.setuptools]
-packages = ["rainbow_parenthesis"]
+packages = ["rainbow_parenthesis"]
+
+[tool.setuptools.dynamic]
+version = {attr = "rainbow_parenthesis.__version__"}
diff --git a/rainbow_parenthesis/__init__.py b/rainbow_parenthesis/__init__.py
index 4be7d80..32b7493 100644
--- a/rainbow_parenthesis/__init__.py
+++ b/rainbow_parenthesis/__init__.py
@@ -9,6 +9,8 @@ import io
from typing import Literal, Generator
from dataclasses import dataclass
+__version__ = "0.2"
+
@dataclass
class Stackpointer():