Deprecate passing file paths instead of URLs to `mimetypes.guess_type()`
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 36k
- Merge médio
- 1d 9h
- PRs com merge (30d)
- 558
Descrição
Feature or enhancement
Proposal:
In Python 3.13, mimetypes.guess_file_type() was introduced as the preferred alternative to guess_type() for file paths. The documentation was updated with a .. soft-deprecated:: 3.13 note at the time.
However, the # TODO: Deprecate accepting file paths (in particular path-like objects) comment in Lib/mimetypes.py was never fulfilled, and no actual DeprecationWarning is currently emitted at runtime when paths are passed in.
This proposal is to fulfill the existing # TODO and emit a DeprecationWarning for passing plain strings (with no valid URL scheme), bytes, and os.PathLike objects into mimetypes.guess_type().
This completes the soft-deprecation cycle initiated in Python 3.13.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
This fulfills the existing # TODO added during the introduction of guess_file_type() in Python 3.13:
https://github.com/python/cpython/blob/main/Lib/mimetypes.py#L131
Linked PRs
- gh-151576
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.
Direção de pesquisa
Comece em Lib/mimetypes.py, no TODO existente, e inspecione guess_type() junto com guess_file_type(). Verifique o comportamento de aviso pretendido para strings de caminho simples, bytes e entradas os.PathLike, preservando o tratamento de URL; o trabalho estará concluído quando o aviso de descontinuação estiver coberto e o comportamento existente continuar correto.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- backend-api-design
- Tipo de issue
- Funcionalidade
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 20/100