Dataset Viewer
Auto-converted to Parquet
repo
stringlengths
9
44
pull_number
int64
1
7.98k
instance_id
stringlengths
14
49
issue_numbers
stringlengths
5
24
base_commit
stringlengths
40
40
patch
stringlengths
187
44.8M
test_patch
stringlengths
215
7.05M
problem_statement
stringlengths
11
58.9k
hints_text
stringlengths
0
240k
created_at
timestamp[s]date
2013-01-14 00:37:56
2025-03-31 14:00:03
version
stringclasses
1 value
kpfleming/jinjanator-plugins
4
kpfleming__jinjanator-plugins-4
['1']
8705793616d6bb546fba4806aca389f040d96a92
diff --git a/changelog.d/1.adding.md b/changelog.d/1.adding.md new file mode 100644 index 0000000..f249fc1 --- /dev/null +++ b/changelog.d/1.adding.md @@ -0,0 +1,1 @@ +Added hook for plugins to report their identities. \ No newline at end of file diff --git a/changelog.d/2.adding.md b/changelog.d/2.adding.md index 1a83909..797bc5f 100644 --- a/changelog.d/2.adding.md +++ b/changelog.d/2.adding.md @@ -1,1 +1,1 @@ -Add three exceptions which Format plugins can raise to indicate problems with options provided to them. \ No newline at end of file +Added three exceptions which Format plugins can raise to indicate problems with options provided to them. diff --git a/plugin_example/jinjanator_plugin_example.py b/plugin_example/jinjanator_plugin_example.py index 309db1a..0e00633 100644 --- a/plugin_example/jinjanator_plugin_example.py +++ b/plugin_example/jinjanator_plugin_example.py @@ -11,9 +11,11 @@ FormatOptionUnsupportedError, FormatOptionValueError, Formats, + Identity, Tests, plugin_filters_hook, plugin_formats_hook, + plugin_identity_hook, plugin_tests_hook, ) @@ -60,6 +62,11 @@ def spam_format( } +@plugin_identity_hook +def plugin_identities() -> Identity: + return "example" + + @plugin_filters_hook def plugin_filters() -> Filters: return {"rot13": rot13_filter} diff --git a/src/jinjanator_plugins/__init__.py b/src/jinjanator_plugins/__init__.py index 6738043..f23d24d 100644 --- a/src/jinjanator_plugins/__init__.py +++ b/src/jinjanator_plugins/__init__.py @@ -41,16 +41,22 @@ class FormatOptionValueError(Exception): F = TypeVar("F", bound=Callable[..., Any]) hookspec = cast(Callable[[F], F], pluggy.HookspecMarker("jinjanator")) +Identity: TypeAlias = str Formats: TypeAlias = Mapping[str, Format] Filters: TypeAlias = Mapping[str, Callable[..., Any]] Globals: TypeAlias = Mapping[str, Callable[..., Any]] Tests: TypeAlias = Mapping[str, Callable[..., Any]] +PluginIdentityHook: TypeAlias = Callable[[], Identity] PluginFormatsHook: TypeAlias = Callable[[], Formats] PluginFiltersHook: TypeAlias = Callable[[], Filters] PluginTestsHook: TypeAlias = Callable[[], Tests] PluginGlobalsHook: TypeAlias = Callable[[], Globals] +plugin_identity_hook = cast( + Callable[[PluginIdentityHook], PluginIdentityHook], + pluggy.HookimplMarker("jinjanator"), +) plugin_formats_hook = cast( Callable[[PluginFormatsHook], PluginFormatsHook], pluggy.HookimplMarker("jinjanator"), @@ -70,6 +76,11 @@ class FormatOptionValueError(Exception): class PluginHooks(Protocol): + @staticmethod + @hookspec + def plugin_identities() -> Identity: + """Returns identity as string""" + @staticmethod @hookspec def plugin_formats() -> Formats: @@ -92,6 +103,10 @@ def plugin_tests() -> Tests: class PluginHookCallers(Protocol): + @staticmethod + def plugin_identities() -> Sequence[Identity]: + """Returns list of strings of identities""" + @staticmethod def plugin_formats() -> Sequence[Formats]: """Returns list of dicts of formats"""
diff --git a/plugin_example/tests/test_plugin_discovery.py b/plugin_example/tests/test_plugin_discovery.py index cde9ebd..73473ae 100644 --- a/plugin_example/tests/test_plugin_discovery.py +++ b/plugin_example/tests/test_plugin_discovery.py @@ -20,6 +20,12 @@ def hook_callers() -> PluginHookCallers: return cast(PluginHookCallers, pm.hook) +def test_identity(hook_callers) -> None: + result = hook_callers.plugin_identities() + assert len(result) == 1 + assert "example" == result[0] + + def test_filter(hook_callers) -> None: result = hook_callers.plugin_filters() assert len(result) == 1 diff --git a/plugin_example/tests/test_plugin_discovery_entrypoint.py b/plugin_example/tests/test_plugin_discovery_entrypoint.py index a4e411e..2172e08 100644 --- a/plugin_example/tests/test_plugin_discovery_entrypoint.py +++ b/plugin_example/tests/test_plugin_discovery_entrypoint.py @@ -20,6 +20,12 @@ def hook_callers() -> PluginHookCallers: return cast(PluginHookCallers, pm.hook) +def test_identity(hook_callers) -> None: + result = hook_callers.plugin_identities() + assert len(result) == 1 + assert "example" == result[0] + + def test_filter(hook_callers) -> None: result = hook_callers.plugin_filters() assert len(result) == 1
Add 'identity' hook for plugins Plugins should be able to report an 'identity' string so that Jinjanator can tell the user which plugins were found.
2023-07-30T18:23:51
-1.0
scikit-build/scikit-build-core
962
scikit-build__scikit-build-core-962
['958']
a887a9b6c057b4ce9d3cfd53ae24e73caf1395a2
diff --git a/docs/cmakelists.md b/docs/cmakelists.md index c9792414..062ec2da 100644 --- a/docs/cmakelists.md +++ b/docs/cmakelists.md @@ -36,7 +36,8 @@ related to making Python extension modules. If you are making a Limited API / Stable ABI package, you'll need the `Development.SABIModule` component instead (CMake 3.26+). You can use the -`SKBUILD_SABI_COMPONENT` variable to check to see if it was requested. +`SKBUILD_SABI_COMPONENT` variable to check to see if it was requested. You can +get the version requested with `${SKBUILD_SABI_VERSION}`. <!-- prettier-ignore-start --> :::{warning} @@ -142,13 +143,25 @@ When defining your module, if you only support the Stable ABI after some point, you should use (for example for 3.11): ```cmake -if(NOT "${SKBUILD_SABI_COMPONENT}" STREQUAL "") - python_add_library(some_ext MODULE WITH_SOABI USE_SABI 3.11 ...) +if(NOT "${SKBUILD_SABI_VERSION}" STREQUAL "") + python_add_library(some_ext MODULE WITH_SOABI USE_SABI ${SKBUILD_SABI_VERSION} ...) else() python_add_library(some_ext MODULE WITH_SOABI ...) endif() ``` +If you have a lot of libraries, you can conditionally save these two items into +a variable with `set(USE_SABI USE_SABI ${SKBUILD_SABI_VERSION})` and use it in +all your `python_add_library` calls: + +``` +if(NOT "${SKBUILD_SABI_VERSION}" STREQUAL "") + set(USE_SABI "USE_SABI ${SKBUILD_SABI_VERSION}") +endif() + +python_add_library(some_ext MODULE WITH_SOABI ${USE_SABI} ...) +``` + This will define `Py_LIMITED_API` for you. If you want to support building directly from CMake, you need to protect this for Python version, `Python_INTERPRETER_ID STREQUAL Python`, and free-threading Python 3.13+ doesn't diff --git a/src/scikit_build_core/builder/builder.py b/src/scikit_build_core/builder/builder.py index 5aecd1d9..b19173fd 100644 --- a/src/scikit_build_core/builder/builder.py +++ b/src/scikit_build_core/builder/builder.py @@ -233,6 +233,14 @@ def configure( "Development.SABIModule" if limited_api else "" ) + # Allow users to detect the version requested in settings + py_api = self.settings.wheel.py_api + cache_config["SKBUILD_SABI_VERSION"] = ( + f"{py_api[2]}.{py_api[3:]}" + if limited_api and py_api.startswith("cp") + else "" + ) + if cache_entries: cache_config.update(cache_entries)
diff --git a/tests/packages/abi3_pyproject_ext/CMakeLists.txt b/tests/packages/abi3_pyproject_ext/CMakeLists.txt index 9deb08e6..33b13a2a 100644 --- a/tests/packages/abi3_pyproject_ext/CMakeLists.txt +++ b/tests/packages/abi3_pyproject_ext/CMakeLists.txt @@ -10,8 +10,16 @@ find_package( COMPONENTS Interpreter Development.Module ${SKBUILD_SABI_COMPONENT} REQUIRED) -if(NOT "${SKBUILD_SABI_COMPONENT}" STREQUAL "") - python_add_library(abi3_example MODULE abi3_example.c WITH_SOABI USE_SABI 3.7) +if(NOT "${SKBUILD_SABI_VERSION}" STREQUAL "") + python_add_library(abi3_example MODULE abi3_example.c WITH_SOABI USE_SABI + ${SKBUILD_SABI_VERSION}) + + if(NOT SKBUILD_SABI_VERSION STREQUAL "3.7") + message( + FATAL_ERROR + "TEST FAILED: SKBUILD_SABI_VERSION (${SKBUILD_SABI_VERSION}) is not 3.7" + ) + endif() else() python_add_library(abi3_example MODULE abi3_example.c WITH_SOABI) endif()
Introduce `SKBUILD_SABI_VERSION` CMake variable To follow-up on https://github.com/orgs/scikit-build/discussions/1128#discussioncomment-11489351 answering a question from @minrk, I suggest we introduce the CMake cache variable `SKBUILD_SABI_VERSION` set from the value associated with the `wheel.py-api` setting. Related documentation: * https://scikit-build-core.readthedocs.io/en/latest/schema.html * https://scikit-build-core.readthedocs.io/en/latest/cmakelists.html#limited-api-stable-abi * https://scikit-build-core.readthedocs.io/en/latest/configuration.html#customizing-the-output-wheel Related issues & pull requests: * https://github.com/scikit-build/scikit-build-core/issues/743 * https://github.com/scikit-build/scikit-build-core/pull/957
That way we could simply do the following: ```cmake if(NOT "${SKBUILD_SABI_COMPONENT}" STREQUAL "") python_add_library(some_ext MODULE WITH_SOABI USE_SABI ${SKBUILD_SABI_VERSION} ...) else() python_add_library(some_ext MODULE WITH_SOABI ...) endif() ``` ```cmake if(NOT "${SKBUILD_SABI_VERSION}" STREQUAL "") set(_sabi "USE_SABI ${SKBUILD_SABI_VERSION}") endif() python_add_library(some_ext MODULE WITH_SOABI ${_sabi}) ``` That would be great!
2024-12-21T06:15:25
-1.0
zopefoundation/zope.testrunner
83
zopefoundation__zope.testrunner-83
['80']
138a8c9af00d0a72a0cefaf55057c0ff14086206
diff --git a/CHANGES.rst b/CHANGES.rst index 9e7b960..e097e2d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,7 +5,9 @@ 4.9.2 (unreleased) ================== -- Nothing changed yet. +- Fix ``TypeError: a bytes-like object is required, not 'str'`` + running tests in parallel on Python 3. See `issue 80 + <https://github.com/zopefoundation/zope.testrunner/issues/80>`_. 4.9.1 (2018-11-21)
diff --git a/src/zope/testrunner/runner.py b/src/zope/testrunner/runner.py index 8382b5c..ea9f19c 100644 --- a/src/zope/testrunner/runner.py +++ b/src/zope/testrunner/runner.py @@ -697,6 +697,7 @@ def resume_tests(script_parts, options, features, layers, failures, errors, current_result = next(results_iter) last_layer_intermediate_output = None output = None + # Get an object that (only) accepts bytes stdout = _get_output_buffer(sys.stdout) while ready_threads or running_threads: while len(running_threads) < options.processes and ready_threads: @@ -723,6 +724,8 @@ def resume_tests(script_parts, options, features, layers, failures, errors, ('[Parallel tests running in ' '%s:\n ' % (layer_name,)).encode('utf-8')) last_layer_intermediate_output = layer_name + if not isinstance(output, bytes): + output = output.encode('utf-8') stdout.write(output) # Display results in the order they would have been displayed, had the # work not been done in parallel. diff --git a/src/zope/testrunner/tests/testrunner-layers-buff.rst b/src/zope/testrunner/tests/testrunner-layers-buff.rst index ee76600..f3a26dd 100644 --- a/src/zope/testrunner/tests/testrunner-layers-buff.rst +++ b/src/zope/testrunner/tests/testrunner-layers-buff.rst @@ -9,15 +9,32 @@ First, we wrap stdout with an object that instruments it. It notes the time at which a given line was written. >>> import os, sys, datetime - >>> class RecordingStreamWrapper: + >>> class RecordingStreamWrapper(object): ... def __init__(self, wrapped): ... self.record = [] ... self.wrapped = wrapped + ... @property + ... def buffer(self): + ... # runner._get_output_buffer attempts to write b'' + ... # to us, and when that fails (see write()), accesses our .buffer directly. + ... # That object deals in bytes. + ... wrapper = self + ... class buffer(object): + ... def write(self, data): + ... assert isinstance(data, bytes) + ... wrapper.write(data.decode('utf-8')) + ... def writelines(self, lines): + ... for line in lines: + ... self.write(line) + ... def flush(self): + ... wrapper.flush() + ... return buffer() ... def write(self, out): - ... # Not very accurate, but it will do as long as we don't - ... # actually need to be binary-clean. + ... # sys.stdout deals with native strings; + ... # and raises TypeError for other things. We must do + ... # the same. ... if not isinstance(out, str): - ... out = out.decode('utf-8') + ... raise TypeError ... self.record.append((out, datetime.datetime.now())) ... self.wrapped.write(out) ... def writelines(self, lines): @@ -80,7 +97,7 @@ more than a second after the second suite ran. ... if time-last_time >= pause: ... # We paused! ... print('PAUSE FOUND BETWEEN THESE LINES:') - ... print(''.join([last_line, line, '-'*70])) + ... print(''.join([last_line, line, '-' * 70])) ... last_line, last_time = line, time >>> assert_progressive_output() # doctest: +ELLIPSIS
TypeError when running tests in parallel See https://github.com/zopefoundation/ZEO/pull/117#issuecomment-429639082 It seems to be caused by zopefoundation/zope.testrunner#69.
Yup. The fix may be as simple as adding a `b` here: https://github.com/zopefoundation/zope.testrunner/blob/138a8c9af00d0a72a0cefaf55057c0ff14086206/src/zope/testrunner/runner.py#L661 I just beat my head against the tests trying to provoke the bug but I don't understand the plumbing. :( I'm pretty sure that https://github.com/zopefoundation/zope.testrunner/pull/69/files#diff-69d7f1f09142c029b8d8be1cb657b26eR19 is a bug magnet and is obscuring the problem. In the mean time, we should downgrade the zope.testrunner used by ZEO.
2018-11-24T06:11:23
-1.0
laughingman7743/PyAthena
568
laughingman7743__PyAthena-568
['558']
707c4d540f584818bf2461c1c3d53b93bfb1dd95
"diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml\nindex bdf59cf7..a25be37d 10(...TRUNCATED)
"diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml\nindex caa678e1..5c30a5e7 10(...TRUNCATED)
"Migrate package management to uv\nhttps://astral.sh/blog/uv-unified-python-packaging\r\n\r\nhttps:/(...TRUNCATED)
2024-12-28T16:02:40
-1.0
tobymao/saq
163
tobymao__saq-163
['162']
a5e3c9274586fb2308bb388d5718a2f0fef80826
"diff --git a/saq/queue/postgres.py b/saq/queue/postgres.py\nindex 8f3343b..cf825f8 100644\n--- a/sa(...TRUNCATED)
"diff --git a/tests/test_queue.py b/tests/test_queue.py\nindex 80bf22d..6f54499 100644\n--- a/tests/(...TRUNCATED)
"SAQ hangs if Postgres restarts while SAQ is running\nSAQ hangs if Postgres restarts while SAQ is ru(...TRUNCATED)
Thank you for reporting this bug. I am able to reproduce it.
2024-09-26T08:41:57
-1.0
kpfleming/jinjanator-plugins
3
kpfleming__jinjanator-plugins-3
['2']
115d84ddf126ef9f32219b7d7be3f4a8019b4478
"diff --git a/changelog.d/2.adding.md b/changelog.d/2.adding.md\nnew file mode 100644\nindex 0000000(...TRUNCATED)
"diff --git a/changelog.d/+unit_tests.changing.md b/changelog.d/+unit_tests.changing.md\nnew file mo(...TRUNCATED)
"Add exceptions for 'format' plugins to use\n* FormatOptionUnknown\r\n* FormatOptionValueError\r\n* (...TRUNCATED)
2023-07-29T04:19:19
-1.0
kevlened/pytest-parallel
98
kevlened__pytest-parallel-98
['89']
388e1941f3bc6ce8ce40eb95bbbe53e743e47226
"diff --git a/tox.ini b/tox.ini\nindex 22b1374..6e7b5bc 100644\n--- a/tox.ini\n+++ b/tox.ini\n@@ -4,(...TRUNCATED)
"diff --git a/pytest_parallel/__init__.py b/pytest_parallel/__init__.py\nindex 5702a64..a452bd1 1006(...TRUNCATED)
"Please support Python 3.9\nWhen I run `pytest . --workers auto` with Python 3.9, this error occur.\(...TRUNCATED)
"I would also be interested in having this resolved. I am hesitant to move to 3.9 until we can run o(...TRUNCATED)
2021-05-29T19:09:39
-1.0
zopefoundation/zope.testrunner
142
zopefoundation__zope.testrunner-142
['141']
4c4ad8011a435551b96e4abd8b9edaa41a3cb939
"diff --git a/CHANGES.rst b/CHANGES.rst\nindex 0d3f6aa..976f150 100644\n--- a/CHANGES.rst\n+++ b/CHA(...TRUNCATED)
"diff --git a/src/zope/testrunner/runner.py b/src/zope/testrunner/runner.py\nindex 0688fce..693d733 (...TRUNCATED)
"running with `-D` triggers debugger for skipped tests \n## BUG/PROBLEM REPORT / FEATURE REQUEST\r\n(...TRUNCATED)
2022-12-06T22:35:04
-1.0
uqfoundation/ppft
65
uqfoundation__ppft-65
['61']
679bf1e68b5899d3d71244bc0a3d52bd53b49088
"diff --git a/ppft/__main__.py b/ppft/__main__.py\nindex cf99ecc..52a6a91 100644\n--- a/ppft/__main_(...TRUNCATED)
"diff --git a/ppft/tests/auto_diff.py b/ppft/tests/auto_diff.py\nindex 61aff53..6ca7c26 100755\n--- (...TRUNCATED)
"Python 3.13: Traceback during execution of tests\nFedora is preparing for the upcoming release of P(...TRUNCATED)
"Thanks for submitting the issue. I am aware of it. There's some issues that changes in python `3.(...TRUNCATED)
2024-09-22T06:56:48
-1.0
prodigyeducation/python-graphql-client
33
prodigyeducation__python-graphql-client-33
['32']
02492c7efe43b66f7c01bc54b4ea504b3dae5f6a
"diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml\nindex 7011cdd..6b173e9 100644\n--- (...TRUNCATED)
"diff --git a/tests/test_graphql_client.py b/tests/test_graphql_client.py\nindex a3d408f..4e7b943 10(...TRUNCATED)
"Turning off SSL verification for API requests\nI am not sure if we have this already, however, I co(...TRUNCATED)
2020-11-06T10:10:39
-1.0
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
29