You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/lessons/05-python-packaging/index.md
+36-40Lines changed: 36 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@ To add packages that are automatically installed when we install our package we
64
64
~~~
65
65
...
66
66
install_requires=[
67
-
'packaage1>=1.0',
67
+
'package1>=1.0',
68
68
'package2'
69
69
],
70
70
...
@@ -75,100 +75,96 @@ To add packages that are automatically installed when we install our package we
75
75
Check the code dependencies and add them to `setup.py`...
76
76
77
77
### requirements.txt
78
-
79
-
Muitos softwares usam também um arquivo *requirements.txt* para listar **todas** as dependências do software de modo a obter uma instalação idêntica à do desenvolvedor. Isto é importante para uniformizar os ambientes de desenvolvimento. Ou seja, este arquivo nunca será usado por usuários finais.
78
+
80
79
Many software also use a *requirements.txt* file to list **all** software dependencies in order to obtain a installation identical to that of developer. This is important to standardize development environments. This file will never be used by end users.
81
80
82
81
!!! exercise
83
82
Create a *requirements.txt* file for your project with the same dependencies listed on your *setup.py*.
84
83
85
84
### Runnable Scripts
86
85
87
-
Além de instalar o nosso módulo para uso via `import` desejamos também disponibilizar o arquivo *hello.py* como um executável para todo o sistema. Isto pode ser feito adicionando a seguinte linha no nosso *setup.py* indicando que *scripts/hello.py* deverá ser instalado como um executável.
88
-
89
-
In addition to installing our module for use *via*`import`, we also want to make *hello.py* file available as an executable for entire system. This can be done by adding the following line to our *setup.py* indicating that *scripts/hello.py* should be installed as an executable.
86
+
In addition to install our module for using `import`, we also want to make *hello.py* file available as an executable file for entire system. This can be done by adding the following line to our *setup.py* indicating that *scripts/hello.py* should be installed as an executable.
90
87
91
88
~~~
92
89
...
93
90
scripts=['scripts/hello.py'],
94
91
...
95
92
~~~
96
93
97
-
Não se esqueça de adicionar a seguinte linha no topo de seu arquivo para que ele possa ser executado diretamente do shell:
94
+
Don't forget to add the following line to the top of your file so it can be run directly from shell:
98
95
99
96
~~~
100
97
#!/usr/bin/env python3
101
98
~~~
102
99
103
-
No Windows é criado um executável que chama nosso script, de modo que as chamadas do executável continuarão funcionando normalmente. Note que isto não cria menus em nenhum tipo de interface gráfica.
100
+
On Windows, an executable is created that runs our script, so that executable calls will work normally. Note that this does not create any type of graphical interface.
104
101
105
-
### Criando arquivos de distribuição
102
+
### Creating distribution files
106
103
107
-
Dois tipos de arquivos de distribuição podem ser usados:
104
+
Two types of distribution files can be used:
108
105
109
-
- sdist: é um arquivo contendo os fontes do projeto, incluindo arquivos adicionais especificados usando o argumento `data_files`. Usado se seu projeto for Python-puro.
110
-
- wheel: é um formato pré-compilado e específico para cada plataforma. Mais usado quando o projeto contém extensões em *C*.
106
+
-**sdist**: This file contains project's source code, including additional files specified by using `data_files` argument. This is used if your project is pure Python (only written in Python).
107
+
-**wheel**: This is a precompiled, platform-specific format. Most commonly used when the project contains *C language* extensions.
111
108
112
-
A criação de um arquivo de distribuição de fontes é bem simples:
109
+
Creating a source code distribution file is quite simple:
113
110
114
111
<ah-terminal>
115
-
$ python setup.py sdist
112
+
$ python setup.py sdist
116
113
</ah-terminal>
117
-
118
-
A instalação deste pacote pode ser feita via `pip`.
119
114
120
-
### Envio para o PyPI
115
+
This package can be installed by `pip`.
121
116
122
-
Vamos agora enviar nosso pacote para o *Python Package Index* para que ele possa ser instalado diretamente via `pip`. Para não poluir o repositório com pacotes temporários e de teste, podemos usar o *TestPyPI*. Toda sua infraestrutura é igual ao oficial, mas ele é limpo de maneira regular.
117
+
### Uploading to PyPI
123
118
124
-
Visite [https://test.pypi.org/account/register/](https://test.pypi.org/account/register/) e registre-se no *TestPyPI*.
119
+
Now let's upload our package to *Python Package Index*; so it can be installed directly by `pip`. To avoid cluttering the repository with temporary and test packages, we can use *TestPyPI*. Its entire infrastructure is the same as the official one, but it is cleaned regularly.
125
120
126
-
Após o registro, usaremos o pacote *twine* (instalável via *pip*) para fazer o upload:
121
+
Visit [https://test.pypi.org/account/register/](https://test.pypi.org/account/register/) and register yourself on *TestPyPI*.
127
122
123
+
After registration, we'll use the *twine* package (installable by *pip*) to upload:
Vamos agora trabalhar (em duplas) no Servidor de Desafios novamente. Seu trabalho será criar um `Dockerfile` que roda o software de maneira "completa". Ou seja, o script de criação do container deverá
147
+
Now we'll work (in pairs) on the *Challenge Server* again. Your job will be to create a Dockerfile that runs this software *completely*. In other words, container creation script must:
152
148
153
-
-[ ]instalar todas as dependências do sistema
154
-
-[ ]criar a base de dados, se necessário
155
-
-[ ]adicionar os usuários presentes no arquivo `users.csv`, se necessário
156
-
-[ ]executar o servidor e serví-lo na porta `8080`do `host`
157
-
-[ ]manter os dados adicionados ao reiniciar o container
149
+
-[ ]install all system dependencies
150
+
-[ ]create database, if it is necessary
151
+
-[ ]add all users present in `users.csv` file, if it is necessary
152
+
-[ ]run server on host port `8080`
153
+
-[ ]retain added data when restarting the container
158
154
159
-
### Entrega
155
+
### Deliver this assignment
160
156
161
-
Faça a entrega de sua atividade adicionando a skill *Dockerfile*segundo o modelo abaixo.
157
+
Deliver your activity by adding skill *Dockerfile*according to template below:
0 commit comments