From 8cdef730313841c2aca54750b3856d034ea6b3fc Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Mon, 19 Dec 2022 15:12:47 -0700 Subject: [PATCH 01/10] chore: Make version static in pyproject.toml --- .github/workflows/lint.yml | 2 +- CONTRIBUTING.md | 12 ++++++++++++ pyproject.toml | 2 +- setup.py | 14 +------------- table2ascii/__init__.py | 3 ++- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 861e42d..01ee7f7 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -94,7 +94,7 @@ jobs: setup.py - name: Install dependencies - run: python -m pip install -e ".[dev]" -e ".[docs]" + run: python -m pip install -e ".[dev,docs]" - name: Run mypy run: mypy . diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 91b025b..d99b2e0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,6 +24,18 @@ Install documentation dependencies with: pip install -e ".[docs]" ``` +Install runtime dependencies with: + +```bash +pip install -e . +``` + +All dependencies can be installed at once with: + +```bash +pip install -e ".[dev,docs]" +``` + ### Running the Tests Run the following command to run the [Tox](https://github.com/tox-dev/tox) test script which will verify that the tested functionality is still working. diff --git a/pyproject.toml b/pyproject.toml index 9db538c..0cca950 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" [project] name = "table2ascii" authors = [{name = "Jonah Lawrence", email = "jonah@freshidea.com"}] -dynamic = ["version"] +version = "1.0.5" description = "Convert 2D Python lists into Unicode/ASCII tables" readme = "README.md" requires-python = ">=3.7" diff --git a/setup.py b/setup.py index 5fbf35d..d32b777 100644 --- a/setup.py +++ b/setup.py @@ -1,16 +1,4 @@ # /usr/bin/env python -import re - from setuptools import setup - -def version(): - version = "" - with open("table2ascii/__init__.py") as f: - version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', f.read(), re.MULTILINE) - if not version: - raise RuntimeError("version is not set") - return version.group(1) - - -setup(name="table2ascii", version=version()) +setup() diff --git a/table2ascii/__init__.py b/table2ascii/__init__.py index 19fa31a..c65b286 100644 --- a/table2ascii/__init__.py +++ b/table2ascii/__init__.py @@ -1,6 +1,7 @@ """ table2ascii - Library for converting 2D Python lists to fancy ASCII/Unicode tables """ +import importlib.metadata from .alignment import Alignment from .merge import Merge @@ -8,7 +9,7 @@ from .table_style import TableStyle from .table_to_ascii import table2ascii -__version__ = "1.0.4" +__version__ = importlib.metadata.version(__name__) __all__ = [ "Alignment", From 4359116d437365114660075308e6b2c2a3baacd2 Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Mon, 19 Dec 2022 15:17:32 -0700 Subject: [PATCH 02/10] Delete setup.py --- setup.py | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 setup.py diff --git a/setup.py b/setup.py deleted file mode 100644 index d32b777..0000000 --- a/setup.py +++ /dev/null @@ -1,4 +0,0 @@ -# /usr/bin/env python -from setuptools import setup - -setup() From 7bd22049fedb418213001396b3ff7c1658aad84b Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Mon, 19 Dec 2022 15:19:37 -0700 Subject: [PATCH 03/10] Update pyproject.toml --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 0cca950..713c51f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ classifiers = [ ] dependencies = [ "typing-extensions>=3.7.4; python_version<'3.8'", + "importlib-metadata>=4.0.1; python_version<'3.8'", "wcwidth<1", ] From 491a84b52048d356b924b2f2aea41aa9e7d86101 Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Mon, 19 Dec 2022 15:23:18 -0700 Subject: [PATCH 04/10] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 713c51f..becb1ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,7 +39,7 @@ classifiers = [ ] dependencies = [ "typing-extensions>=3.7.4; python_version<'3.8'", - "importlib-metadata>=4.0.1; python_version<'3.8'", + "importlib-metadata<5,>=1; python_version<'3.8'", "wcwidth<1", ] From 8e0bd1300951bb510352d8d6300bfedbc8a57bd5 Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Mon, 19 Dec 2022 15:27:48 -0700 Subject: [PATCH 05/10] Revert "Delete setup.py" This reverts commit 4359116d437365114660075308e6b2c2a3baacd2. --- setup.py | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 setup.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..d32b777 --- /dev/null +++ b/setup.py @@ -0,0 +1,4 @@ +# /usr/bin/env python +from setuptools import setup + +setup() From d96034aa39b71e2e3af4bf73500241fd075290d6 Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Wed, 28 Dec 2022 14:30:05 -0700 Subject: [PATCH 06/10] Python 3.7 fix --- table2ascii/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/table2ascii/__init__.py b/table2ascii/__init__.py index c65b286..4db5b8a 100644 --- a/table2ascii/__init__.py +++ b/table2ascii/__init__.py @@ -1,7 +1,7 @@ """ table2ascii - Library for converting 2D Python lists to fancy ASCII/Unicode tables """ -import importlib.metadata +import sys from .alignment import Alignment from .merge import Merge @@ -9,7 +9,12 @@ from .table_style import TableStyle from .table_to_ascii import table2ascii -__version__ = importlib.metadata.version(__name__) +if sys.version_info >= (3, 8): + from importlib import metadata +else: + import importlib_metadata as metadata + +__version__ = metadata.version(__name__) __all__ = [ "Alignment", From 4ac9da112b704cc50857c546ce5a67dd3804844a Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Wed, 28 Dec 2022 14:33:27 -0700 Subject: [PATCH 07/10] Use try catch for version --- table2ascii/__init__.py | 4 ++-- table2ascii/annotations.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/table2ascii/__init__.py b/table2ascii/__init__.py index 4db5b8a..501bac2 100644 --- a/table2ascii/__init__.py +++ b/table2ascii/__init__.py @@ -9,9 +9,9 @@ from .table_style import TableStyle from .table_to_ascii import table2ascii -if sys.version_info >= (3, 8): +try: from importlib import metadata -else: +except ImportError: # Python < 3.8 import importlib_metadata as metadata __version__ = metadata.version(__name__) diff --git a/table2ascii/annotations.py b/table2ascii/annotations.py index 241e787..0466f95 100644 --- a/table2ascii/annotations.py +++ b/table2ascii/annotations.py @@ -2,9 +2,9 @@ from abc import abstractmethod from typing import TYPE_CHECKING -if sys.version_info >= (3, 8): +try: from typing import Protocol, runtime_checkable -else: +except ImportError: # Python < 3.8 from typing_extensions import Protocol, runtime_checkable if TYPE_CHECKING: From 5d78b3d797246df0ac4cb70ecf24d2bb85d5de55 Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Wed, 28 Dec 2022 14:38:54 -0700 Subject: [PATCH 08/10] Support pyright type check --- table2ascii/__init__.py | 5 +++-- table2ascii/annotations.py | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/table2ascii/__init__.py b/table2ascii/__init__.py index 501bac2..a86dc02 100644 --- a/table2ascii/__init__.py +++ b/table2ascii/__init__.py @@ -2,6 +2,7 @@ table2ascii - Library for converting 2D Python lists to fancy ASCII/Unicode tables """ import sys +from typing import TYPE_CHECKING from .alignment import Alignment from .merge import Merge @@ -9,9 +10,9 @@ from .table_style import TableStyle from .table_to_ascii import table2ascii -try: +if TYPE_CHECKING or sys.version_info >= (3, 8): from importlib import metadata -except ImportError: # Python < 3.8 +else: import importlib_metadata as metadata __version__ = metadata.version(__name__) diff --git a/table2ascii/annotations.py b/table2ascii/annotations.py index 0466f95..60a4e3d 100644 --- a/table2ascii/annotations.py +++ b/table2ascii/annotations.py @@ -2,14 +2,11 @@ from abc import abstractmethod from typing import TYPE_CHECKING -try: +if TYPE_CHECKING or sys.version_info >= (3, 8): from typing import Protocol, runtime_checkable -except ImportError: # Python < 3.8 +else: from typing_extensions import Protocol, runtime_checkable -if TYPE_CHECKING: - from typing import Protocol - @runtime_checkable class SupportsStr(Protocol): From 05503878a21023f1db8e96483d05e32ffe8716f5 Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Wed, 28 Dec 2022 14:42:24 -0700 Subject: [PATCH 09/10] Bump version to 1.1.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index becb1ae..77d0c14 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" [project] name = "table2ascii" authors = [{name = "Jonah Lawrence", email = "jonah@freshidea.com"}] -version = "1.0.5" +version = "1.1.0" description = "Convert 2D Python lists into Unicode/ASCII tables" readme = "README.md" requires-python = ">=3.7" From b8d69e24cfc5345057c34d3c64fa4b43f1b20373 Mon Sep 17 00:00:00 2001 From: Jonah Lawrence Date: Wed, 28 Dec 2022 14:42:46 -0700 Subject: [PATCH 10/10] Update pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 77d0c14..7b8a95a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,8 +5,8 @@ build-backend = "setuptools.build_meta" [project] name = "table2ascii" -authors = [{name = "Jonah Lawrence", email = "jonah@freshidea.com"}] version = "1.1.0" +authors = [{name = "Jonah Lawrence", email = "jonah@freshidea.com"}] description = "Convert 2D Python lists into Unicode/ASCII tables" readme = "README.md" requires-python = ">=3.7" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy