Skip to content
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

Py311 + Py312 support #79

Merged
merged 9 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
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/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest # todo, add more OS systems to see if they work as well
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10'] # '3.11'
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
- id: detect-private-key
- id: debug-statements
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
rev: 6.1.0
hooks:
- id: flake8
args:
Expand All @@ -40,7 +40,7 @@ repos:
- id: isort
args: ["--profile", "black"]
- repo: https://github.com/python/black
rev: 23.1.0
rev: 23.11.0
hooks:
- id: black
- repo: https://github.com/asottile/add-trailing-comma
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()

if(LINUX)
if(UNIX)
set(PYEXT_SUFFIX
".so"
CACHE STRING "Suffix for Python extension modules")
Expand Down
30 changes: 29 additions & 1 deletion retro/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,45 @@ def __or__(self, b):
return False
return DefaultIntegrations.DEFAULT.value | b

def __ror__(self, b):
try:
self._init()
except NameError:
return False
return DefaultIntegrations.DEFAULT.value | b

def __and__(self, b):
try:
self._init()
except NameError:
return False
return DefaultIntegrations.DEFAULT.value & b

def __rand__(self, b):
try:
self._init()
except NameError:
return False
return DefaultIntegrations.DEFAULT.value & b

def __lt__(self, b):
try:
self._init()
except NameError:
return False
return DefaultIntegrations.DEFAULT.value < b

def __sub__(self, b):
try:
self._init()
except NameError:
return False
return DefaultIntegrations.DEFAULT.value - b

@classmethod
def add(cls, extra):
cls._init()
cls.DEFAULT |= extra
cls.DEFAULT = cls.DEFAULT | extra

