diff --git a/.github/workflows/python-packages.yml b/.github/workflows/python-packages.yml index 5a6935d..4ce21ac 100644 --- a/.github/workflows/python-packages.yml +++ b/.github/workflows/python-packages.yml @@ -17,7 +17,7 @@ jobs: fail-fast: false matrix: os: [macos-latest, ubuntu-latest, windows-latest] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] exclude: - os: macos-latest python-version: "3.7" diff --git a/_pygim_build/build_backend.py b/_pygim_build/build_backend.py index 26263a8..2f6fccc 100644 --- a/_pygim_build/build_backend.py +++ b/_pygim_build/build_backend.py @@ -13,8 +13,7 @@ def post_initialize(context): md = dict(context.config.metadata) md['dependencies'] = [urllib.parse.unquote(dep) for dep in md['dependencies']] - logger.debug(f"Metadata: {pformat(md)}") - context.config.metadata = context.config.metadata.__class__(md) + context.config.__dict__["metadata"] = context.config.metadata.__class__(md) context.config.data['project']['dependencies'] = [ urllib.parse.unquote(dep) for dep in context.config.data['project']['dependencies']] diff --git a/pygim-common/_pygim/_magic/_patch.py b/pygim-common/_pygim/_magic/_patch.py index cbe179d..0cf9e53 100644 --- a/pygim-common/_pygim/_magic/_patch.py +++ b/pygim-common/_pygim/_magic/_patch.py @@ -15,51 +15,54 @@ from .._utils import has_instances, format_dict, TraitFunctions, is_subset from .._error_msgs import type_error_msg -PY37, PY38, PY39, PY310, PY311 = (3, 7), (3, 8), (3, 9), (3, 10), (3, 11) +# NOTE: CodeObject documentation: https://docs.python.org/3/c-api/code.html#c.PyCodeObject + +PY37, PY38, PY39, PY310, PY311, PY312 = (3, 7), (3, 8), (3, 9), (3, 10), (3, 11), (3, 12) ____ = _____ = () + _PY_CODE_ARGS = dict( - argcount = (PY37, PY38, PY39, PY310, PY311), - posonlyargcount = (____, PY38, PY39, PY310, PY311), - kwonlyargcount = (PY37, PY38, PY39, PY310, PY311), - nlocals = (PY37, PY38, PY39, PY310, PY311), - stacksize = (PY37, PY38, PY39, PY310, PY311), - flags = (PY37, PY38, PY39, PY310, PY311), - codestring = (PY37, PY38, PY39, PY310, PY311), - constants = (PY37, PY38, PY39, PY310, PY311), - names = (PY37, PY38, PY39, PY310, PY311), - varnames = (PY37, PY38, PY39, PY310, PY311), - filename = (PY37, PY38, PY39, PY310, PY311), - name = (PY37, PY38, PY39, PY310, PY311), - qualname = (____, ____, ____, _____, PY311), - firstlineno = (PY37, PY38, PY39, PY310, PY311), - lnotab = (PY37, PY38, PY39, _____, _____), - linetable = (____, ____, ____, PY310, PY311), - exceptiontable = (____, ____, ____, _____, PY311), - freevars = (PY37, PY38, PY39, PY310, PY311), - cellvars = (PY37, PY38, PY39, PY310, PY311), + argcount = (PY37, PY38, PY39, PY310, PY311, PY312), + posonlyargcount = (____, PY38, PY39, PY310, PY311, PY312), + kwonlyargcount = (PY37, PY38, PY39, PY310, PY311, PY312), + nlocals = (PY37, PY38, PY39, PY310, PY311, PY312), + stacksize = (PY37, PY38, PY39, PY310, PY311, PY312), + flags = (PY37, PY38, PY39, PY310, PY311, PY312), + codestring = (PY37, PY38, PY39, PY310, PY311, PY312), + constants = (PY37, PY38, PY39, PY310, PY311, PY312), + names = (PY37, PY38, PY39, PY310, PY311, PY312), + varnames = (PY37, PY38, PY39, PY310, PY311, PY312), + filename = (PY37, PY38, PY39, PY310, PY311, PY312), + name = (PY37, PY38, PY39, PY310, PY311, PY312), + qualname = (____, ____, ____, _____, PY311, PY312), + firstlineno = (PY37, PY38, PY39, PY310, PY311, PY312), + lnotab = (PY37, PY38, PY39, _____, _____, _____), + linetable = (____, ____, ____, PY310, PY311, PY312), + exceptiontable = (____, ____, ____, _____, PY311, PY312), + freevars = (PY37, PY38, PY39, PY310, PY311, PY312), + cellvars = (PY37, PY38, PY39, PY310, PY311, PY312), ) _CODE_OBJECT_VARS = dict( - co_argcount = (PY37, PY38, PY39, PY310, PY311), - co_cellvars = (PY37, PY38, PY39, PY310, PY311), - co_code = (PY37, PY38, PY39, PY310, PY311), - co_consts = (PY37, PY38, PY39, PY310, PY311), - co_exceptiontable = (____, ____, ____, _____, PY311), - co_filename = (PY37, PY38, PY39, PY310, PY311), - co_firstlineno = (PY37, PY38, PY39, PY310, PY311), - co_flags = (PY37, PY38, PY39, PY310, PY311), - co_freevars = (PY37, PY38, PY39, PY310, PY311), - co_kwonlyargcount = (PY37, PY38, PY39, PY310, PY311), - co_linetable = (____, ____, ____, PY310, PY311), - co_lnotab = (PY37, PY38, PY39, PY310, PY311), - co_name = (PY37, PY38, PY39, PY310, PY311), - co_names = (PY37, PY38, PY39, PY310, PY311), - co_nlocals = (PY37, PY38, PY39, PY310, PY311), - co_posonlyargcount = (____, PY38, PY39, PY310, PY311), - co_qualname = (____, ____, ____, _____, PY311), - co_stacksize = (PY37, PY38, PY39, PY310, PY311), - co_varnames = (PY37, PY38, PY39, PY310, PY311), + co_argcount = (PY37, PY38, PY39, PY310, PY311, PY312), + co_cellvars = (PY37, PY38, PY39, PY310, PY311, PY312), + co_code = (PY37, PY38, PY39, PY310, PY311, PY312), + co_consts = (PY37, PY38, PY39, PY310, PY311, PY312), + co_exceptiontable = (____, ____, ____, _____, PY311, PY312), + co_filename = (PY37, PY38, PY39, PY310, PY311, PY312), + co_firstlineno = (PY37, PY38, PY39, PY310, PY311, PY312), + co_flags = (PY37, PY38, PY39, PY310, PY311, PY312), + co_freevars = (PY37, PY38, PY39, PY310, PY311, PY312), + co_kwonlyargcount = (PY37, PY38, PY39, PY310, PY311, PY312), + co_linetable = (____, ____, ____, PY310, PY311, PY312), + co_lnotab = (PY37, PY38, PY39, PY310, PY311, _____), + co_name = (PY37, PY38, PY39, PY310, PY311, PY312), + co_names = (PY37, PY38, PY39, PY310, PY311, PY312), + co_nlocals = (PY37, PY38, PY39, PY310, PY311, PY312), + co_posonlyargcount = (____, PY38, PY39, PY310, PY311, PY312), + co_qualname = (____, ____, ____, _____, PY311, PY312), + co_stacksize = (PY37, PY38, PY39, PY310, PY311, PY312), + co_varnames = (PY37, PY38, PY39, PY310, PY311, PY312), ) _ARGS_TO_VARS = dict( diff --git a/pygim-common/pyproject.toml b/pygim-common/pyproject.toml index c210708..2f94284 100644 --- a/pygim-common/pyproject.toml +++ b/pygim-common/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools ~= 58.0", "wheel", "pdm-backend", "pybind11", "toml", "psutil"] +requires = ["setuptools ~= 70.0", "wheel", "pdm-backend", "pybind11", "toml", "psutil"] [project] name = "pygim-common" @@ -22,6 +22,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Quality Assurance", "Typing :: Typed", diff --git a/pygim-common/setup.py b/pygim-common/setup.py index 027f1e0..73429ae 100644 --- a/pygim-common/setup.py +++ b/pygim-common/setup.py @@ -19,10 +19,13 @@ # This is a bit hacky way to resolve passing arguments to setup.py. # Invoked by: # $ python -m build -w --config-setting python_only +CPP_FILES = sorted(Path(ROOT).rglob("*.cpp")) +[f.touch() for f in CPP_FILES] +CPP_FILE_DEPS = list(str(p.relative_to(ROOT)) for p in CPP_FILES) if not psutil.Process().parent().cmdline()[-1] == "python_only": ext_modules = [ Pybind11Extension("_pygim.common_fast", - list(str(p) for p in Path(ROOT).rglob("*.cpp")), + CPP_FILE_DEPS, # Example: passing in the version to the compiled code define_macros = [('VERSION_INFO', __version__)], extra_compile_args=["--std=c++17", "-O3"], @@ -30,9 +33,13 @@ ), ] +import pprint + pygim = map(lambda v: ('pygim.' + v), find_namespace_packages('pygim')) pygim_internal = map(lambda v: ('_pygim.' + v), find_namespace_packages('_pygim')) +#print("pygim", list(pygim)) +#print("pygim_internal", list(pygim_internal)) cfg = {**pyproject["project"]} cfg['packages']= list(pygim) + list(pygim_internal) + ['pygim', '_pygim'] @@ -43,6 +50,5 @@ cfg['cmdclass']={"build_ext": build_ext} cfg['install_requires']=cfg.pop('dependencies') -#import pprint -#pprint.pprint(cfg) +pprint.pprint(cfg) setup(**cfg) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 1beb1af..9c8c9d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ name = "python-gimmicks" version = "0.2.3" description = "Full Python Gimmicks project with all of its sub-projects." readme = "README.rst" -requires-python = ">=3.7, <3.12" +requires-python = ">=3.7, <3.13" authors = [ {email = "debith-dev@outlook.com"}, {name = "Teppo Perä"} @@ -24,6 +24,7 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Quality Assurance", "Typing :: Typed",