Skip to content

Feat/add support for python 3.12+ #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/installation.yaml
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-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', '3.13']
method: ['install' ,'pip']

include:
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ jobs:
strategy:
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', '3.13']
include:
- os: macos-latest
shells: 'sh,csh,bash,tcsh,zsh,pwsh'
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -68,6 +68,7 @@ def find_files(pattern, path=None, root="rez"):
packages=find_packages('src', exclude=["build_utils",
"build_utils.*",
"tests"]),
install_requires=['setuptools'],
package_data={
'rez':
['utils/logging.conf'] +
2 changes: 1 addition & 1 deletion src/rez/cli/selftest.py
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ def __call__(self, parser, namespace, values, option_string=None):
prefix = "test_"
for importer, name, ispkg in iter_modules([tests_dir]):
if not ispkg and name.startswith(prefix):
module = importer.find_module(name).load_module(name)
module = importer.find_spec(name).loader.load_module(name)
name_ = name[len(prefix):]
all_module_tests.append(name_)
tests.append((name_, module))
4 changes: 2 additions & 2 deletions src/rez/plugin_managers.py
Original file line number Diff line number Diff line change
@@ -159,8 +159,8 @@ def load_plugins(self):
# already loaded, so check for that
plugin_module = sys.modules.get(modname)
if plugin_module is None:
loader = importer.find_module(modname)
plugin_module = loader.load_module(modname)
loader = importer.find_spec(modname)
plugin_module = loader.loader.load_module(modname)

elif os.path.dirname(plugin_module.__file__) != path:
if config.debug("plugins"):
62 changes: 23 additions & 39 deletions src/rez/vendor/README.md
Original file line number Diff line number Diff line change
@@ -39,57 +39,51 @@ Our version is patched.
<tr><td>
atomicwrites
</td><td>
1.2.1 (Aug 30, 2018)
1.4.1 (Jul 8, 2022)
</td><td>
MIT
</td><td>
https://github.com/untitaker/python-atomicwrites
</td></tr>

<!-- ######################################################### -->
<tr><td>
attrs
</td><td>
19.1.0 (Mar 3, 2019)
</td><td>
MIT
</td><td>
https://github.com/python-attrs/attrs<br>
Added (July 2019) to enable the use of packaging lib that depends on it.
https://github.com/untitaker/python-atomicwrites<br>
No changes.<br>
Updated (April 2025) to help address py3.12 update.
</td></tr>

<!-- ######################################################### -->
<tr><td>
colorama
</td><td>
0.4.1 (Nov 25, 2018)
0.4.6 (Oct 24, 2022)
</td><td>
BSD 3-Clause
</td><td>
https://github.com/tartley/colorama<br>
No changes.<br>
Updated (April 2025) to help address py3.12 update.
</td></tr>

<!-- ######################################################### -->
<tr><td>
distlib
</td><td>
0.2.9.post0 (May 14, 2019)
0.3.9 (Oct 29, 2024)
</td><td>
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
</td><td>
https://bitbucket.org/pypa/distlib/src/master/<br>
Updated (June 2019) to enable wheel distribution based installations.
Updated (April 2025) to help address py3.12 update.
</td></tr>

<!-- ######################################################### -->
<tr><td>
distro
</td><td>
1.5.0 (Mar 31, 2020)
1.9.0 (Dec 24, 2023)
</td><td>
Apache 2.0
</td><td>
https://github.com/python-distro/distro
https://github.com/python-distro/distro<br>
No changes.<br>
Updated (April 2025) to help address py3.12 update.
</td></tr>

<!-- ######################################################### -->
@@ -161,12 +155,13 @@ https://github.com/pika/pika
<tr><td>
progress
</td><td>
1.5 (Mar 6, 2019)
1.6 (July 28, 2021)
</td><td>
ISC
</td><td>
https://github.com/verigak/progress<br>
Upgraded from 1.2 to 1.5 as of Oct 16 2019
No changes.<br>
Updated (April 2025) to help address py3.12 update.
</td></tr>

<!-- ######################################################### -->
@@ -227,37 +222,26 @@ Our version is patched.
<tr><td>
six
</td><td>
1.12.0 (Dec 9, 2018)
1.17.0 (Dec 4, 2024)
</td><td>
MIT
</td><td>
https://github.com/benjaminp/six<br>
Updated (July 2019) to coincide with packaging lib addition that depends on.
Also now required to support py2/3 interoperability.
</td></tr>

<!-- ######################################################### -->
<tr><td>
yaml lib (PyYAML)
</td><td>
5.1 (May 30, 2011)
</td><td>
MIT
</td><td>
https://github.com/yaml/pyyaml<br>
No changes but must maintain separate version between py2 and py3 for time being.
Updated (April 2025) to help address py3.12 update.<br>
No longer needed in rez itself, but still used by other vendored modules.
</td></tr>

<!-- ######################################################### -->
<tr><td>
yaml lib3 (PyYAML)
yaml (PyYAML)
</td><td>
5.1 (May 30, 2011)
6.0.1 (July 17, 2023)
</td><td>
MIT
</td><td>
https://github.com/yaml/pyyaml<br>
No changes but must maintain separate version between py2 and py3 for time being.
No changes. Bounded to 6.0.1 by current py3.7.<br>
Updated (April 2025) to help address py3.12 update.
</td></tr>

</table>
29 changes: 26 additions & 3 deletions src/rez/vendor/atomicwrites/__init__.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,13 @@
except ImportError:
fcntl = None

__version__ = '1.2.1'
# `fspath` was added in Python 3.6
try:
from os import fspath
except ImportError:
fspath = None

__version__ = '1.4.1'


PY2 = sys.version_info[0] == 2
@@ -86,6 +92,7 @@ def replace_atomic(src, dst):
'''
Move ``src`` to ``dst``. If ``dst`` exists, it will be silently
overwritten.

Both paths must reside on the same filesystem for the operation to be
atomic.
'''
@@ -97,6 +104,7 @@ def move_atomic(src, dst):
Move ``src`` to ``dst``. There might a timewindow where both filesystem
entries exist. If ``dst`` already exists, :py:exc:`FileExistsError` will be
raised.

Both paths must reside on the same filesystem for the operation to be
atomic.
'''
@@ -106,14 +114,20 @@ def move_atomic(src, dst):
class AtomicWriter(object):
'''
A helper class for performing atomic writes. Usage::

with AtomicWriter(path).open() as f:
f.write(...)

:param path: The destination filepath. May or may not exist.
:param mode: The filemode for the temporary file. This defaults to `wb` in
Python 2 and `w` in Python 3.
:param overwrite: If set to false, an error is raised if ``path`` exists.
Errors are only raised after the file has been written to. Either way,
the operation is atomic.
:param open_kwargs: Keyword-arguments to pass to the underlying
:py:func:`open` call. This can be used to set the encoding when opening
files in text-mode.

If you need further control over the exact behavior, you are encouraged to
subclass.
'''
@@ -132,6 +146,10 @@ def __init__(self, path, mode=DEFAULT_MODE, overwrite=False,
if 'w' not in mode:
raise ValueError('AtomicWriters can only be written to.')

# Attempt to convert `path` to `str` or `bytes`
if fspath is not None:
path = fspath(path)

self._path = path
self._mode = mode
self._overwrite = overwrite
@@ -160,11 +178,13 @@ def _open(self, get_fileobject):
except Exception:
pass

def get_fileobject(self, dir=None, **kwargs):
def get_fileobject(self, suffix="", prefix=tempfile.gettempprefix(),
dir=None, **kwargs):
'''Return the temporary file to use.'''
if dir is None:
dir = os.path.normpath(os.path.dirname(self._path))
descriptor, name = tempfile.mkstemp(dir=dir)
descriptor, name = tempfile.mkstemp(suffix=suffix, prefix=prefix,
dir=dir)
# io.open() will take either the descriptor or the name, but we need
# the name later for commit()/replace_atomic() and couldn't find a way
# to get the filename from the descriptor.
@@ -194,12 +214,15 @@ def rollback(self, f):
def atomic_write(path, writer_cls=AtomicWriter, **cls_kwargs):
'''
Simple atomic writes. This wraps :py:class:`AtomicWriter`::

with atomic_write(path) as f:
f.write(...)

:param path: The target path to write to.
:param writer_cls: The writer class to use. This parameter is useful if you
subclassed :py:class:`AtomicWriter` to change some behavior and want to
use that new subclass.

Additional keyword arguments are passed to the writer class. See
:py:class:`AtomicWriter`.
'''
22 changes: 0 additions & 22 deletions src/rez/vendor/attr/LICENSE

This file was deleted.

65 changes: 0 additions & 65 deletions src/rez/vendor/attr/__init__.py

This file was deleted.

Loading