Test failures in Python 3.14 due to changes in metadata handling (2.0.0b7)
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 42/100
Direção de pesquisa
Reproduza as falhas com Python 3.14.2 usando tests/test_inputs.py e, em seguida, inspecione betterproto/init.py em torno da busca de metadados na linha 909 e do tratamento de tipos com falha próximo à linha 1191. Considera-se concluído quando as parametrizações de namespace_builtin_types passarem e o pacote for compilado corretamente e todos os testes forem executados sem erros no Python 3.14.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Summary
Error: cls._betterproto_meta no longer exists @ betterproto/init.py:909
Reproduction Steps
While building release 2.0.0b7 for nixpkgs
Expected Results
It should build and test cleanly.
Actual Results
____________ test_message_can_instantiated[namespace_builtin_types] ____________
cls = <class 'tests.output_betterproto.namespace_builtin_types.Test'>
@classproperty
def _betterproto(cls: type[Self]) -> ProtoClassMetadata: # type: ignore
"""
Lazy initialize metadata for each protobuf class.
It may be initialized multiple times in a multi-threaded environment,
but that won't affect the correctness.
"""
try:
> return cls._betterproto_meta
^^^^^^^^^^^^^^^^^^^^^
E AttributeError: type object 'Test' has no attribute '_betterproto_meta'. Did you mean: '_betterproto'?
/nix/store/i3pvlk97zcrmgmcmrjzx1qfgkd8jhkw2-python3.14-betterproto-2.0.0b7/lib/python3.14/site-packages/betterproto/__init__.py:909: AttributeError
During handling of the above exception, another exception occurred:
test_data = TestData(plugin_module=<module 'tests.output_betterproto.namespace_builtin_types' from '/nix/var/nix/builds/nix-build-...-for-map",\n "bool": "value-for-bool"\n}', test_name='namespace_builtin_types', file_name='namespace_builtin_types')])
@pytest.mark.parametrize("test_data", test_cases.messages, indirect=True)
def test_message_can_instantiated(test_data: TestData) -> None:
plugin_module, *_ = test_data
> plugin_module.Test()
tests/test_inputs.py:165:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
<string>:18: in __init__
???
/nix/store/i3pvlk97zcrmgmcmrjzx1qfgkd8jhkw2-python3.14-betterproto-2.0.0b7/lib/python3.14/site-packages/betterproto/__init__.py:755: in __post_init__
for field_name, meta in self._betterproto.meta_by_field_name.items():
^^^^^^^^^^^^^^^^^
/nix/store/i3pvlk97zcrmgmcmrjzx1qfgkd8jhkw2-python3.14-betterproto-2.0.0b7/lib/python3.14/site-packages/betterproto/__init__.py:846: in __getattribute__
value = super().__getattribute__(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/i3pvlk97zcrmgmcmrjzx1qfgkd8jhkw2-python3.14-betterproto-2.0.0b7/lib/python3.14/site-packages/betterproto/utils.py:56: in __get__
return self.__func__(type)
^^^^^^^^^^^^^^^^^^^
/nix/store/i3pvlk97zcrmgmcmrjzx1qfgkd8jhkw2-python3.14-betterproto-2.0.0b7/lib/python3.14/site-packages/betterproto/__init__.py:911: in _betterproto
cls._betterproto_meta = meta = ProtoClassMetadata(cls)
^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/i3pvlk97zcrmgmcmrjzx1qfgkd8jhkw2-python3.14-betterproto-2.0.0b7/lib/python3.14/site-packages/betterproto/__init__.py:691: in __init__
self.default_gen = self._get_default_gen(cls, fields)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/nix/store/i3pvlk97zcrmgmcmrjzx1qfgkd8jhkw2-python3.14-betterproto-2.0.0b7/lib/python3.14/site-packages/betterproto/__init__.py:698: in _get_default_gen
return {field.name: cls._get_field_default_gen(field) for field in fields}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'tests.output_betterproto.namespace_builtin_types.Test'>
field = Field(name='int',type=Field(name='str',type=<class 'str'>,default=<object object at 0x10428ecd0>,default_factory=<data...oto_type='string', map_types=None, group=None, wraps=None, optional=False)}),kw_only=
False,doc=None,_field_type=_FIELD)
@classmethod
def _get_field_default_gen(cls, field: dataclasses.Field) -> Any:
t = cls._type_hint(field.name)
is_310_union = isinstance(t, _types_UnionType)
if hasattr(t, "__origin__") or is_310_union:
if is_310_union or t.__origin__ is Union:
# This is an optional field (either wrapped, or using proto3
# field presence). For setting the default we really don't care
# what kind of field it is.
return type(None)
if t.__origin__ is list:
# This is some kind of list (repeated) field.
return list
if t.__origin__ is dict:
# This is some kind of map (dict in Python).
return dict
return t
> if issubclass(t, Enum):
^^^^^^^^^^^^^^^^^^^
E TypeError: issubclass() arg 1 must be a class
/nix/store/i3pvlk97zcrmgmcmrjzx1qfgkd8jhkw2-python3.14-betterproto-2.0.0b7/lib/python3.14/site-packages/betterproto/__init__.py:1191: TypeError.
.
.
=========================== short test summary info ============================
FAILED tests/test_inputs.py::test_message_can_instantiated[namespace_builtin_types] - TypeError: issubclass() arg 1 must be a class
FAILED tests/test_inputs.py::test_message_equality[namespace_builtin_types] - TypeError: issubclass() arg 1 must be a class
FAILED tests/test_inputs.py::test_message_json[namespace_builtin_types] - TypeError: issubclass() arg 1 must be a class
### System Information
Python 3.14.2
### Checklist
- [x] I have searched the issues for duplicates.
- [x] I have shown the entire traceback, if possible.
- [x] I have verified this issue occurs on the latest prelease of betterproto which can be installed using `pip install -U --pre betterproto`, if possible.
- Linguagem predominante
- Python
- Estrelas
- 1.8k
- Forks
- 235
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de danielgtaylor/python-betterproto
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 15/100
-
bug investigation needed
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 45/100
-
bug investigation needed
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 38/100
danielgtaylor/python-betterproto#676 · 3 comentários ·
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 10/100
danielgtaylor/python-betterproto#673 · 1 comentário ·
Todas as issues de danielgtaylor/python-betterproto
Issues semelhantes
-
Project submission:Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
slavakurilyak/awesome-ai-agents#845 ·
Mantenedores costumam responder em até 1 dia
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directoryTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertadifficulty:2 enhancement good first issue
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 92/100
MakazhanAlpamys/Soup#2178 ·
Mantenedores costumam responder em até 1 dia
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
scverse/rapids-singlecell#854 ·
Mantenedores costumam responder em até 1 dia
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGLTalvez já em andamento @ninglinLiu assumiu hoje. Abertaarea:frontend backend:slang bug direction:input
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Mantenedores costumam responder em até 1 dia
-
random_elements(unique=True) on an OrderedDict: ZeroDivisionError once only zero weights remain, AssertionError with use_weighting=FalseTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
Mantenedores costumam responder em até 13 dias