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.
A instalação de alguns pacotes requeridos pelo Python:
$ 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
.
Se essa é uma feature release, garanta que as traduções do Transifex foram integradas. Isso é tipicamente realizado por um gerente de tradução separado ao invés do releaser, mas aqui vão os passos. Supondo que você tenha uma conta no Transifex:
$ python scripts/manage_translations.py fetch
e então faça commit da mudança/arquivos adicionados (.po e .mo). Algumas vezes existem validações de errros que precisam ser depurados, então evite fazer essa tarefa imediatamente antes de uma release ser necessária.
Atualize a página de manual do django-admin:
$ 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 3.1:
$ git checkout -b stable/3.1.x origin/main
$ git push origin -u stable/3.1.x:stable/3.1.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 2.2:
$ git checkout -b stable/2.2.x origin/stable/2.1.x
$ git push origin stable/2.2.x:stable/2.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.
Uma release sempre começa de uma branch de release, então você terá que se certificar que você está em uma branch estável e atualizada. Por exemplo:
$ git checkout stable/1.5.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/1.5.x
$ git merge --ff-only security/1.5.x
(This assumes security/1.5.x
is a branch in the django-security
repo
containing the necessary security patches for the next release in the 1.5
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/1.5.x; git rebase stable/1.5.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).
Para uma feature release, remova o cabeçalho UNDER DEVELOPMENT
no topo das notas da release e adicione a data da release na próxima linha. Para uma patch release, troque *Under Development*
, com a data da release. Faça essa mudança em todas as branches em que as notas de release para uma versão em particular estiverem localizadas.
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
.
Faça uma tag da release usando git tag
. Por exemplo:
$ git tag --sign --message="Tag 1.5.1" 1.5.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/
;
Gere os hashes dos pacotes da release:
$ 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/<<RELEASE TAR.GZ FILENAME>>
https://www.djangoproject.com/m/releases/<<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:
Faça upload do pacote (ou pacotes) da release para o servidor do djangoproject, trocando A.B. com o número de versão apropriado, ex. 1.5 para a release 1.5.x:
$ 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.
Atualize o(s) arquivo(s) de checksum:
$ 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 easy_install
and pip
. Here’s one method:
$ RELEASE_VERSION='1.7.2'
$ MAJOR_VERSION=`echo $RELEASE_VERSION| cut -c 1-3`
$ python -m venv django-easy-install
$ . django-easy-install/bin/activate
$ easy_install https://www.djangoproject.com/m/releases/$MAJOR_VERSION/Django-$RELEASE_VERSION.tar.gz
$ deactivate
$ 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.
Ask a few people on IRC to verify the checksums by visiting the checksums
file (e.g. https://media.djangoproject.com/pgp/Django-1.5b1.checksum.txt)
and following the instructions in it. For bonus points, they can also unpack
the downloaded release tarball and verify that its contents appear to be
correct (proper version numbers, no stray .pyc
or other undesirable
files).
Faça o upload dos pacotes da release para o PyPI (para pre-release, somente atualize o arquivo wheel):
$ twine upload -s dist/*
Vá para ` a página Add release no admin`__, entre com o número da nova release exatamente como ele aparece no nome da tarball (Django-<version>.tar.gz). Então entre com “1.5.1” ou “1.4c2”, etc. Se a release é parte de uma branch LTS, marque ele como tal.
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 3.1a1
, also create 3.1
with the Release date field blank.
Faça um post no blog anunciando que a release foi lançada.
Para uma nova versão de release (ex. 1.5, 1.6), atualize a versão estável padrão da documentação alterando a flag is_default
para True
no objeto DocumentRelease
apropriado no banco de dados de docs.djangoproject.com
(isso irá alterar automaticamente ela para False
para todos os outros); você pode fazer isso usando o site do 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 2.2:
$ git checkout stable/2.2.x
$ git pull
$ python manage_translations.py robots_txt
Post the release announcement to the django-announce, django-developers, and django-users mailing lists. 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
em django/__init__.py
novamente, incrementando ela para qualquer que seja a próxima release. Por exemplo, depois de soltar a release 1.5.1, atualize VERSION
para VERSION = (1, 5, 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
por cerca de 20% (escolha um número redondo). Rode os testes, e atualize os 3 testes falhos de hashers com os novos valores. Certifique-se de que isso seja registrado nas notas de release (veja as notas da release 1.8 para um exemplo)... versionadded::
, .. versionadded::
, e .. deprecated::
na documentação das duas releases anteriores. Por exemplo, no Django 1.9, notas para a 1.7 serão removidas.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:
(1, 2, 1, 'final', 0)
→ “1.2.1”(1, 3, 0, 'alpha', 0)
→ “1.3 pre-alpha”(1, 3, 0, 'beta', 2)
→ “1.3 beta 2”ago. 03, 2022