Este documento explica como fazer uma release do Django.
Por favor, mantenha essas instruções atualizadas se você fizer mudanças! A ideia aqui é ser descritivo, não prescritivo, então sinta-se à vontade para agilizar ou por outro lado fazer mudanças, mas atualize este documento de acordo
Existem três tipos de releases que você pode precisar fazer:
Uma curta versão dos passos envolvidos é a seguinte:
djangoproject.com
.djangoproject.com
.Existem vários detalhes, então por favor continue lendo.
Você vai precisar de algumas coisas antes de começar:
Uma chage GPG. Se a chave que você quer usar não é sua chave de assinatura padrão, você vai precisar adicionar -u you@example.com
para cada comando de assinatura GPG abaixo, onde you@example.com
é um endereço de email associado com a chave que você quer usar.
An install of some required Python packages:
$ python -m pip install wheel twine
Acesso ao registro do Django no PyPI. Criar um arquivo com suas credenciais:
~/.pypirc
¶[pypi]
username:YourUsername
password:YourPassword
Acessar o servidor de djangoproject.com
para atualizar os arquivos.
Acesso para o admin em djangoproject.com
como um “Site maintainer”.
Acesso para postar em django-announce
.
Se essa é uma release de segurança, acesso para a lista de distribuição de segurança.
If this is your first release, you’ll need to coordinate with another releaser to get all these things lined up.
Alguns itens precisam ser realizados antes mesmo de começar o processo de release. Isso começa por volta de uma semana antes da release; a maior parte dele pode ser feita a qualquer momento culminando na release em si:
If this is a security release, send out pre-notification one week before
the release. The template for that email and a list of the recipients are in
the private django-security
GitHub wiki. BCC the pre-notification
recipients. Sign the email with the key you’ll use for the release and
include CVE IDs (requested with Vendor:
djangoproject, Product: django) and patches for each issue being fixed.
Also, notify django-announce of the upcoming
security release.
À medida em que a release se aproxima, acompanhe o Track para se certificar de que nenhum problema que possa bloquear a release prestes a ser lançada tenha restado sem solução.
Check with the other mergers to make sure they don’t have any uncommitted changes for the release.
Proofread the release notes, including looking at the online version to catch any broken links or reST errors, and make sure the release notes contain the correct date.
Verifique duas vezes as menções de depreciação ao longo do tempo nas notas da release em busca de quaisquer APIs listadas como depreciadas, e que as notas mencionam quaisquer mudanças na versão suportada do Python.
Verifique duas vezes se o índice das notas de release possuem um link para as notas da nova release; isso estará em docs/releases/index.txt
.
If this is a feature release, ensure translations from Transifex have been integrated. This is typically done by a separate translation’s manager rather than the releaser, but here are the steps. Provided you have an account on Transifex:
$ python scripts/manage_translations.py fetch
and then commit the changed/added files (both .po
and .mo
).
Sometimes there are validation errors which need to be debugged, so avoid
doing this task immediately before a release is needed.
Update the django-admin manual page:
$ cd docs
$ make man
$ man _build/man/django-admin.1 # do a quick sanity check
$ cp _build/man/django-admin.1 man/django-admin.1
e então faça commit da página man alterada.
If this is the alpha release of a new series, create a new stable branch from main. For example, when releasing Django 4.2:
$ git checkout -b stable/4.2.x origin/main
$ git push origin -u stable/4.2.x:stable/4.2.x
At the same time, update the django_next_version
variable in
docs/conf.py
on the stable release branch to point to the new
development version. For example, when creating stable/4.2.x
, set
django_next_version
to '5.0'
on the new branch.
If this is the “dot zero” release of a new series, create a new branch from the current stable branch in the django-docs-translations repository. For example, when releasing Django 4.2:
$ git checkout -b stable/4.2.x origin/stable/4.1.x
$ git push origin stable/4.2.x:stable/4.2.x
Escreva o post no blog para o anúncio da release. Você pode entrar dentro do admin a qualquer momento e marcar ele como inativo. Aqui vão alguns exemplos: example security release announcement, example regular release announcement, example pre-release announcement.
OK, esta é a parte divertida, quando nós efetivamente fazemos o push da release!
Veja se o status do Jenkins é verde para a versão (ou versões) que você está soltando. Você provavelmente não deve lançar uma release enquanto ele não estiver com o status verde.
A release always begins from a release branch, so you should make sure you’re on a stable branch and up-to-date. For example:
$ git checkout stable/4.1.x
$ git pull
If this is a security release, merge the appropriate patches from
django-security
. Rebase these patches as necessary to make each one a
plain commit on the release branch rather than a merge commit. To ensure
this, merge them with the --ff-only
flag; for example:
$ git checkout stable/4.1.x
$ git merge --ff-only security/4.1.x
(This assumes security/4.1.x
is a branch in the django-security
repo
containing the necessary security patches for the next release in the 4.1
series.)
If git refuses to merge with --ff-only
, switch to the security-patch
branch and rebase it on the branch you are about to merge it into (git
checkout security/4.1.x; git rebase stable/4.1.x
) and then switch back and
do the merge. Make sure the commit message for each security fix explains
that the commit is a security fix and that an announcement will follow
(example security commit).
For a feature release, remove the UNDER DEVELOPMENT
header at the
top of the release notes and add the release date on the next line. For a
patch release, remove the Expected
prefix and update the release date,
if necessary. Make this change on all branches where the release notes for a
particular version are located.
Atualize o número da versão em django/__init__.py
para a release. Por favor veja as notas sobre configurando a tupla VERSION abaixo para mais detalhes sobre VERSION
.
If this is a pre-release package, update the “Development Status” trove
classifier in setup.cfg
to reflect this. Otherwise, make sure the
classifier is set to Development Status :: 5 - Production/Stable
.
Tag the release using git tag
. For example:
$ git tag --sign --message="Tag 4.1.1" 4.1.1
Você pode checar o seu trabalho rodando o comando git tag --verify <tag>
.
Faça o push do seu trabalho, incluindo a tag: git push --tags
.
Certifique-se de que você tem uma árvore absolutamente limpa rodando o comando git clean -dfx`.
Rodar make -f extras/Makefile
para gerar os pacotes da release. Isso criará os pacotes da release no diretório dist/
;
Generate the hashes of the release packages:
$ cd dist
$ md5sum *
$ sha1sum *
$ sha256sum *
Create a “checksums” file, Django-<<VERSION>>.checksum.txt
containing
the hashes and release information. Start with this template and insert the
correct version, date, GPG key ID (from
gpg --list-keys --keyid-format LONG
), release manager’s GitHub username,
release URL, and checksums:
This file contains MD5, SHA1, and SHA256 checksums for the source-code
tarball and wheel files of Django <<VERSION>>, released <<DATE>>.
To use this file, you will need a working install of PGP or other
compatible public-key encryption software. You will also need to have
the Django release manager's public key in your keyring. This key has
the ID ``XXXXXXXXXXXXXXXX`` and can be imported from the MIT
keyserver, for example, if using the open-source GNU Privacy Guard
implementation of PGP:
gpg --keyserver pgp.mit.edu --recv-key XXXXXXXXXXXXXXXX
or via the GitHub API:
curl https://github.com/<<RELEASE MANAGER GITHUB USERNAME>>.gpg | gpg --import -
Once the key is imported, verify this file:
gpg --verify <<THIS FILENAME>>
Once you have verified this file, you can use normal MD5, SHA1, or SHA256
checksumming applications to generate the checksums of the Django
package and compare them to the checksums listed below.
Release packages
================
https://www.djangoproject.com/m/releases/<<MAJOR VERSION>>/<<RELEASE TAR.GZ FILENAME>>
https://www.djangoproject.com/m/releases/<<MAJOR VERSION>>/<<RELEASE WHL FILENAME>>
MD5 checksums
=============
<<MD5SUM>> <<RELEASE TAR.GZ FILENAME>>
<<MD5SUM>> <<RELEASE WHL FILENAME>>
SHA1 checksums
==============
<<SHA1SUM>> <<RELEASE TAR.GZ FILENAME>>
<<SHA1SUM>> <<RELEASE WHL FILENAME>>
SHA256 checksums
================
<<SHA256SUM>> <<RELEASE TAR.GZ FILENAME>>
<<SHA256SUM>> <<RELEASE WHL FILENAME>>
Assine o arquivo de checksum (gpg --clearsign --digest-algo SHA256 Django-<version>.checksum.txt
). Isso gera um documento assinado, Django-<version>.checksum.txt.asc
que você pode então verificar usando gpg --verify Django-<version>.checksum.txt.asc
.
Se você estiver lançando múltiplas releases, repita esses passos para cada release.
Agora você está pronto para lançar a release efetivamente. Para isso faça:
Upload the release package(s) to the djangoproject server, replacing A.B. with the appropriate version number, e.g. 4.1 for a 4.1.x release:
$ scp Django-* djangoproject.com:/home/www/www/media/releases/A.B
If this is the alpha release of a new series, you will need to create the directory A.B.
Upload the checksum file(s):
$ scp Django-A.B.C.checksum.txt.asc djangoproject.com:/home/www/www/media/pgp/Django-A.B.C.checksum.txt
Test that the release packages install correctly using pip
. Here’s one
method:
$ RELEASE_VERSION='4.1.1'
$ MAJOR_VERSION=`echo $RELEASE_VERSION| cut -c 1-3`
$ python -m venv django-pip
$ . django-pip/bin/activate
$ python -m pip install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION.tar.gz
$ deactivate
$ python -m venv django-pip-wheel
$ . django-pip-wheel/bin/activate
$ python -m pip install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION-py3-none-any.whl
$ deactivate
Isso só verifica se as tarballs estão disponíveis (ex. redirecionamentos estão funcionando) e que eles instalaram corretamente, mas eles irão pegar erros bobos.
Run the confirm-release build on Jenkins to verify the checksum file(s)
(e.g. use 4.2rc1
for
https://media.djangoproject.com/pgp/Django-4.2rc1.checksum.txt).
Upload the release packages to PyPI (for pre-releases, only upload the wheel file):
$ twine upload -s dist/*
Go to the Add release page in the admin, enter the new release number
exactly as it appears in the name of the tarball
(Django-<version>.tar.gz
). So for example enter “4.1.1” or “4.2rc1”,
etc. If the release is part of an LTS branch, mark it so.
If this is the alpha release of a new series, also create a Release object
for the final release, ensuring that the Release date field is blank,
thus marking it as unreleased. For example, when creating the Release
object for 4.2a1
, also create 4.2
with the Release date field blank.
Faça um post no blog anunciando que a release foi lançada.
For a new version release (e.g. 4.1, 4.2), update the default stable version
of the docs by flipping the is_default
flag to True
on the
appropriate DocumentRelease
object in the docs.djangoproject.com
database (this will automatically flip it to False
for all
others); you can do this using the site’s admin.
Create new DocumentRelease
objects for each language that has an entry
for the previous release. Update djangoproject.com’s robots.docs.txt
file by copying entries from manage_translations.py robots_txt
from the
current stable branch in the django-docs-translations
repository. For
example, when releasing Django 4.2:
$ git checkout stable/4.2.x
$ git pull
$ python manage_translations.py robots_txt
Post the release announcement to the django-announce, django-developers, django-users mailing lists, and the Django Forum. This should include a link to the announcement blog post.
If this is a security release, send a separate email to oss-security@lists.openwall.com. Provide a descriptive subject, for example, “Django” plus the issue title from the release notes (including CVE ID). The message body should include the vulnerability details, for example, the announcement blog post text. Include a link to the announcement blog post.
Add a link to the blog post in the topic of the #django
IRC channel:
/msg chanserv TOPIC #django new topic goes here
.
Você quase terminou! Tudo que resta a fazer agora é:
VERSION
tuple in django/__init__.py
again,
incrementing to whatever the next expected release will be. For
example, after releasing 4.1.1, update VERSION
to
VERSION = (4, 1, 2, 'alpha', 0)
.default_version
setting in the
code.djangoproject.com’s trac.ini, if it’s a final release). The new X.Y
version should be added after the alpha release and the default version
should be updated after “dot zero” release.Existem várias coisas para fazer no momento posterior a criação de uma nova branch estável (geralmente após uma alpha release). Algumas dessas tarefas não precisam ser feitas pelo releaser.
DocumentRelease
no banco de dados de docs.djangoproject.com
para a nova versão da documentação, e atualize o JSON fixture docs/fixtures/doc_releases.json
, para que pessoas sem acesso ao DB de produção possam ainda rodar uma cópia atualizada do site da documentação.django.contrib.auth.hashers.PBKDF2PasswordHasher
by about 20%
(pick a round number). Run the tests, and update the 3 failing
hasher tests with the new values. Make sure this gets noted in the
release notes (see the 4.1 release notes for an example)... versionadded::
, .. versionadded::
, and .. deprecated::
annotations in the documentation from two releases ago. For example, in
Django 4.2, notes for 4.0 will be removed.Framework :: Django :: 3.1
.O reporte de versões do Django é controlado por uma tupla VERSION
em django/__init__.py
. Essa é uma tupla de cinco elementos, cujos elementos são:
Para uma release final, o status é sempre “final” e o número das séries é sempre 0. Um número de séries 0 com um status “alpha” será reportado como “pre-alpha”.
Alguns exemplos:
(4, 1, 1, "final", 0)
→ “4.1.1”(4, 2, 0, "alpha", 0)
→ “4.2 pre-alpha”(4, 2, 0, "beta", 1)
→ “4.2 beta 1”dez. 04, 2023