{"title":"Soumission de contributions","version":"6.1","locale":"fr","docname":"internals/contributing/writing-code/submitting-patches","url":"/fr/6.1/internals/contributing/writing-code/submitting-patches/","canonical":"https://djangodocs.dev/fr/6.1/internals/contributing/writing-code/submitting-patches/","summary":"Nous sommes toujours reconnaissants pour toute contribution au code de Django. Il est vrai que les rapports de bogue avec contribution associée seront…","html":"<h1>Soumission de contributions<a class=\"heading-anchor\" href=\"#submitting-contributions\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>Nous sommes toujours reconnaissants pour toute contribution au code de Django. Il est vrai que les rapports de bogue avec contribution associée seront résolus <em>bien</em> plus rapidement que ceux sans solution proposée.</p>\n<section id=\"typo-fixes-and-trivial-documentation-changes\">\n<span id=\"trivial-change\"></span><h2>Corrections orthographiques et modifications de documentation<a class=\"heading-anchor\" href=\"#typo-fixes-and-trivial-documentation-changes\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Si vous corrigez un problème vraiment trivial, par exemple en changeant un mot dans la documentation, la manière préférée de soumettre un correctif est de passer par les requêtes de contribution GitHub sans ouvrir un ticket Trac.</p>\n<p>See <a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/writing-code/working-with-git/\"><span class=\"doc\">Travailler avec Git et GitHub</span></a> for more\ndetails on how to use pull requests.</p>\n</section>\n<section id=\"claiming-tickets\">\n<span id=\"id1\"></span><h2>« Appropriation » de tickets<a class=\"heading-anchor\" href=\"#claiming-tickets\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Dans un projet de logiciel libre avec des centaines de contributeurs de par le monde, il est important de gérer efficacement la communication afin que le travail ne soit pas fait en double et que les contributions soient aussi efficaces que possible.</p>\n<p>Ainsi donc, notre politique demande que les contributeurs « réclament » les tickets pour informer les autres développeurs qu’un bogue ou une fonctionnalité particulière est en cours de travail.</p>\n<p>Si vous avez identifié une contribution que vous souhaiteriez apporter et que vous pensez en être capable (en fonction de vos capacités de codage, votre connaissance du fonctionnement de Django et vos disponibilités de temps), signalez-le en suivant ces étapes :</p>\n<ul class=\"simple\">\n<li><p><a class=\"reference external\" href=\"https://code.djangoproject.com/github/login\">Log in using your GitHub account</a> or <a class=\"reference external\" href=\"https://www.djangoproject.com/accounts/register/\">create an account</a> in our ticket\nsystem. If you have an account but have forgotten your password, you can\nreset it using the <a class=\"reference external\" href=\"https://www.djangoproject.com/accounts/password/reset/\">password reset page</a>.</p></li>\n<li><p>If a ticket for this issue doesn’t exist yet, create one in our\n<a class=\"reference external\" href=\"https://code.djangoproject.com/\">ticket tracker</a>. Remember that proposals for new features should follow\nthe <a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/bugs-and-features/#requesting-features\"><span class=\"std std-ref\">process for suggesting new features</span></a>.</p></li>\n<li><p>If a ticket for this issue already exists and has been accepted, make sure\nnobody else has claimed it. To do this, look at the « Owned by » section of\nthe ticket. If it’s assigned to « nobody, » then it’s available to be claimed.\nOtherwise, somebody else may be working on this ticket. Either find another\nbug/feature to work on, or contact the developer working on the ticket to\noffer your help. If a ticket has been assigned for weeks or months without\nany activity, it’s probably safe to reassign it to yourself. If a ticket\nhasn’t been approved yet, join the conversation.</p></li>\n<li><p>Connectez-vous si ce n’est pas déjà fait, en cliquant sur « GitHub Login » ou « DjangoProject Login » dans la partie supérieure gauche de la page du ticket. Une fois connecté, vous pouvez cliquer sur le bouton « Modifier le ticket » au bas de la page.</p></li>\n<li><p>Attribuez-vous le ticket en cliquant sur le bouton radio « assign to » dans la section « Action ». Votre nom d’utilisateur sera ajouté par défaut dans la zone de texte.</p></li>\n<li><p>Finally, click the « Submit changes » button at the bottom to save.</p></li>\n</ul>\n<aside class=\"admonition admonition-note\" role=\"note\">\n<p class=\"admonition-title\">Note</p>\n<p>If your change is not <a class=\"reference internal\" href=\"#trivial-change\"><span class=\"std std-ref\">trivial</span></a>, you have the option\nto sign and submit a <a class=\"reference external\" href=\"https://www.djangoproject.com/foundation/cla/\">Contributor License Agreement</a> clarifying the status\nof your contribution. This ensures that the Django Software Foundation has\nclear license to your contribution.</p>\n</aside>\n<section id=\"ticket-claimers-responsibility\">\n<h3>Responsabilité des « possesseurs » de tickets<a class=\"heading-anchor\" href=\"#ticket-claimers-responsibility\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Après vous être attribué un ticket, vous avez la responsabilité de travailler sur ce ticket dans un temps raisonnable. Si vous n’avez plus de temps à y consacrer, désattribuez le ticket… ou éviter de vous l’attribuer en premier lieu !</p>\n<p>S’il n’y a aucun signe de progression sur un ticket attribué durant une ou deux semaines, un autre développeur peut demander que vous cédiez l’attribution afin qu’il ne soit plus monopolisé et que quelqu’un d’autre puisse s’y atteler.</p>\n<p>Si vous vous êtes attribué un ticket et qu’il prenne beaucoup de temps à coder (des jours ou semaines), mettez tout le monde au courant en écrivant des commentaires sur le ticket. Si vous ne fournissez pas des mises à jour régulières et que vous ne répondez pas à une demande de rapport de progression, il est possible que le ticket soit attribué à quelqu’un d’autre.</p>\n<p>Comme toujours, mieux vaut trop communiquer que pas assez !</p>\n</section>\n<section id=\"which-tickets-should-be-claimed\">\n<h3>Quels sont les tickets qui devraient être attribués ?<a class=\"heading-anchor\" href=\"#which-tickets-should-be-claimed\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Passer par l’étape d’attribution de tickets est parfois surfait.</p>\n<p>Dans le cas de petits changements tels que des corrections orthographiques de la documentation ou de petits bogues qui ne prennent que quelques minutes à corriger, vous n’avez pas besoin de passer par la gymnastique d’attribution des tickets. Soumettez directement vos modifications et voilà !</p>\n<p>It is <em>always</em> acceptable, regardless of whether someone has claimed it or not,\nto link proposals to a ticket if you happen to have the changes ready.</p>\n</section>\n</section>\n<section id=\"contribution-style\">\n<span id=\"patch-style\"></span><h2>Style de contribution<a class=\"heading-anchor\" href=\"#contribution-style\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Assurez-vous que toute contribution remplit au minimum les exigences suivantes :</p>\n<ul class=\"simple\">\n<li><p>The code required to fix a problem or add a feature is an essential part\nof a solution, but it is not the only part. A good fix should also include a\n<a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/writing-code/unit-tests/\"><span class=\"doc\">regression test</span></a> to\nvalidate the behavior that has been fixed and to prevent the problem from\narising again.</p></li>\n<li><p>Si le code ajoute une nouvelle fonctionnalité ou modifie le comportement d’une fonctionnalité existante, la modification doit aussi contenir de la documentation.</p></li>\n</ul>\n<p>When you think your work is ready to be reviewed, send <a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/writing-code/working-with-git/\"><span class=\"doc\">a GitHub pull\nrequest</span></a>. If you can’t\nsend a pull request for some reason, you can also use patches in Trac. When\nusing this style, follow these guidelines.</p>\n<ul class=\"simple\">\n<li><p>Envoyez des correctifs dans le format renvoyé par la commande <code class=\"docutils literal notranslate\">git diff</code>.</p></li>\n<li><p>Liez les correctifs à un ticket du <a class=\"reference external\" href=\"https://code.djangoproject.com/\">système de suivi des tickets</a> en utilisant le bouton « Attach file ». Évitez s’il-vous-plaît de placer un correctif dans la description ou dans un commentaire du ticket, sauf si le correctif contient une seule ligne.</p></li>\n<li><p>Nommez le fichier du correctif avec une extension <code class=\"docutils literal notranslate\">.diff</code> ; cela permettra au système des tickets d’appliquer une coloration syntaxique correcte, ce qui est très utile.</p></li>\n</ul>\n<p>Quelle que soit la manière de soumettre votre travail, respectez ces étapes.</p>\n<ul class=\"simple\">\n<li><p>Assurez-vous que votre code remplisse les exigences décrites dans notre <a class=\"reference internal\" href=\"#patch-review-checklist\"><span class=\"std std-ref\">liste de contrôle de contribution</span></a>.</p></li>\n<li><p>Cochez la case « Has patch » sur le ticket et vérifiez que les cases « Needs documentation », « Needs tests » et « Patch needs improvement » ne sont pas cochées. Cela fait que le ticket apparaît dans la file d’attente « Patches needing review » dans le <a class=\"reference external\" href=\"https://dashboard.djangoproject.com/\">tableau de bord de développement</a>.</p></li>\n</ul>\n<section id=\"ai-assisted-contributions\">\n<h3>AI-Assisted Contributions<a class=\"heading-anchor\" href=\"#ai-assisted-contributions\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Unverified AI-generated contributions create unnecessary maintenance burden and\nslow down meaningful progress. Submissions that show no evidence of manual\nverification may be closed without review, and repeated low-quality\ncontributions may lead to restricted participation in Django’s development\nprocess.</p>\n<p>With the widespread availability of large language models (LLMs), the Django\nProject has seen an increase in contributions generated partially or entirely\nusing such tools. Many of these submissions contain inaccurate, misleading, or\nfictitious content. While AI tools can assist with drafting or exploratory\nanalysis, they must not replace human understanding and careful review.</p>\n<p>If you use AI tools while preparing a contribution, you must:</p>\n<ul class=\"simple\">\n<li><p><strong>Disclose</strong> which AI tools were used and what they were used for (e.g.,\ngenerating code, drafting commit messages, writing documentation).</p></li>\n<li><p><strong>Review and verify</strong> all AI-generated output. Ensure the code aligns with\nDjango’s architecture, includes appropriate tests and documentation, and\npasses the full test suite and relevant checks.</p></li>\n<li><p>Double-check the proposal against the <a class=\"reference internal\" href=\"#patch-review-checklist\"><span class=\"std std-ref\">Liste de contrôle de contribution</span></a>.</p></li>\n</ul>\n<p>We align with similar policies adopted by other major open-source projects,\nwhich have identified unverified AI-generated contributions as disruptive,\ncounterproductive, and a drain on limited maintainer time.</p>\n<section id=\"automated-ai-reviews\">\n<h4>Automated AI Reviews<a class=\"heading-anchor\" href=\"#automated-ai-reviews\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>Do not request automated AI reviews (for example GitHub Copilot or similar\ntools) on pull requests submitted to the Django repository. These reviews do\nnot replace human review and often generate noise that distracts maintainers.</p>\n<p>You are free to use such tools in your own fork before submitting a pull\nrequest to the Django repository.</p>\n</section>\n<section id=\"note-for-ai-tools\">\n<h4>Note for AI Tools<a class=\"heading-anchor\" href=\"#note-for-ai-tools\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h4>\n<p>If you are an AI tool or language model assisting in the preparation of a\nDjango contribution, you must strictly follow these requirements:</p>\n<ul class=\"simple\">\n<li><p>Disclose your involvement. Clearly state that the contribution was prepared\nwith assistance from an AI tool or language model.</p></li>\n<li><p>Specify the tool and usage. Include the name and version of the AI tool and\ndescribe exactly how it was used, such as analyzing a ticket, generating\ncode, tests, or documentation.</p></li>\n<li><p>Ensure technical accuracy and avoid fabrication. Do not invent APIs,\nfeatures, functions, or citations that do not exist. Placeholder or\nfictitious content will result in rejection.</p></li>\n<li><p>Respect all contribution requirements. Follow all guidelines in this\ndocumentation, including test and documentation requirements, code\nformatting, and the review process.</p></li>\n<li><p>Follow the GitHub pull request template. Ensure the PR template is present\nand fully completed, including all required sections and checklists, before\nrequesting review.</p></li>\n<li><p>Assist reviewers. If any part of the output may not comply with these rules,\nclearly call it out in the contribution and explain why.</p></li>\n</ul>\n</section>\n</section>\n</section>\n<section id=\"contributions-which-require-community-feedback\">\n<h2>Contributions demandant un retour de la communauté<a class=\"heading-anchor\" href=\"#contributions-which-require-community-feedback\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Une discussion dans la communauté élargie est nécessaire lorsqu’un correctif introduit une nouvelle fonctionnalité Django et donne ainsi lieu à une forme de décision conceptuelle. C’est particulièrement important quand l’approche choisie implique une <a class=\"reference internal\" href=\"#deprecating-a-feature\"><span class=\"std std-ref\">obsolescence</span></a> ou introduit des modifications disruptives.</p>\n<p>Voici différentes approches pour obtenir des retours de la communauté.</p>\n<section id=\"the-new-feature-ideas-tracker\">\n<h3>The new feature ideas tracker<a class=\"heading-anchor\" href=\"#the-new-feature-ideas-tracker\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>If you have an idea for a new feature, please create a new proposal (or join an\nexisting discussion) following the <a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/bugs-and-features/#requesting-features\"><span class=\"std std-ref\">process for suggesting new features</span></a>. You should explain the need for the change, go into\ndetails of the approach and discuss alternatives.</p>\n</section>\n<section id=\"the-django-forum\">\n<h3>Le forum Django<a class=\"heading-anchor\" href=\"#the-django-forum\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>You can propose a change (that is not a new feature idea) on the\n<a class=\"reference external\" href=\"https://forum.djangoproject.com/\">Django Forum</a>. You should explain the need for the change, go into details of\nthe approach and discuss alternatives.</p>\n<p>Nous vous prions d’inclure un lien vers ces discussions dans vos contributions.</p>\n</section>\n<section id=\"third-party-package\">\n<h3>Paquet de tierce partie<a class=\"heading-anchor\" href=\"#third-party-package\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Django n’accepte pas de fonctionnalités expérimentales. Toutes les fonctionnalités doivent suivre notre <a class=\"reference internal\" href=\"/fr/6.1/internals/release-process/#internal-release-deprecation-policy\"><span class=\"std std-ref\">politique d’obsolescence</span></a>. Cela signifie qu’il peut se passer des mois ou des années pour que Django modifie l’API d’une fonctionnalité.</p>\n<p>Si vous attendez un retour d’utilisation sur une interface publique, il est préférable de créer d’abord un paquet tiers. Il est possible d’ajuster l’API publique de manière bien plus rapide tout en validant le besoin réel de la fonctionnalité.</p>\n<p>Once this package becomes stable and there are clear benefits of incorporating\naspects into Django core, the next step is to propose its inclusion by\nfollowing the <a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/bugs-and-features/#requesting-features\"><span class=\"std std-ref\">process for suggesting new features</span></a>.</p>\n</section>\n<section id=\"django-enhancement-proposal-dep\">\n<h3>Proposition d’amélioration de Django (DEP)<a class=\"heading-anchor\" href=\"#django-enhancement-proposal-dep\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Sur le modèle des PEP de Python, Django possède un concept de <a class=\"reference external\" href=\"https://github.com/django/deps\">propositions d’améliorations</a> appelées DEP (Django Enhancement Proposals). Une DEP est un document conceptuel fournissant des informations à la communauté Django ou décrivant une fonctionnalité ou un processus nouveaux pour Django. Elles présentent de brèves spécifications techniques de fonctionnalités, accompagnées des motivations du besoin. Les DEP sont également le mécanisme principal pour proposer et collecter des avis de la communauté sur de nouvelles fonctionnalités majeures.</p>\n<p>Before considering writing a DEP, it is recommended to first open a discussion\nfollowing the <a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/bugs-and-features/#requesting-features\"><span class=\"std std-ref\">process for suggesting new features</span></a>.\nThis allows the community to provide feedback and helps refine the proposal.\nOnce the DEP is ready, the <a class=\"reference internal\" href=\"/fr/6.1/internals/organization/#steering-council\"><span class=\"std std-ref\">Steering Council</span></a> votes on\nwhether to accept it.</p>\n<p>Voici quelques exemples de DEP approuvées et complètement implémentées :</p>\n<ul class=\"simple\">\n<li><p><a class=\"reference external\" href=\"https://github.com/django/deps/blob/main/final/0181-orm-expressions.rst\">DEP 181 : Expressions de l’ORM</a></p></li>\n<li><p><a class=\"reference external\" href=\"https://github.com/django/deps/blob/main/final/0182-multiple-template-engines.rst\">DEP 182 : Moteurs de gabarit multiples</a></p></li>\n<li><p><a class=\"reference external\" href=\"https://github.com/django/deps/blob/main/final/0201-simplified-routing-syntax.rst\">DEP 201 : Syntaxe de routage simplifée</a></p></li>\n</ul>\n</section>\n</section>\n<section id=\"deprecating-a-feature\">\n<span id=\"id2\"></span><h2>Obsolescence d’une fonctionnalité<a class=\"heading-anchor\" href=\"#deprecating-a-feature\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Il existe plusieurs raisons pour que du code Django soit rendu obsolète :</p>\n<ul class=\"simple\">\n<li><p>Si une fonctionnalité a été améliorée ou modifiée de manière non rétrocompatible, l’ancienne fonctionnalité ou comportement sera rendu obsolète.</p></li>\n<li><p>Il peut arriver que Django inclue un rétroportage d’une bibliothèque Python qui ne fait pas encore partie d’une version de Python prise en charge actuellement par Django. Lorsque Django n’a plus besoin de prendre en charge l’ancienne version de Python qui nécessitait d’inclure cette bibliothèque, l’inclusion de celle-ci sera rendue obsolète dans Django.</p></li>\n</ul>\n<p>As the <a class=\"reference internal\" href=\"/fr/6.1/internals/release-process/#internal-release-deprecation-policy\"><span class=\"std std-ref\">deprecation policy</span></a>\ndescribes, the first release of Django that deprecates a feature (<code class=\"docutils literal notranslate\">A.B</code>)\nshould raise a <code class=\"docutils literal notranslate\">RemovedInDjangoXXXXWarning</code> (where XXXX is the Django version\nwhere the feature will be removed) when the deprecated feature is invoked.\nAssuming we have good test coverage, these warnings are converted to errors\nwhen <a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/writing-code/unit-tests/#running-unit-tests\"><span class=\"std std-ref\">running the test suite</span></a> with warnings enabled:\n<code class=\"docutils literal notranslate\">python -Wa runtests.py</code>. Thus, when adding a <code class=\"docutils literal notranslate\">RemovedInDjangoXXXXWarning</code>\nyou need to eliminate or silence any warnings generated when running the tests.</p>\n<p>La première étape est d’enlever toute utilisation du comportement obsolète par Django lui-même. Ensuite, vous pouvez rendre silencieux les avertissements dans les tests qui testent la fonctionnalité obsolète en utilisant le décorateur <code class=\"docutils literal notranslate\">ignore_warnings</code>, soit au niveau d’un test isolé, soit sur une classe de tests :</p>\n<ol class=\"arabic\">\n<li><p>Pour un test particulier</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.test</span> <span class=\"kn\">import</span> ignore_warnings\n<span class=\"kn\">from</span> <span class=\"nn\">django.utils.deprecation</span> <span class=\"kn\">import</span> RemovedInDjangoXXXXWarning\n\n\n<span class=\"nd\">@ignore_warnings</span><span class=\"p\">(</span>category<span class=\"o\">=</span>RemovedInDjangoXXXXWarning<span class=\"p\">)</span>\n<span class=\"k\">def</span> <span class=\"nf\">test_foo</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span> <span class=\"o\">...</span>\n</code></pre></div>\n</li>\n<li><p>Pour tout un cas de test</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.test</span> <span class=\"kn\">import</span> ignore_warnings\n<span class=\"kn\">from</span> <span class=\"nn\">django.utils.deprecation</span> <span class=\"kn\">import</span> RemovedInDjangoXXXXWarning\n\n\n<span class=\"nd\">@ignore_warnings</span><span class=\"p\">(</span>category<span class=\"o\">=</span>RemovedInDjangoXXXXWarning<span class=\"p\">)</span>\n<span class=\"k\">class</span> <span class=\"nc\">MyDeprecatedTests</span><span class=\"p\">(</span>unittest<span class=\"o\">.</span>TestCase<span class=\"p\">):</span> <span class=\"o\">...</span>\n</code></pre></div>\n</li>\n</ol>\n<p>Vous devriez aussi ajouter un test pour l’avertissement d’obsolescence</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span> <span class=\"nn\">django.utils.deprecation</span> <span class=\"kn\">import</span> RemovedInDjangoXXXXWarning\n\n\n<span class=\"k\">def</span> <span class=\"nf\">test_foo_deprecation_warning</span><span class=\"p\">(</span><span class=\"bp\">self</span><span class=\"p\">):</span>\n    msg <span class=\"o\">=</span> <span class=\"s2\">&quot;Expected deprecation message&quot;</span>\n    <span class=\"k\">with</span> <span class=\"bp\">self</span><span class=\"o\">.</span>assertWarnsMessage<span class=\"p\">(</span>RemovedInDjangoXXXXWarning<span class=\"p\">,</span> msg<span class=\"p\">)</span> <span class=\"k\">as</span> ctx<span class=\"p\">:</span>\n        <span class=\"c1\"># invoke deprecated behavior</span>\n        <span class=\"o\">...</span>\n    <span class=\"bp\">self</span><span class=\"o\">.</span>assertEqual<span class=\"p\">(</span>ctx<span class=\"o\">.</span>filename<span class=\"p\">,</span> <span class=\"vm\">__file__</span><span class=\"p\">)</span>\n</code></pre></div>\n<p>It’s important to include a <code class=\"docutils literal notranslate\">RemovedInDjangoXXXXWarning</code> comment above code\nwhich has no warning reference, but will need to be changed or removed when the\ndeprecation ends. This could include hooks which have been added to keep the\nprevious behavior, or standalone items that are unnecessary or unused when the\ndeprecation ends. For example:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">import</span> <span class=\"nn\">warnings</span>\n<span class=\"kn\">from</span> <span class=\"nn\">django.utils.deprecation</span> <span class=\"kn\">import</span> RemovedInDjangoXXXXWarning<span class=\"p\">,</span> django_file_prefixes\n\n\n<span class=\"c1\"># RemovedInDjangoXXXXWarning.</span>\n<span class=\"k\">def</span> <span class=\"nf\">old_private_helper</span><span class=\"p\">():</span>\n    <span class=\"c1\"># Helper function that is only used in foo().</span>\n    <span class=\"k\">pass</span>\n\n\n<span class=\"k\">def</span> <span class=\"nf\">foo</span><span class=\"p\">():</span>\n    warnings<span class=\"o\">.</span>warn<span class=\"p\">(</span>\n        <span class=\"s2\">&quot;foo() is deprecated.&quot;</span><span class=\"p\">,</span>\n        category<span class=\"o\">=</span>RemovedInDjangoXXXXWarning<span class=\"p\">,</span>\n        skip_file_prefixes<span class=\"o\">=</span>django_file_prefixes<span class=\"p\">(),</span>\n    <span class=\"p\">)</span>\n    old_private_helper<span class=\"p\">()</span>\n    <span class=\"o\">...</span>\n</code></pre></div>\n<p>Pour terminer, il reste à appliquer quelques mises à jour de la documentation Django :</p>\n<ol class=\"arabic simple\">\n<li><p>Si la fonctionnalité existante est documentée, marquez-la comme obsolète dans la documentation en utilisant l’annotation <code class=\"docutils literal notranslate\">.. deprecated:: A.B</code>. Ajoutez une courte description ainsi qu’une note sur la procédure de mise à jour le cas échéant.</p></li>\n<li><p>Ajoutez une description du comportement obsolète et la procédure de mise à jour le cas échéant aux notes de publication actuelles (<code class=\"docutils literal notranslate\">docs/releases/A.B.txt</code>) sous le chapitre « Features deprecated in A.B ».</p></li>\n<li><p>Ajoutez une ligne dans la planification d’obsolescence (<code class=\"docutils literal notranslate\">docs/internals/deprecation.txt</code>) sous la version adéquate en indiquant le code qui sera supprimé.</p></li>\n</ol>\n<p>Once you have completed these steps, you are finished with the deprecation.\nIn each <a class=\"reference internal\" href=\"/fr/6.1/internals/release-process/#term-Feature-release\"><span class=\"xref std std-term\">feature release</span></a>, all\n<code class=\"docutils literal notranslate\">RemovedInDjangoXXXXWarning</code>s matching the new version are removed.</p>\n<p>The <code class=\"docutils literal notranslate\">django.utils.deprecation</code> module provides some helpful deprecation\nutilities, such as a <code class=\"docutils literal notranslate\">&#64;deprecate_posargs</code> decorator to assist with converting\npositional-or-keyword arguments to keyword-only. See the inline documentation\nin the module source.</p>\n</section>\n<section id=\"testing-with-a-django-project\">\n<h2>Testing with a Django project<a class=\"heading-anchor\" href=\"#testing-with-a-django-project\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>It’s important to test local changes using a Django project. This allows\nensuring that the changes behave as expected in a real environment, especially\nfor user-facing features such as templates, forms, or the admin.</p>\n<p>To do this:</p>\n<ol class=\"arabic simple\">\n<li><p>Create a virtual environment and <a class=\"reference internal\" href=\"/fr/6.1/intro/contributing/#intro-contributing-install-local-copy\"><span class=\"std std-ref\">install the cloned copy of Django in\neditable mode</span></a>.</p></li>\n<li><p>Set up a Django project outside the source tree (you can use the <a class=\"reference internal\" href=\"/fr/6.1/intro/tutorial01/\"><span class=\"doc\">first\npart of the tutorial</span></a> for guidance).</p></li>\n</ol>\n<p>With this setup, any changes made to the Django checkout will take effect\nimmediately in the test project, allowing manual testing of contributions\nagainst a new or existing app.</p>\n</section>\n<section id=\"javascript-contributions\">\n<h2>Contributions JavaScript<a class=\"heading-anchor\" href=\"#javascript-contributions\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Pour des informations sur les contributions JavaScript, consultez la documentation <a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/writing-code/javascript/#javascript-patches\"><span class=\"std std-ref\">Correctifs JavaScript</span></a>.</p>\n</section>\n<section id=\"optimization-patches\">\n<h2>Optimisation des correctifs<a class=\"heading-anchor\" href=\"#optimization-patches\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Les correctifs visant à produire une amélioration de performance doivent fournir des tests de performance démontrant l’impact avant et après le correctif et partager les commandes pour que les relecteurs puissent les reproduire.</p>\n<section id=\"django-asv-benchmarks\">\n<span id=\"id3\"></span><h3>Tests de performance <code class=\"docutils literal notranslate\">django-asv</code><a class=\"heading-anchor\" href=\"#django-asv-benchmarks\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><a class=\"reference external\" href=\"https://github.com/django/django-asv/\">django-asv</a> surveille la performance du code de Django au cours du temps. Ces tests peuvent être exécutés sur une requête de contribution en étiquetant la requête avec le mot <code class=\"docutils literal notranslate\">benchmark</code>. L’ajout de nouveaux tests de performance est hautement encouragé.</p>\n</section>\n</section>\n<section id=\"contribution-checklist\">\n<span id=\"patch-review-checklist\"></span><h2>Liste de contrôle de contribution<a class=\"heading-anchor\" href=\"#contribution-checklist\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Use this checklist to review a pull request. If this contribution would not be\n<a class=\"reference internal\" href=\"#trivial-change\"><span class=\"std std-ref\">considered trivial</span></a>, first ensure it has an accepted\nticket before proceeding with the review.</p>\n<p>If the pull request passes all the criteria below and is not your own, please\nset the « Triage Stage » on the corresponding Trac ticket to « Ready for checkin ».\nIf you’ve left comments for improvement on the pull request, please tick the\nappropriate flags on the Trac ticket based on the results of your review:\n« Patch needs improvement », « Needs documentation », and/or « Needs tests ». As time\nand interest permit, mergers do final reviews of « Ready for checkin » tickets\nand will either commit the changes or bump it back to « Accepted » if further\nwork needs to be done.</p>\n<p>If you’re looking to become a member of the <a class=\"reference external\" href=\"https://www.djangoproject.com/foundation/teams/#triage-review-team\">triage &amp; review team</a>, doing\nthorough reviews of contributions is a great way to earn trust.</p>\n<p>En recherche d’un correctif à relire ? Consultez la section « Patches needing review » du <a class=\"reference external\" href=\"https://dashboard.djangoproject.com/\">tableau de bord de développement de Django</a>.</p>\n<p>Vous recherchez une relecture pour votre requête de contribution ? Assurez-vous que les drapeaux Trac sur le ticket correspondant soient bien définis afin que le ticket apparaisse dans cette file d’attente.</p>\n<section id=\"all-tickets\">\n<h3>Tous les tickets<a class=\"heading-anchor\" href=\"#all-tickets\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p>La requête de contribution est-elle un seul commit fusionné avec un message respectant notre <a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/committing-code/#committing-guidelines\"><span class=\"std std-ref\">format des messages de commit</span></a>?</p></li>\n<li><p>Are you the patch author and a new contributor? Please add yourself to the\n<a class=\"extlink-source reference external\" href=\"https://github.com/django/django/blob/stable/6.1.x/AUTHORS\">AUTHORS</a> file. At your option, submit a\n<a class=\"reference external\" href=\"https://www.djangoproject.com/foundation/cla/\">Contributor License Agreement</a>.</p></li>\n<li><p>Does this have an accepted ticket on Trac? All contributions require a ticket\nunless the <a class=\"reference internal\" href=\"#trivial-change\"><span class=\"std std-ref\">change is considered trivial</span></a>.</p></li>\n</ul>\n</section>\n<section id=\"all-code-changes\">\n<h3>Toutes les modifications de code<a class=\"heading-anchor\" href=\"#all-code-changes\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p>Le <a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/writing-code/coding-style/\"><span class=\"doc\">style de code</span></a> correspond-il à nos standards ? Y a-t-il des erreurs <code class=\"docutils literal notranslate\">black</code>, <code class=\"docutils literal notranslate\">blacken-docs</code>, <code class=\"docutils literal notranslate\">flake8</code>, <code class=\"docutils literal notranslate\">isort</code> ou <code class=\"docutils literal notranslate\">zizmor</code>? Vous pouvez installer les crochets ref:pre-commit &lt;coding-style-pre-commit&gt; pour intercepter automatiquement ces erreurs.</p></li>\n<li><p>Si la modification n’est pas rétrocompatible d’une quelconque manière, existe-t-il une note de publication appropriée (dans <code class=\"docutils literal notranslate\">docs/releases/A.B.txt</code>) ?</p></li>\n<li><p>Est-ce que la suite de tests de Django passe ?</p></li>\n<li><p>If there is a <a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/writing-code/unit-tests/#code-coverage-on-pull-requests\"><span class=\"std std-ref\">code coverage report</span></a>\ncomment on the pull request, have you reviewed the missing coverage in\ncontext (considering database/platform-specific limitations)?</p></li>\n<li><p>If the change affects the Django admin or rendered HTML output, has\n<a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/accessibility/#accessibility-testing-baseline\"><span class=\"std std-ref\">accessibility testing</span></a> been done?</p></li>\n</ul>\n</section>\n<section id=\"documentation\">\n<h3>Documentation<a class=\"heading-anchor\" href=\"#documentation\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p>Est-ce que la documentation peut être construite sans erreur (<code class=\"docutils literal notranslate\">make html</code> ou <code class=\"docutils literal notranslate\">make.bat html</code> sur Windows, à partir du répertoire <code class=\"docutils literal notranslate\">docs</code>) ?</p></li>\n<li><p>Est-ce que la documentation respecte les lignes directrices de style d’écriture de <a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/writing-documentation/\"><span class=\"doc\">Écrire la documentation</span></a>?</p></li>\n<li><p>Y a-t-il des <a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/writing-documentation/#documentation-spelling-check\"><span class=\"std std-ref\">fautes d’orthographe</span></a>?</p></li>\n</ul>\n</section>\n<section id=\"bugs\">\n<h3>Bogues<a class=\"heading-anchor\" href=\"#bugs\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p>Y a-t-il un test de régression approprié (le test doit échouer avant l’application de la correction) ?</p></li>\n<li><p>S’il s’agit d’un bogue qui <a class=\"reference internal\" href=\"/fr/6.1/internals/release-process/#supported-versions-policy\"><span class=\"std std-ref\">est susceptible d’être rétroporté</span></a> vers la version stable de Django, existe-t-il une note de publication dans <code class=\"docutils literal notranslate\">docs/releases/A.B.C.txt</code>? Les corrections de bogues qui ne s’appliquent qu’à la branche <code class=\"docutils literal notranslate\">main</code> n’ont pas besoin d’une note de publication.</p></li>\n</ul>\n</section>\n<section id=\"new-features\">\n<h3>Nouvelles fonctionnalités<a class=\"heading-anchor\" href=\"#new-features\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<ul class=\"simple\">\n<li><p>Y a-t-il des tests qui « éprouvent » la totalité du nouveau code ?</p></li>\n<li><p>Existe-t-il une note de publication dans <code class=\"docutils literal notranslate\">docs/releases/A.B.txt</code>?</p></li>\n<li><p>La fonctionnalité est-elle documentée et est-elle <a class=\"reference internal\" href=\"/fr/6.1/internals/contributing/writing-documentation/#documenting-new-features\"><span class=\"std std-ref\">annotée convenablement</span></a> avec <code class=\"docutils literal notranslate\">.. versionadded:: A.B</code> ou <code class=\"docutils literal notranslate\">.. versionchanged:: A.B</code>?</p></li>\n</ul>\n</section>\n<section id=\"id4\">\n<h3>Obsolescence d’une fonctionnalité<a class=\"heading-anchor\" href=\"#id4\"><span class=\"visually-hidden\">Lien vers cette rubrique</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>Consultez le guide <a class=\"reference internal\" href=\"#deprecating-a-feature\"><span class=\"std std-ref\">Obsolescence d’une fonctionnalité</span></a>.</p>\n</section>\n</section>","rootId":"submitting-contributions","toc":[{"title":"Corrections orthographiques et modifications de documentation","anchor":"typo-fixes-and-trivial-documentation-changes","children":[]},{"title":"« Appropriation » de tickets","anchor":"claiming-tickets","children":[{"title":"Responsabilité des « possesseurs » de tickets","anchor":"ticket-claimers-responsibility","children":[]},{"title":"Quels sont les tickets qui devraient être attribués ?","anchor":"which-tickets-should-be-claimed","children":[]}]},{"title":"Style de contribution","anchor":"contribution-style","children":[{"title":"AI-Assisted Contributions","anchor":"ai-assisted-contributions","children":[{"title":"Automated AI Reviews","anchor":"automated-ai-reviews","children":[]},{"title":"Note for AI Tools","anchor":"note-for-ai-tools","children":[]}]}]},{"title":"Contributions demandant un retour de la communauté","anchor":"contributions-which-require-community-feedback","children":[{"title":"The new feature ideas tracker","anchor":"the-new-feature-ideas-tracker","children":[]},{"title":"Le forum Django","anchor":"the-django-forum","children":[]},{"title":"Paquet de tierce partie","anchor":"third-party-package","children":[]},{"title":"Proposition d’amélioration de Django (DEP)","anchor":"django-enhancement-proposal-dep","children":[]}]},{"title":"Obsolescence d’une fonctionnalité","anchor":"deprecating-a-feature","children":[]},{"title":"Testing with a Django project","anchor":"testing-with-a-django-project","children":[]},{"title":"Contributions JavaScript","anchor":"javascript-contributions","children":[]},{"title":"Optimisation des correctifs","anchor":"optimization-patches","children":[{"title":"Tests de performance django-asv","anchor":"django-asv-benchmarks","children":[]}]},{"title":"Liste de contrôle de contribution","anchor":"contribution-checklist","children":[{"title":"Tous les tickets","anchor":"all-tickets","children":[]},{"title":"Toutes les modifications de code","anchor":"all-code-changes","children":[]},{"title":"Documentation","anchor":"documentation","children":[]},{"title":"Bogues","anchor":"bugs","children":[]},{"title":"Nouvelles fonctionnalités","anchor":"new-features","children":[]},{"title":"Obsolescence d’une fonctionnalité","anchor":"id4","children":[]}]}],"breadcrumbs":[{"docname":"internals/index","title":"Fonctionnement interne du projet Django","url":"/fr/6.1/internals/"},{"docname":"internals/contributing/index","title":"Contribuer à Django","url":"/fr/6.1/internals/contributing/"},{"docname":"internals/contributing/writing-code/index","title":"Contribution au code","url":"/fr/6.1/internals/contributing/writing-code/"}],"prev":{"docname":"internals/contributing/writing-code/index","title":"Contribution au code","url":"/fr/6.1/internals/contributing/writing-code/"},"next":{"docname":"internals/contributing/writing-code/unit-tests","title":"Les tests unitaires","url":"/fr/6.1/internals/contributing/writing-code/unit-tests/"},"formats":{"html":"/fr/6.1/internals/contributing/writing-code/submitting-patches/","markdown":"/fr/6.1/internals/contributing/writing-code/submitting-patches.md","json":"/fr/6.1/internals/contributing/writing-code/submitting-patches.json"},"source":"https://github.com/django/django/blob/stable/6.1.x/docs/internals/contributing/writing-code/submitting-patches.txt","official":"https://docs.djangoproject.com/fr/6.1/internals/contributing/writing-code/submitting-patches/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10","1.9"],"inLocales":["en","sv","zh-hans","ga","fr","ja","id","it","pt-br","ko","es","el","pl"]}