From 80b011f3e08de4f4bb6eb2b7b05cbf1a9da0d7b7 Mon Sep 17 00:00:00 2001 From: Earle Lowe <30607889+emlowe@users.noreply.github.com> Date: Wed, 6 Mar 2024 12:22:57 -0800 Subject: [PATCH] Add python 3.12 (#110) * Add python 3.12 --------- Co-authored-by: Kyle Altendorf --- .github/workflows/main.yml | 7 +++---- clvm_tools/__init__.py | 6 +++--- setup.py | 16 +++++++++++++--- tests/cmds_test.py | 7 +++---- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7def44f4..c23f70e0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,7 @@ jobs: fail-fast: false matrix: os: [macos-latest, ubuntu-latest, windows-latest] - python-version: [ '3.8', '3.9', '3.10', '3.11' ] + python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ] name: Python ${{ matrix.os }} ${{ matrix.python-version }} sample steps: - uses: actions/checkout@v3 @@ -31,8 +31,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - python -m pip install . + python -m pip install .[dev] - name: Test with pytest run: | - python -m pip install pytest - py.test tests + pytest tests diff --git a/clvm_tools/__init__.py b/clvm_tools/__init__.py index 9e64dabc..fb15fb85 100644 --- a/clvm_tools/__init__.py +++ b/clvm_tools/__init__.py @@ -1,7 +1,7 @@ -from pkg_resources import get_distribution, DistributionNotFound +import importlib_metadata try: - __version__ = get_distribution(__name__).version -except DistributionNotFound: + __version__ = importlib_metadata.version(__name__) +except importlib_metadata.PackageNotFoundError: # package is not installed __version__ = "unknown" diff --git a/setup.py b/setup.py index 5f1bed06..ea59954a 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,9 @@ dependencies = [ "clvm>=0.9.2", - "clvm_tools_rs>=0.1.37" + "clvm_tools_rs>=0.1.37", + "importlib_metadata", + "setuptools", ] dev_dependencies = [ @@ -16,7 +18,13 @@ setup( name="clvm_tools", - packages=["ir", "clvm_tools", "clvm_tools.setuptools", "stages", "stages.stage_2",], + packages=[ + "ir", + "clvm_tools", + "clvm_tools.setuptools", + "stages", + "stages.stage_2", + ], author="Chia Network, Inc.", entry_points={ "console_scripts": [ @@ -45,7 +53,9 @@ "License :: OSI Approved :: Apache Software License", "Topic :: Security :: Cryptography", ], - extras_require=dict(dev=dev_dependencies,), + extras_require=dict( + dev=dev_dependencies, + ), project_urls={ "Bug Reports": "https://github.com/Chia-Network/clvm_tools", "Source": "https://github.com/Chia-Network/clvm_tools", diff --git a/tests/cmds_test.py b/tests/cmds_test.py index c8803c6f..d4c485e1 100644 --- a/tests/cmds_test.py +++ b/tests/cmds_test.py @@ -1,10 +1,10 @@ import io import os -import pkg_resources import shlex import sys import unittest +import importlib_metadata # If the REPAIR environment variable is set, any tests failing due to # wrong output will be corrected. Be sure to do a "git diff" to validate that @@ -57,9 +57,8 @@ def invoke_tool(self, cmd_line): sys.stderr = stderr_buffer args = shlex.split(cmd_line) - v = pkg_resources.load_entry_point("clvm_tools", "console_scripts", args[0])( - args - ) + [entry_point] = importlib_metadata.entry_points(group="console_scripts", name=args[0]) + v = entry_point.load()(args) sys.stdout = old_stdout sys.stderr = old_stderr