From 6b431c6c14b4c568732c1de4b938b4a0106aa580 Mon Sep 17 00:00:00 2001 From: dunossauro Date: Sat, 18 Oct 2025 20:22:58 -0300 Subject: [PATCH 1/5] Force coverate to use ctrace --- codigo_das_aulas/08/pyproject.toml | 1 + codigo_das_aulas/09/pyproject.toml | 1 + codigo_das_aulas/10/pyproject.toml | 1 + codigo_das_aulas/11/pyproject.toml | 4 ++++ codigo_das_aulas/12/pyproject.toml | 1 + codigo_das_aulas/13/pyproject.toml | 1 + 6 files changed, 9 insertions(+) diff --git a/codigo_das_aulas/08/pyproject.toml b/codigo_das_aulas/08/pyproject.toml index db93d8ab..1064846a 100644 --- a/codigo_das_aulas/08/pyproject.toml +++ b/codigo_das_aulas/08/pyproject.toml @@ -47,6 +47,7 @@ addopts = '-p no:warnings' asyncio_default_fixture_loop_scope = 'function' [tool.coverage.run] +core = "ctrace" concurrency = ["thread", "greenlet"] [tool.taskipy.tasks] diff --git a/codigo_das_aulas/09/pyproject.toml b/codigo_das_aulas/09/pyproject.toml index 8001a890..afc4b193 100644 --- a/codigo_das_aulas/09/pyproject.toml +++ b/codigo_das_aulas/09/pyproject.toml @@ -47,6 +47,7 @@ addopts = '-p no:warnings' asyncio_default_fixture_loop_scope = 'function' [tool.coverage.run] +core = "ctrace" concurrency = ["thread", "greenlet"] [tool.taskipy.tasks] diff --git a/codigo_das_aulas/10/pyproject.toml b/codigo_das_aulas/10/pyproject.toml index 9425fe57..0d12dc3b 100644 --- a/codigo_das_aulas/10/pyproject.toml +++ b/codigo_das_aulas/10/pyproject.toml @@ -48,6 +48,7 @@ addopts = '-p no:warnings' asyncio_default_fixture_loop_scope = 'function' [tool.coverage.run] +core = "ctrace" concurrency = ["thread", "greenlet"] [tool.taskipy.tasks] diff --git a/codigo_das_aulas/11/pyproject.toml b/codigo_das_aulas/11/pyproject.toml index f15ed356..165b5a5c 100644 --- a/codigo_das_aulas/11/pyproject.toml +++ b/codigo_das_aulas/11/pyproject.toml @@ -47,6 +47,10 @@ quote-style = 'single' pythonpath = "." addopts = '-p no:warnings' +[tool.coverage.run] +core = "ctrace" +concurrency = ["thread", "greenlet"] + [tool.taskipy.tasks] lint = 'ruff check' pre_format = 'ruff check --fix' diff --git a/codigo_das_aulas/12/pyproject.toml b/codigo_das_aulas/12/pyproject.toml index 3cf6aee3..14af6315 100644 --- a/codigo_das_aulas/12/pyproject.toml +++ b/codigo_das_aulas/12/pyproject.toml @@ -49,6 +49,7 @@ addopts = '-p no:warnings' asyncio_default_fixture_loop_scope = 'function' [tool.coverage.run] +core = "ctrace" concurrency = ["thread", "greenlet"] [tool.taskipy.tasks] diff --git a/codigo_das_aulas/13/pyproject.toml b/codigo_das_aulas/13/pyproject.toml index 3cf6aee3..14af6315 100644 --- a/codigo_das_aulas/13/pyproject.toml +++ b/codigo_das_aulas/13/pyproject.toml @@ -49,6 +49,7 @@ addopts = '-p no:warnings' asyncio_default_fixture_loop_scope = 'function' [tool.coverage.run] +core = "ctrace" concurrency = ["thread", "greenlet"] [tool.taskipy.tasks] From 746328b6e7bc688a5cfb146cac5ecd2d49816789 Mon Sep 17 00:00:00 2001 From: dunossauro Date: Sat, 18 Oct 2025 20:30:45 -0300 Subject: [PATCH 2/5] =?UTF-8?q?Alterando=20vers=C3=A3o=20m=C3=ADnima=20sup?= =?UTF-8?q?ortada=20do=20python=20para=203.10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mkdocs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkdocs.yml b/mkdocs.yml index 65dab364..1f239dc2 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -115,7 +115,7 @@ extra: provider: mike default: estavel current_tag: v4.2.0 - python_supported_version: 3.9 + python_supported_version: "3.10" hooks: - hooks/quiz_hook.py From d47806386f8858ff3c7daafd56e21c0586b1a642 Mon Sep 17 00:00:00 2001 From: dunossauro Date: Sat, 18 Oct 2025 20:31:05 -0300 Subject: [PATCH 3/5] =?UTF-8?q?Adicionando=20blocos=20para=203.14=20onde?= =?UTF-8?q?=20a=20vers=C3=A3o=20=C3=A9=20importante=20no=20texto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aulas/01.md | 4 ++++ aulas/11.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/aulas/01.md b/aulas/01.md index 472f008d..c5e2a479 100644 --- a/aulas/01.md +++ b/aulas/01.md @@ -133,6 +133,10 @@ Após a instalação do Poetry, podemos utilizá-lo para gerenciar e instalar ve Você pode, no entanto, instalar qualquer versão mais nova. Minha recomendação é **sempre que possível**, use a versão mais atualizada possível: +=== "Versão 3.14" +{%set full_version = "3.14.0" %} +{%set short_version = 3.14 %} +{% include "templates/poetry_python.md" %} === "Versão 3.13" {%set full_version = "3.13.2" %} {%set short_version = 3.13 %} diff --git a/aulas/11.md b/aulas/11.md index 5636001f..9325d3ab 100644 --- a/aulas/11.md +++ b/aulas/11.md @@ -54,6 +54,10 @@ Uma das coisas interessantes sobre Docker é que existe um [Hub de containers](h Aqui está um exemplo de `Dockerfile` para executar nossa aplicação: +=== "Versão 3.14" +{%set full_version = "3.14.0" %} +{%set short_version = 3.14 %} +{% include "templates/dockerfile.md" %} === "Versão 3.13" {%set full_version = "3.13.0" %} {%set short_version = 3.13 %} From 87a4d8deee487e1d6e8eff106eb0519483986343 Mon Sep 17 00:00:00 2001 From: dunossauro Date: Sat, 18 Oct 2025 20:50:18 -0300 Subject: [PATCH 4/5] =?UTF-8?q?Removendo=20da=20matrix=20a=20falha=20aceit?= =?UTF-8?q?=C3=A1vel=20do=203.14=20no=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8c8fc608..91c58518 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -103,7 +103,6 @@ jobs: strategy: matrix: python-version: ["3.11", "3.12", "3.13", "3.14"] - continue-on-error: ${{ matrix.python-version == '3.14' }} steps: - name: Copia os arquivos do repo From 757361de8019f79cac36818a131d7499bb851679 Mon Sep 17 00:00:00 2001 From: dunossauro Date: Sat, 18 Oct 2025 21:06:44 -0300 Subject: [PATCH 5/5] Adicionando nota do ctrace ao coverage na aula 08 --- aulas/08.md | 3 +++ changelogs/+0d887e32.adicionado.md | 1 + 2 files changed, 4 insertions(+) create mode 100644 changelogs/+0d887e32.adicionado.md diff --git a/aulas/08.md b/aulas/08.md index 899ddc76..075986a2 100644 --- a/aulas/08.md +++ b/aulas/08.md @@ -876,9 +876,12 @@ A solução para isso é dizer ao coverage que nosso código usa determinado tip ```toml title="pyproject.toml" [tool.coverage.run] +core = "ctrace"#(1)! concurrency = ["thread", "{++greenlet++}"] ``` +1. Existem diversas formas de executar o coverage. O `sysmon` é o runner padrão, mas atualmente ele não suporta o greenlet. [Fonte para se aprofundar mais](https://coverage.readthedocs.io/en/latest/config.html#run-core). + Precisamos ativar a concorrência no coverage em dois casos, para threads (conversamos sobre isso [na aula 05](05.md#threads-e-conexoes){:target="_blank"}) e para o [greenlet](#configuracao-para-o-sqlalchemy-assincrono){:target="_blank"} adicionado pela conexão assíncrona do SQLAlchemy. Com essa pequena alteração, podemos executar os testes novamente e olhar a cobertura: diff --git a/changelogs/+0d887e32.adicionado.md b/changelogs/+0d887e32.adicionado.md new file mode 100644 index 00000000..d19ed802 --- /dev/null +++ b/changelogs/+0d887e32.adicionado.md @@ -0,0 +1 @@ +Aula 08: nota sobre a execução do `coverage` e a escolha fixada no `ctrace`