@classmethod
def reset(cls):
Expand Down
2 changes: 1 addition & 1 deletion retro/testing/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def verify_scenario(game, inttype, scenario="scenario", raw=None, dataraw=None):
warnings.append((file, f"missing reward in rewards[{i:d}]"))
elif "variables" in r and "script" in r:
warnings.append(
(file, f"both variables and script present in rewards[{i:d}]"),
(file, "both variables and script present in rewards[{i:d}]"),
)
if "reward" in scen:
warnings.append((file, "reward and rewards both present"))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def run(self):
version=open(VERSION_PATH).read().strip(),
license="MIT",
install_requires=["gymnasium>=0.27.1", "pyglet>=1.3.2,==1.*"],
python_requires=">=3.8.0,<3.11",
python_requires=">=3.8.0,<3.13",
ext_modules=[Extension("retro._retro", ["CMakeLists.txt", "src/*.cpp"])],
cmdclass={"build_ext": CMakeBuild},
packages=[
Expand Down
4 changes: 1 addition & 3 deletions src/ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ file(GLOB SRC *.cpp)

set(RETRO_EXTRA)
# Temporarily disable CapnProto until we upgrade it to a newer version
#if(CapnProto_FOUND)
# list(APPEND RETRO_EXTRA retro-capnp)
#endif()
# if(CapnProto_FOUND) list(APPEND RETRO_EXTRA retro-capnp) endif()

get_target_property(QT_TYPE Qt5::Core TYPE)

Expand Down
67 changes: 0 additions & 67 deletions third-party/pybind11/.appveyor.yml

This file was deleted.

38 changes: 38 additions & 0 deletions third-party/pybind11/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
# See all possible options and defaults with:
# clang-format --style=llvm --dump-config
BasedOnStyle: LLVM
AccessModifierOffset: -4
AllowShortLambdasOnASingleLine: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BreakBeforeBinaryOperators: All
BreakConstructorInitializers: BeforeColon
ColumnLimit: 99
CommentPragmas: 'NOLINT:.*|^ IWYU pragma:'
IncludeBlocks: Regroup
IndentCaseLabels: true
IndentPPDirectives: AfterHash
IndentWidth: 4
Language: Cpp
SpaceAfterCStyleCast: true
Standard: Cpp11
StatementMacros: ['PyObject_HEAD']
TabWidth: 4
IncludeCategories:
- Regex: '<pybind11/.*'
Priority: -1
- Regex: 'pybind11.h"$'
Priority: 1
- Regex: '^".*/?detail/'
Priority: 1
SortPriority: 2
- Regex: '^"'
Priority: 1
SortPriority: 3
- Regex: '<[[:alnum:]._]+>'
Priority: 4
- Regex: '.*'
Priority: 5
...
77 changes: 77 additions & 0 deletions third-party/pybind11/.clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
FormatStyle: file

Checks: |
*bugprone*,
*performance*,
clang-analyzer-optin.cplusplus.VirtualCall,
clang-analyzer-optin.performance.Padding,
cppcoreguidelines-init-variables,
cppcoreguidelines-prefer-member-initializer,
cppcoreguidelines-pro-type-static-cast-downcast,
cppcoreguidelines-slicing,
google-explicit-constructor,
llvm-namespace-comment,
misc-definitions-in-headers,
misc-misplaced-const,
misc-non-copyable-objects,
misc-static-assert,
misc-throw-by-value-catch-by-reference,
misc-uniqueptr-reset-release,
misc-unused-parameters,
modernize-avoid-bind,
modernize-loop-convert,
modernize-make-shared,
modernize-redundant-void-arg,
modernize-replace-auto-ptr,
modernize-replace-disallow-copy-and-assign-macro,
modernize-replace-random-shuffle,
modernize-shrink-to-fit,
modernize-use-auto,
modernize-use-bool-literals,
modernize-use-default-member-init,
modernize-use-emplace,
modernize-use-equals-default,
modernize-use-equals-delete,
modernize-use-noexcept,
modernize-use-nullptr,
modernize-use-override,
modernize-use-using,
readability-avoid-const-params-in-decls,
readability-braces-around-statements,
readability-const-return-type,
readability-container-size-empty,
readability-delete-null-pointer,
readability-else-after-return,
readability-implicit-bool-conversion,
readability-inconsistent-declaration-parameter-name,
readability-make-member-function-const,
readability-misplaced-array-index,
readability-non-const-parameter,
readability-qualified-auto,
readability-redundant-function-ptr-dereference,
readability-redundant-smartptr-get,
readability-redundant-string-cstr,
readability-simplify-subscript-expr,
readability-static-accessed-through-instance,
readability-static-definition-in-anonymous-namespace,
readability-string-compare,
readability-suspicious-call-argument,
readability-uniqueptr-delete-release,
-bugprone-easily-swappable-parameters,
-bugprone-exception-escape,
-bugprone-reserved-identifier,
-bugprone-unused-raii,

CheckOptions:
- key: modernize-use-equals-default.IgnoreMacros
value: false
- key: performance-for-range-copy.WarnOnAllAutoCopies
value: true
- key: performance-inefficient-string-concatenation.StrictMode
value: true
- key: performance-unnecessary-value-param.AllowedTypes
value: 'exception_ptr$;'
- key: readability-implicit-bool-conversion.AllowPointerConditions
value: true

HeaderFilterRegex: 'pybind11/.*h'
73 changes: 73 additions & 0 deletions third-party/pybind11/.cmake-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
parse:
additional_commands:
pybind11_add_module:
flags:
- THIN_LTO
- MODULE
- SHARED
- NO_EXTRAS
- EXCLUDE_FROM_ALL
- SYSTEM

format:
line_width: 99
tab_size: 2

# If an argument group contains more than this many sub-groups
# (parg or kwarg groups) then force it to a vertical layout.
max_subgroups_hwrap: 2

# If a positional argument group contains more than this many
# arguments, then force it to a vertical layout.
max_pargs_hwrap: 6

# If a cmdline positional group consumes more than this many
# lines without nesting, then invalidate the layout (and nest)
max_rows_cmdline: 2
separate_ctrl_name_with_space: false
separate_fn_name_with_space: false
dangle_parens: false

# If the trailing parenthesis must be 'dangled' on its on
# 'line, then align it to this reference: `prefix`: the start'
# 'of the statement, `prefix-indent`: the start of the'
# 'statement, plus one indentation level, `child`: align to'
# the column of the arguments
dangle_align: prefix
# If the statement spelling length (including space and
# parenthesis) is smaller than this amount, then force reject
# nested layouts.
min_prefix_chars: 4

# If the statement spelling length (including space and
# parenthesis) is larger than the tab width by more than this
# amount, then force reject un-nested layouts.
max_prefix_chars: 10

# If a candidate layout is wrapped horizontally but it exceeds
# this many lines, then reject the layout.
max_lines_hwrap: 2

line_ending: unix

# Format command names consistently as 'lower' or 'upper' case
command_case: canonical

# Format keywords consistently as 'lower' or 'upper' case
# unchanged is valid too
keyword_case: 'upper'

# A list of command names which should always be wrapped
always_wrap: []

# If true, the argument lists which are known to be sortable
# will be sorted lexicographically
enable_sort: true

# If true, the parsers may infer whether or not an argument
# list is sortable (without annotation).
autosort: false

# Causes a few issues - can be solved later, possibly.
markup:
enable_markup: false
24 changes: 24 additions & 0 deletions third-party/pybind11/.codespell-ignore-lines
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
template <op_id id, op_type ot, typename L = undefined_t, typename R = undefined_t>
template <typename ThisT>
auto &this_ = static_cast<ThisT &>(*this);
if (load_impl<ThisT>(temp, false)) {
ssize_t nd = 0;
auto trivial = broadcast(buffers, nd, shape);
auto ndim = (size_t) nd;
int nd;
ssize_t ndim() const { return detail::array_proxy(m_ptr)->nd; }
using op = op_impl<id, ot, Base, L_type, R_type>;
template <op_id id, op_type ot, typename L, typename R>
template <detail::op_id id, detail::op_type ot, typename L, typename R, typename... Extra>
class_ &def(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
class_ &def_cast(const detail::op_<id, ot, L, R> &op, const Extra &...extra) {
@pytest.mark.parametrize("access", ["ro", "rw", "static_ro", "static_rw"])
struct IntStruct {
explicit IntStruct(int v) : value(v){};
~IntStruct() { value = -value; }
IntStruct(const IntStruct &) = default;
IntStruct &operator=(const IntStruct &) = default;
py::class_<IntStruct>(m, "IntStruct").def(py::init([](const int i) { return IntStruct(i); }));
py::implicitly_convertible<int, IntStruct>();
m.def("test", [](int expected, const IntStruct &in) {
[](int expected, const IntStruct &in) {
1 change: 1 addition & 0 deletions third-party/pybind11/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs/*.svg binary
Loading