Fixes for Py3 compatibility and dead links.
This commit is contained in:
parent
958f8b43d7
commit
7a1507644f
28 changed files with 42 additions and 932 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -3,3 +3,6 @@
|
|||
*.egg-info/
|
||||
*.pyc
|
||||
local/
|
||||
venv/
|
||||
.vscode/
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
2.7.13
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
title: Implementación de mktime en Batavia o por qué CPython es una mejor opción para la construcción de una máquina del tiempo
|
||||
---
|
||||
author: Jacob Stoebel
|
||||
---
|
||||
description: La función de Python `mktime` nos indica cuántos segundos tiene una fecha y hora desde un punto de referencia (*epoch*). Se basa en una función en C del mismo nombre y mientras esto hace que se ejecute rápidamente, también significa que es dependiente de la plataforma. El objetivo de Batavia es llevar a Python al navegador web, lo que significa que las dependencias de plataformas deben ser eliminadas.
|
||||
---
|
||||
pub_date: 2016-10-16
|
||||
---
|
||||
resource_type: article
|
||||
---
|
||||
url: http://www.jstoebel.com/implementing-mktime-in-batavia/
|
||||
---
|
||||
_slug: implementando-mktime
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
author: Jacob Stoebel
|
||||
---
|
||||
description: A função do Python mktime nos diz quantos segundos um datetime está da sua época. Ele é baseado na função C com o mesmo nome e, enquanto isso a torna rápida, também gera dependência de plataforma. O objetivo do Batavia de levar o Python para os browser web significa que dependências de plataforma precisam ser removidas.
|
||||
---
|
||||
pub_date: 2016-10-16
|
||||
---
|
||||
resource_type: article
|
||||
---
|
||||
title: Implementando mktime no Batavia ou porque CPython é a melhor escolha para construir uma máquina do tempo
|
||||
---
|
||||
url: http://www.jstoebel.com/implementing-mktime-in-batavia/
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
title: Implementing mktime in Batavia or why CPython is a better choice for building a time machine
|
||||
---
|
||||
author: Jacob Stoebel
|
||||
---
|
||||
description: The Python function mktime tells us how many seconds a datetime is from the epoch. It is based on the C function of the same name and while this makes it run fast, it also means it is platform dependent. The goal of Batavia is to bring Python to the web browser meaning platform dependencies need to be ironed out.
|
||||
---
|
||||
pub_date: 2016-10-16
|
||||
---
|
||||
resource_type: article
|
||||
---
|
||||
url: http://www.jstoebel.com/implementing-mktime-in-batavia/
|
||||
|
|
@ -20,7 +20,7 @@ Pero Colosseum como proyecto tiene muchos otros posibles usos. Se puede usar en
|
|||
|
||||
La implementación actual se basa en el proyecto de Facebook `yoga <https://github.com/facebook/yoga>`__: originalmente era un código portado de JavaScript a Python línea a línea. Sin embargo, yoga solo implementa la sección de Flexbox de la especificación CSS3.
|
||||
|
||||
Esta semana, comenzamos un gran proyecto: reescribir Colosseum para que sea un motor de CSS totalmente compatible. El trabajo hasta ahora se puede encontrar en `la rama globo del repositorio Colosseum en Github <https://github.com/beeware/colosseum/tree/globe>`__. El primer objetivo es el cumplimiento de CSS2.1, con una implementación del modelo de caja de CSS tradicional y el diseño de flujo. Una vez que tengamos una implementación razonable de eso, buscaremos agregar diseños Grid y FlexBox desde el conjunto de especificaciones CSS3.
|
||||
Esta semana, comenzamos un gran proyecto: reescribir Colosseum para que sea un motor de CSS totalmente compatible. El trabajo hasta ahora se puede encontrar en la rama globo del repositorio Colosseum en Github. El primer objetivo es el cumplimiento de CSS2.1, con una implementación del modelo de caja de CSS tradicional y el diseño de flujo. Una vez que tengamos una implementación razonable de eso, buscaremos agregar diseños Grid y FlexBox desde el conjunto de especificaciones CSS3.
|
||||
|
||||
Esto es obviamente un trabajo grande. `CSS es una gran especificación <https://www.w3.org/TR/CSS/#css-levels>`__, por lo que hay mucho trabajo por hacer, ¡pero eso también significa que hay muchos lugares para contribuir! Elije un párrafo de la especificación CSS, construye algunos casos de prueba que demuestren los casos descritos en ese párrafo y envía un parche que implemente ese comportamiento!
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ But Colosseum as a project has many other possible uses. It could be used anywhe
|
|||
|
||||
The current implementation is based on Facebook's `yoga <https://github.com/facebook/yoga>`__ project - it was originally a line-for-line port of yoga's javascript codebase into Python. However, yoga only implements the Flexbox portion of the CSS3 specification.
|
||||
|
||||
This week, we started a big project: rewriting Colosseum to be a fully standard-compliant CSS engine. The work so far can be found in the `globe branch of the colosseum repository on Github <https://github.com/beeware/colosseum/tree/globe>`__. The first goal is CSS2.1 compliance, with an implementation of the traditional CSS box model and flow layout. Once we've got a reasonable implementation of that, we'll look to adding Grid and FlexBox layouts from the CSS3 specification set.
|
||||
This week, we started a big project: rewriting Colosseum to be a fully standard-compliant CSS engine. The work so far can be found in the globe branch of the colosseum repository on Github. The first goal is CSS2.1 compliance, with an implementation of the traditional CSS box model and flow layout. Once we've got a reasonable implementation of that, we'll look to adding Grid and FlexBox layouts from the CSS3 specification set.
|
||||
|
||||
This is obviously a big job. `CSS is a big specification <https://www.w3.org/TR/CSS/#css-levels>`__, so there's a lot of work to be done - but that also means there's lots of places to contribute! Pick a paragraph of the CSS specification, build some test cases that demonstrate the cases described in that paragraph, and submit a patch implementing that behaviour!
|
||||
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
name: Briefcase
|
||||
---
|
||||
project_type: tool
|
||||
---
|
||||
maturity: beta
|
||||
---
|
||||
languages: py
|
||||
---
|
||||
platforms: macOS, iOS, android, tvOS, win
|
||||
---
|
||||
short_description: أدوات لتحويل مشروع بايثون إلى تطبيق أصلي مستقل.
|
||||
---
|
||||
description:
|
||||
|
||||
A distutils extension to assist in packaging Python projects as standalone applications.
|
||||
|
||||
Briefcase is a tool for converting a Python project into a standalone native application. You can package projects for:
|
||||
|
||||
* Mac
|
||||
* Windows
|
||||
* Linux
|
||||
* iPhone/iPad
|
||||
* Android
|
||||
* AppleTV
|
||||
* tvOS.
|
||||
|
||||
Broadly supports Python 3. Note: exact versions supported vary depending on the platform being targeted.
|
||||
|
||||
Start learning Briefcase with the `Getting Started`_ guide, or jump right in with our `Quickstart`_.
|
||||
|
||||
.. _Getting Started: https://briefcase.readthedocs.io/en/latest/tutorial/getting-started.html
|
||||
.. _Quickstart: https://briefcase.readthedocs.io/en/latest/background/quickstart.html
|
||||
|
||||
---
|
||||
help_required:
|
||||
|
||||
Briefcase is part of the BeeWare suite.
|
||||
|
||||
If you experience problems with Briefcase, log them on `GitHub`_ . If you want to contribute code, please `fork`_ the code and submit a `pull request`_.
|
||||
|
||||
.. _GitHub: https://github.com/beeware/briefcase/issues
|
||||
.. _fork: https://github.com/beeware/briefcase
|
||||
.. _pull request: https://github.com/beeware/briefcase/pulls
|
||||
|
||||
|
||||
incomplete: yes
|
||||
---
|
||||
rtfd_name: briefcase
|
||||
---
|
||||
customlogo: yes
|
||||
---
|
||||
showcase: yes
|
||||
---
|
||||
image: briefcase.png
|
||||
---
|
||||
github_repo: beeware/briefcase
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
name: Briefcase
|
||||
---
|
||||
project_type: tool
|
||||
---
|
||||
maturity: beta
|
||||
---
|
||||
languages: py
|
||||
---
|
||||
platforms: macOS, iOS, android, tvOS, win
|
||||
---
|
||||
short_description: Herramientas para soportar la conversión de un proyecto Python en una aplicación nativa autónoma.
|
||||
---
|
||||
description:
|
||||
|
||||
Una extensión de distutils para ayudar en el empaquetado de proyectos de Python como aplicaciones independientes.
|
||||
|
||||
Briefcase es una herramienta para convertir un proyecto de Python en una aplicación nativa autónoma. Puede empaquetar proyectos para:
|
||||
|
||||
* Mac
|
||||
* Windows
|
||||
* Linux
|
||||
* iPhone / iPad
|
||||
* Android
|
||||
* Apple TV
|
||||
* tvOS.
|
||||
|
||||
Soporta ampliamente Python 3. Nota: las versiones exactas compatibles varían dependiendo de la plataforma para la cual se está empaquetando.
|
||||
|
||||
Comienza a aprender Briefcase con la guía `Primeros pasos`_, o entra directamente a nuestra `Guía rápida`_.
|
||||
|
||||
.. _Primeros pasos: https://briefcase.readthedocs.io/en/latest/tutorial/getting-started.html
|
||||
.. _Guía rápida: https://briefcase.readthedocs.io/en/latest/background/quickstart.html
|
||||
---
|
||||
help_required:
|
||||
|
||||
Briefcase hace parte de la suite BeeWare.
|
||||
|
||||
Si experimentas problemas con Briefcase, repórtalos en `GitHub`_ . Si quieres contribuir al código, realiza un `fork`_ del repositorio y envía un `pull request`_.
|
||||
|
||||
.. _GitHub: https://github.com/beeware/briefcase/issues
|
||||
.. _fork: https://github.com/beeware/briefcase
|
||||
.. _pull request: https://github.com/beeware/briefcase/pulls
|
||||
|
||||
|
||||
Incompleto: si
|
||||
---
|
||||
rtfd_name: briefcase
|
||||
---
|
||||
customlogo: yes
|
||||
---
|
||||
showcase: yes
|
||||
---
|
||||
_slug:
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
_model: page
|
||||
---
|
||||
incomplete: no
|
||||
---
|
||||
sort_key: 2
|
||||
---
|
||||
title: ... escribe una aplicación nativa de Android
|
||||
---
|
||||
body:
|
||||
|
||||
El lenguaje de implementación preferido de Android es Java, así que si quieres escribir una aplicación de Android en Python, necesitas tener una forma de ejecutar tu código de Python en una Máquina Virtual Java. Esto es lo que `VOC`_ hace. VOC es un transpilador - toma el árbol de sintaxis abstracta - AST (por sus sigas en inglés) de Python, y lo convierte a bytecode compatible con Java. El resultado final es que los archivos de código fuente de Python se compilan *directamente* en un archivo Java `.class`, que se puede empaquetar en una aplicación de Android.
|
||||
|
||||
VOC también le permite acceder a los objetos Java nativos como si fueran objetos Python, implementar interfaces Java con clases Python y subclases de Java con clases Python. Usando esto, puede escribir una aplicación de Android directamente usando las API de Android nativas.
|
||||
|
||||
Una vez que hayas escrito tu aplicación de Android nativa, puedes usar `Briefcase`_ para empaquetar tu código de Python como una aplicación de Android. Briefcase toma la definición de `setup.py` de distutils para su proyecto de Python, y usa esos metadatos para generar un proyecto base de Android, compilar su código de Python y colocar los artefactos compilados para que se encuentren cuando ejecute su proyecto de Android. El proyecto de stub se genera utilizando la `Plantilla Python para Android`_.
|
||||
|
||||
Sigue el tutorial `en los documentos de Briefcase <https://briefcase.readthedocs.io/en/latest/tutorial/getting-started.html>`__ para empezar!
|
||||
|
||||
.. _VOC: /es/proyecto/proyectos/puentes/voc
|
||||
.. _Briefcase: /es/proyecto/proyectos/herramientas/briefcase
|
||||
.. _Plantilla Python para Android: /es/proyecto/proyectos/plantillas/plantilla-python-android
|
||||
---
|
||||
gutter:
|
||||
|
||||
Proyectos relevantes
|
||||
---------------------------
|
||||
|
||||
.. image:: /project/projects/bridges/voc/voc.png
|
||||
:alt: VOC icon
|
||||
:align: left
|
||||
:height: 32px
|
||||
|
||||
`VOC`_
|
||||
|
||||
.. image:: /project/projects/tools/briefcase/briefcase.png
|
||||
:alt: Briefcase icon
|
||||
:align: left
|
||||
:height: 32px
|
||||
|
||||
`Briefcase`_
|
||||
|
||||
.. image:: /static/images/defaultlogo.png
|
||||
:alt: Python Android template icon
|
||||
:height: 32px
|
||||
:align: left
|
||||
|
||||
`Plantilla Python para Android`_
|
||||
|
||||
.. _VOC: /es/proyecto/proyectos/puentes/voc
|
||||
.. _Briefcase: /es/proyecto/proyectos/herramientas/briefcase
|
||||
.. _Plantilla Python para Android: /es/proyecto/proyectos/plantillas/plantilla-python-android
|
||||
|
||||
---
|
||||
_slug: aplicacion-android
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
_model: page
|
||||
---
|
||||
incomplete: no
|
||||
---
|
||||
sort_key: 2
|
||||
---
|
||||
title: ...write a native Android app
|
||||
---
|
||||
body:
|
||||
|
||||
Android's preferred language of implementation is Java - so if you want to write an Android application in Python, you need to have a way to run your Python code on a Java Virtual Machine. This is what `VOC`_ does. VOC is a transpiler - it takes Python source code, compiles it to CPython Bytecode, and then transpiles that bytecode into Java-compatible bytecode. The end result is that your Python source code files are compiled *directly* to a Java `.class` file, which can be packaged into an Android application.
|
||||
|
||||
VOC also allows you to access native Java objects as if they were Python objects, implement Java interfaces with Python classes, and subclass Java classes with Python classes. Using this, you can write an Android application directly against the native Android APIs.
|
||||
|
||||
Once you've written your native Android application, you can use `Briefcase`_ to package your Python code as an Android application. Briefcase takes the distutils `setup.py` definition for your Python project, and uses that metadata to generate a stub Android project, compile your Python code, and place the compiled artefacts so that they will be found when you run your Android project. The stub project is generated using the `Python Android template`_.
|
||||
|
||||
Follow the `tutorial in the briefcase docs <https://briefcase.readthedocs.io/en/latest/tutorial/getting-started.html>`__ to get started!
|
||||
|
||||
.. _VOC: /project/projects/bridges/voc
|
||||
.. _Briefcase: /project/projects/tools/briefcase
|
||||
.. _Python Android template: /project/projects/templates/python-android-template
|
||||
|
||||
---
|
||||
gutter:
|
||||
|
||||
Relevant projects
|
||||
------------------
|
||||
|
||||
.. image:: /project/projects/bridges/voc/voc.png
|
||||
:alt: VOC icon
|
||||
:align: left
|
||||
:height: 32px
|
||||
|
||||
`VOC`_
|
||||
|
||||
.. image:: /project/projects/tools/briefcase/briefcase.png
|
||||
:alt: Briefcase icon
|
||||
:align: left
|
||||
:height: 32px
|
||||
|
||||
`Briefcase`_
|
||||
|
||||
.. image:: /static/images/defaultlogo.png
|
||||
:alt: Python Android template icon
|
||||
:height: 32px
|
||||
:align: left
|
||||
|
||||
`Python Android template`_
|
||||
|
||||
.. _VOC: /project/projects/bridges/voc
|
||||
.. _Briefcase: /project/projects/tools/briefcase
|
||||
.. _Python Android template: /project/projects/templates/python-android-template
|
||||
|
||||
|
|
@ -6,7 +6,12 @@ title: Cómo utilizar BeeWare
|
|||
---
|
||||
body:
|
||||
|
||||
La suite BeeWare se compone de una gran cantidad de proyectos - muchos, así que es fácil de confundirse y no saber por dónde empezar. Aquí te damos una guía útil.
|
||||
La suite BeeWare está compuesta por muchos proyectos, tantos, que es fácil
|
||||
confundirse y no saber por dónde empezar.
|
||||
|
||||
El mejor lugar para comenzar es el `Tutorial de BeeWare
|
||||
<https://beeware.readthedocs.io>` __. Le guiará a través del proceso de
|
||||
creación de una aplicación utilizando el conjunto de herramientas BeeWare.
|
||||
|
||||
Quiero...
|
||||
==========
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
name: 使用 Beeware 系列軟體
|
||||
---
|
||||
summary: 你需要 BeeWare 軟體系列的哪些部分?
|
||||
---
|
||||
title: 如何使用 BeeWare
|
||||
---
|
||||
body:
|
||||
|
||||
BeeWare 軟體系列是由許多專案組成,多到可能讓人困惑,不知從何開始。下面是個簡單的指引。
|
||||
|
||||
我想要⋯⋯
|
||||
============
|
||||
|
||||
---
|
||||
sort_key: 3
|
||||
|
|
@ -1,15 +1,17 @@
|
|||
name: Using the Beeware Suite
|
||||
---
|
||||
summary: What pieces of the BeeWare suite do you need to use?
|
||||
summary: How do I get started using the BeeWare tools?
|
||||
---
|
||||
title: How to use BeeWare
|
||||
---
|
||||
body:
|
||||
|
||||
The BeeWare suite is made up of a lot of projects - so many, that it's easy to get confused and not know where to start. So - here's a helpful guide.
|
||||
The BeeWare suite is made up of a lot of projects - so many, that it's easy to
|
||||
get confused and not know where to start.
|
||||
|
||||
I want to...
|
||||
============
|
||||
The best place to start is the `BeeWare Tutorial
|
||||
<https://beeware.readthedocs.io>`__. It will walk you through the process
|
||||
of creating an application using the BeeWare suite of tools.
|
||||
|
||||
---
|
||||
sort_key: 3
|
||||
|
|
|
|||
|
|
@ -1,80 +0,0 @@
|
|||
_model: page
|
||||
---
|
||||
incomplete: no
|
||||
---
|
||||
sort_key: 3
|
||||
---
|
||||
title: ... escribe una aplicación para multi-plataforma para dispositivos móviles
|
||||
---
|
||||
body:
|
||||
|
||||
Para desarrollar una aplicación móvil multi-plataforma, debes utilizar un conjunto de herramientas de widgets multi-plataforma: `Toga`_. Toga abstrae las diferencias entre las distintas plataformas móviles, proporcionando una API común en Python para el desarrollo de aplicaciones.
|
||||
|
||||
Esta API utiliza las capacidades de `Rubicon`_ y `VOC`_ para acceder a bibliotecas de sistemas nativos. Rubicon es una librería puente que te da acceso transparente a todas las clases nativas de Objective C que proporciona iOS. VOC, por otro lado es un transpilador - toma el código fuente de Python, lo compila a un árbol de sintaxis abstracta, AST (por sus siglas en inglés) y luego transpila ese AST en bytecode compatible con Java. El resultado final es que los archivos de código fuente de Python se compilan *directamente* en un archivo Java `.class`, que se puede empaquetar en una aplicación de Android. VOC también le permite acceder a los objetos Java nativos como si fueran objetos Python, implementar interfaces Java con clases en Python y subclases de Java con clases Python. Utilizando esto, puedes escribir una aplicación de Android directamente usando las API de Android nativas.
|
||||
|
||||
Una vez que hayas escrito tu aplicación móvil, puedes usar `Briefcase`_ para empaquetar tu código Python para plataformas específicas. Briefcase toma la definición de `config.py` de distutils para tu proyecto de Python, y usa esa metadata para generar un proyecto de iOS o Android, compilar tu código de Python y ubicar los artefactos compilados para que se encuentren cuando se ejecute la aplicación. El proyecto de base se genera utilizando la `Plantilla Python para iOS`_ y la `Plantilla Python para Android`_.
|
||||
|
||||
Sigue el tutorial `en los documentos de Briefcase <https://briefcase.readthedocs.io/en/latest/tutorial/getting-started.html>`__ para empezar!
|
||||
|
||||
.. _Toga: /es/proyecto/proyectos/librerias/toga
|
||||
.. _Rubicon: /es/proyecto/proyectos/puentes/rubicon
|
||||
.. _VOC: /es/proyecto/proyectos/puentes/voc
|
||||
.. _Briefcase: /es/proyecto/proyectos/herramientas/briefcase
|
||||
.. _Plantilla Python para Android: /es/proyecto/proyectos/plantillas/plantilla-python-android
|
||||
.. _Plantilla Python para iOS: /es/proyecto/proyectos/plantillas/plantilla-python-ios
|
||||
---
|
||||
gutter:
|
||||
|
||||
Proyectos relevantes
|
||||
---------------------------
|
||||
|
||||
.. image:: /project/projects/libraries/toga/toga.png
|
||||
:height: 32px
|
||||
:alt: Toga icon
|
||||
:align: left
|
||||
|
||||
`Toga`_
|
||||
|
||||
.. image:: /project/projects/bridges/rubicon/rubicon.png
|
||||
:height: 32px
|
||||
:alt: Rubicon icon
|
||||
:align: left
|
||||
|
||||
`Rubicon`_
|
||||
|
||||
.. image:: /project/projects/bridges/voc/voc.png
|
||||
:height: 32px
|
||||
:alt: VOC icon
|
||||
:align: left
|
||||
|
||||
`VOC`_
|
||||
|
||||
.. image:: /project/projects/tools/briefcase/briefcase.png
|
||||
:height: 32px
|
||||
:alt: Briefcase icon
|
||||
:align: left
|
||||
|
||||
`Briefcase`_
|
||||
|
||||
.. image:: /static/images/defaultlogo.png
|
||||
:alt: Python iOS template icon
|
||||
:height: 32px
|
||||
:align: left
|
||||
|
||||
`Plantilla Python para iOS`_
|
||||
|
||||
.. image:: /static/images/defaultlogo.png
|
||||
:alt: Python Android template icon
|
||||
:height: 32px
|
||||
:align: left
|
||||
|
||||
`Plantilla Python para Android`_
|
||||
|
||||
.. _Toga: /project/projects/libraries/toga
|
||||
.. _Rubicon: /project/projects/bridges/rubicon
|
||||
.. _VOC: /project/projects/bridges/voc
|
||||
.. _Briefcase: /project/projects/tools/briefcase
|
||||
.. _Plantilla Python para iOS: /project/projects/templates/python-ios-template
|
||||
.. _Plantilla Python para Android: /project/projects/templates/python-android-template
|
||||
---
|
||||
_slug: multi-plataforma-movil
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
_model: page
|
||||
---
|
||||
incomplete: no
|
||||
---
|
||||
sort_key: 3
|
||||
---
|
||||
title: ...write a cross-platform mobile app
|
||||
---
|
||||
body:
|
||||
|
||||
To develop a cross platform mobile app, you need to use a cross platform widget toolkit - `Toga`_. Toga abstracts away the differences between the various mobile platforms, providing a common Python API for app development.
|
||||
|
||||
This API uses the capabilities of `Rubicon`_ and `VOC`_ to access native system libraries. Rubicon is a bridge library that gives you transparent access to all the native Objective C classes that iOS provides. VOC, on the other hand, is a transpiler - it takes Python source code, compiles it to CPython Bytecode, and then transpiles that bytecode into Java-compatible bytecode. The end result is that your Python source code files are compiled *directly* to a Java `.class` file, which can be packaged into an Android application. VOC also allows you to access native Java objects as if they were Python objects, implement Java interfaces with Python classes, and subclass Java classes with Python classes. Using this, you can write an Android application directly against the native Android APIs.
|
||||
|
||||
Once you've written your mobile application, you can use `Briefcase`_ to package your Python code for specific platforms. Briefcase takes the distutils `setup.py` definition for your Python project, and uses that metadata to generate a stub iOS or Android project, compile your Python code, and place the compiled artefacts so that they will be found when you run the app. The stub project is generated using the `Python iOS template`_ and `Python Android template`_.
|
||||
|
||||
Follow the `tutorial in the briefcase docs <https://briefcase.readthedocs.io/en/latest/tutorial/getting-started.html>`__ to get started!
|
||||
|
||||
.. _Toga: /project/projects/libraries/toga
|
||||
.. _Rubicon: /project/projects/bridges/rubicon
|
||||
.. _VOC: /project/projects/bridges/voc
|
||||
.. _Briefcase: /project/projects/tools/briefcase
|
||||
.. _Python Android template: /project/projects/templates/python-android-template
|
||||
.. _Python iOS template: /project/projects/templates/python-ios-template
|
||||
|
||||
---
|
||||
gutter:
|
||||
|
||||
Relevant projects
|
||||
------------------
|
||||
|
||||
.. image:: /project/projects/libraries/toga/toga.png
|
||||
:height: 32px
|
||||
:alt: Toga icon
|
||||
:align: left
|
||||
|
||||
`Toga`_
|
||||
|
||||
.. image:: /project/projects/bridges/rubicon/rubicon.png
|
||||
:height: 32px
|
||||
:alt: Rubicon icon
|
||||
:align: left
|
||||
|
||||
`Rubicon`_
|
||||
|
||||
.. image:: /project/projects/bridges/voc/voc.png
|
||||
:height: 32px
|
||||
:alt: VOC icon
|
||||
:align: left
|
||||
|
||||
`VOC`_
|
||||
|
||||
.. image:: /project/projects/tools/briefcase/briefcase.png
|
||||
:height: 32px
|
||||
:alt: Briefcase icon
|
||||
:align: left
|
||||
|
||||
`Briefcase`_
|
||||
|
||||
.. image:: /static/images/defaultlogo.png
|
||||
:alt: Python iOS template icon
|
||||
:height: 32px
|
||||
:align: left
|
||||
|
||||
`Python iOS template`_
|
||||
|
||||
.. image:: /static/images/defaultlogo.png
|
||||
:alt: Python Android template icon
|
||||
:height: 32px
|
||||
:align: left
|
||||
|
||||
`Python Android template`_
|
||||
|
||||
.. _Toga: /project/projects/libraries/toga
|
||||
.. _Rubicon: /project/projects/bridges/rubicon
|
||||
.. _VOC: /project/projects/bridges/voc
|
||||
.. _Briefcase: /project/projects/tools/briefcase
|
||||
.. _Python iOS template: /project/projects/templates/python-ios-template
|
||||
.. _Python Android template: /project/projects/templates/python-android-template
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
_model: page
|
||||
---
|
||||
title: ... escribe una aplicación de escritorio
|
||||
---
|
||||
sort_key: 4
|
||||
---
|
||||
incomplete: no
|
||||
---
|
||||
body:
|
||||
|
||||
Para desarrollar una aplicación de escritorio multi-plataforma, debes utilizar un conjunto de herramientas de widget multi-plataforma: `Toga`_. Toga abstrae las diferencias entre las distintas plataformas, proporcionando una API común de Python para el desarrollo de aplicaciones.
|
||||
|
||||
En macOS, esta API utiliza las capacidades de `Rubicon`_ para acceder a bibliotecas nativas del sistema. Rubicon es una librería puente que te da acceso transparente a todas las clases nativas de Objective C que proporciona iOS. En Linux, se utilizan enlaces nativos de Python para GTK +. En Windows, ctypes se utiliza para llamar a las API de Win32 C directamente.
|
||||
|
||||
Una vez que hayas escrito tu aplicación móvil, puedes usar `Briefcase`_ para empaquetar tu código Python para plataformas específicas. Briefcase toma la definición de `setup.py` de distutils para tu proyecto de Python, y usa esa metadata para generar un proyecto de base, compilar tu código Python y ubicar los artefactos compilados para que se encuentren cuando ejecute la aplicación. El proyecto de base se genera usando la `Plantilla Python para macOS`_.
|
||||
|
||||
Sigue el tutorial `en los documentos de Briefcase <https://briefcase.readthedocs.io/en/latest/tutorial/getting-started.html>`__ para empezar!
|
||||
|
||||
.. _Toga: /es/proyecto/proyectos/librerias/toga
|
||||
.. _Rubicon: /es/proyecto/proyectos/puentes/rubicon
|
||||
.. _Briefcase: /es/proyecto/proyectos/herramientas/briefcase
|
||||
.. _Plantilla Python para macOS: /es/proyecto/proyectos/plantillas/plantilla-python-macos
|
||||
---
|
||||
gutter:
|
||||
|
||||
Proyectos relevantes
|
||||
--------------------------
|
||||
|
||||
.. image:: /project/projects/libraries/toga/toga.png
|
||||
:alt: Toga icon
|
||||
:align: left
|
||||
:height: 32px
|
||||
|
||||
`Toga`_
|
||||
|
||||
.. image:: /project/projects/bridges/rubicon/rubicon.png
|
||||
:alt: Rubicon icon
|
||||
:align: left
|
||||
:height: 32px
|
||||
|
||||
`Rubicon`_
|
||||
|
||||
.. image:: /project/projects/tools/briefcase/briefcase.png
|
||||
:alt: Briefcase icon
|
||||
:align: left
|
||||
:height: 32px
|
||||
|
||||
`Briefcase`_
|
||||
|
||||
.. image:: /static/images/defaultlogo.png
|
||||
:alt: Python macOS template icon
|
||||
:height: 32px
|
||||
:align: left
|
||||
|
||||
`Plantilla Python para macOS`_
|
||||
|
||||
.. _Toga: /es/proyecto/proyectos/librerias/toga
|
||||
.. _Rubicon: /es/proyecto/proyectos/puentes/rubicon
|
||||
.. _Briefcase: /es/proyecto/proyectos/herramientas/briefcase
|
||||
.. _Plantilla Python para macOS: /es/proyecto/proyectos/plantillas/plantilla-python-macos
|
||||
---
|
||||
_slug: aplicacion-de-escritorio
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
_model: page
|
||||
---
|
||||
title: ...write a desktop app
|
||||
---
|
||||
sort_key: 4
|
||||
---
|
||||
incomplete: no
|
||||
---
|
||||
body:
|
||||
|
||||
To develop a cross platform desktop app, you need to use a cross platform widget toolkit - `Toga`_. Toga abstracts away the differences between the various platforms, providing a common Python API for app development.
|
||||
|
||||
On macOS, this API uses the capabilities of `Rubicon`_ to access native system libraries. Rubicon is a bridge library that gives you transparent access to all the native Objective C classes that iOS provides. On Linux, native Python bindings for GTK+ are used. On Windows, ctypes is used to call Win32 C APIs directly.
|
||||
|
||||
Once you've written your desktop application, you can use `Briefcase`_ to package your Python code for specific platforms. Briefcase takes the distutils `setup.py` definition for your Python project, and uses that metadata to generate a stub project, compile your Python code, and place the compiled artefacts so that they will be found when you run the app. The stub project is generated using the `Python macOS template`_.
|
||||
|
||||
Follow the `tutorial in the briefcase docs <https://briefcase.readthedocs.io/en/latest/tutorial/getting-started.html>`__ to get started!
|
||||
|
||||
.. _Toga: /project/projects/libraries/toga
|
||||
.. _Rubicon: /project/projects/bridges/rubicon
|
||||
.. _Briefcase: /project/projects/tools/briefcase
|
||||
.. _Python macOS template: /project/projects/templates/python-macos-template
|
||||
|
||||
---
|
||||
gutter:
|
||||
|
||||
Relevant projects
|
||||
------------------
|
||||
|
||||
.. image:: /project/projects/libraries/toga/toga.png
|
||||
:alt: Toga icon
|
||||
:align: left
|
||||
:height: 32px
|
||||
|
||||
`Toga`_
|
||||
|
||||
.. image:: /project/projects/bridges/rubicon/rubicon.png
|
||||
:alt: Rubicon icon
|
||||
:align: left
|
||||
:height: 32px
|
||||
|
||||
`Rubicon`_
|
||||
|
||||
.. image:: /project/projects/tools/briefcase/briefcase.png
|
||||
:alt: Briefcase icon
|
||||
:align: left
|
||||
:height: 32px
|
||||
|
||||
`Briefcase`_
|
||||
|
||||
.. image:: /static/images/defaultlogo.png
|
||||
:alt: Python macOS template icon
|
||||
:height: 32px
|
||||
:align: left
|
||||
|
||||
`Python macOS template`_
|
||||
|
||||
.. _Toga: /project/projects/libraries/toga
|
||||
.. _Rubicon: /project/projects/bridges/rubicon
|
||||
.. _VOC: /project/projects/bridges/voc
|
||||
.. _Briefcase: /project/projects/tools/briefcase
|
||||
.. _Python macOS template: /project/projects/templates/python-macos-template
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
_model: page
|
||||
---
|
||||
title: ... desarrolla en Python
|
||||
---
|
||||
sort_key: 6
|
||||
---
|
||||
incomplete: yes
|
||||
---
|
||||
body:
|
||||
|
||||
BeeWare no es sólo un conjunto de herramientas para ayudarle a ejecutar código Python en diferentes plataformas; también es una colección de herramientas para ayudarte a escribir, depurar y afinar tu código Python.
|
||||
|
||||
`Cricket`_ es una herramienta que ayuda a los proyectos con grandes ensayos de pruebas a identificar los fallos sin esperar a que finalicen todas sus pruebas.
|
||||
|
||||
`Duvet`_ es una herramienta para mostrar los datos de cobertura de una suite prueba.
|
||||
|
||||
`Bugjar`_ es un depurador gráfico.
|
||||
|
||||
`Galley`_ es una herramienta que te permite visualizar fácilmente la documentación de Sphinx mientras la escribes.
|
||||
|
||||
`Podium`_ es una herramienta de presentación de diapositivas que puedes usar para contar a otros sobre tu proyecto.
|
||||
|
||||
.. _Cricket: /es/proyecto/proyectos/herramientas/cricket
|
||||
.. _Duvet: /es/proyecto/proyectos/herramientas/duvet
|
||||
.. _Bugjar: /es/proyecto/proyectos/herramientas/bugjar
|
||||
.. _Galley: /es/proyecto/proyectos/herramientas/galley
|
||||
.. _Podium: /es/proyecto/proyectos/aplicaciones/podium
|
||||
---
|
||||
gutter:
|
||||
|
||||
Relevant projects
|
||||
------------------
|
||||
|
||||
.. image:: /project/projects/tools/cricket/cricket.png
|
||||
:height: 32px
|
||||
:alt: Cricket icon
|
||||
:align: left
|
||||
|
||||
`Cricket`_
|
||||
|
||||
.. image:: /project/projects/tools/duvet/duvet.png
|
||||
:height: 32px
|
||||
:alt: Duvet icon
|
||||
:align: left
|
||||
|
||||
`Duvet`_
|
||||
|
||||
.. image:: /project/projects/tools/bugjar/bugjar.png
|
||||
:alt: Bugjar icon
|
||||
:height: 32px
|
||||
:align: left
|
||||
|
||||
`Bugjar`_
|
||||
|
||||
.. image:: /project/projects/tools/galley/galley.png
|
||||
:height: 32px
|
||||
:alt: Galley icon
|
||||
:align: left
|
||||
|
||||
`Galley`_
|
||||
|
||||
.. image:: /project/projects/applications/podium/podium.png
|
||||
:height: 32px
|
||||
:alt: Podium icon
|
||||
:align: left
|
||||
|
||||
`Podium`_
|
||||
|
||||
.. _Cricket: /es/proyecto/proyectos/herramientas/cricket
|
||||
.. _Duvet: /es/proyecto/proyectos/herramientas/duvet
|
||||
.. _Bugjar: /es/proyecto/proyectos/herramientas/bugjar
|
||||
.. _Galley: /es/proyecto/proyectos/herramientas/galley
|
||||
.. _Podium: /es/proyecto/proyectos/aplicaciones/podium
|
||||
---
|
||||
_slug: desarrolla-en-python
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
_model: page
|
||||
---
|
||||
title: ...develop Python code
|
||||
---
|
||||
sort_key: 6
|
||||
---
|
||||
incomplete: yes
|
||||
---
|
||||
body:
|
||||
|
||||
BeeWare isn't just a set of tools to help you run Python code on different platforms; it's also a collection of tools to help you write, debug and tune your Python code.
|
||||
|
||||
`Cricket`_ is a tool that helps projects with large test suites identify failures without waiting for all your tests to finish.
|
||||
|
||||
`Duvet`_ is a tool to display coverage data from a test run.
|
||||
|
||||
`Bugjar`_ is a graphical debugger.
|
||||
|
||||
`Galley`_ is a tool to let you easily preview your Sphinx documentation as you write it.
|
||||
|
||||
`Podium`_ is a slideshow presentation tool that you can use to tell others about your project.
|
||||
|
||||
.. _Cricket: /project/projects/tools/cricket
|
||||
.. _Duvet: /project/projects/tools/duvet
|
||||
.. _Bugjar: /project/projects/tools/bugjar
|
||||
.. _Galley: /project/projects/tools/galley
|
||||
.. _Podium: /project/projects/applications/podium
|
||||
|
||||
---
|
||||
gutter:
|
||||
|
||||
Relevant projects
|
||||
------------------
|
||||
|
||||
.. image:: /project/projects/tools/cricket/cricket.png
|
||||
:height: 32px
|
||||
:alt: Cricket icon
|
||||
:align: left
|
||||
|
||||
`Cricket`_
|
||||
|
||||
.. image:: /project/projects/tools/duvet/duvet.png
|
||||
:height: 32px
|
||||
:alt: Duvet icon
|
||||
:align: left
|
||||
|
||||
`Duvet`_
|
||||
|
||||
.. image:: /project/projects/tools/bugjar/bugjar.png
|
||||
:alt: Bugjar icon
|
||||
:height: 32px
|
||||
:align: left
|
||||
|
||||
`Bugjar`_
|
||||
|
||||
.. image:: /project/projects/tools/galley/galley.png
|
||||
:height: 32px
|
||||
:alt: Galley icon
|
||||
:align: left
|
||||
|
||||
`Galley`_
|
||||
|
||||
.. image:: /project/projects/applications/podium/podium.png
|
||||
:height: 32px
|
||||
:alt: Podium icon
|
||||
:align: left
|
||||
|
||||
`Podium`_
|
||||
|
||||
.. _Cricket: /project/projects/tools/cricket
|
||||
.. _Duvet: /project/projects/tools/duvet
|
||||
.. _Bugjar: /project/projects/tools/bugjar
|
||||
.. _Galley: /project/projects/tools/galley
|
||||
.. _Podium: /project/projects/applications/podium
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
_model: page
|
||||
---
|
||||
incomplete: no
|
||||
---
|
||||
sort_key: 1
|
||||
---
|
||||
title: ... escribe una aplicación nativa de iOS
|
||||
---
|
||||
body:
|
||||
|
||||
Aunque Apple sólo promueve Objective-C y Swift para el desarrollo de iOS, se puede utilizar cualquier lenguaje que compile con la cadena de herramientas `clang`. `Soporte Python para Apple`_ es una copia de CPython compilada para plataformas de Apple, incluyendo iOS. Este paquete proporciona un `Python.framework` que se puede utilizar directamente en un proyecto Xcode. Esto permite incrustar un intérprete de Python en su aplicación iOS, lo que, a su vez, significa que se puede ejecutar código Python desde su aplicación iOS.
|
||||
|
||||
Sin embargo, no es mucho el poder ser capaz de ejecutar código Python si no puede acceder a las librerías del sistema. Ahí es donde entra jugar Rubicon. Rubicon es una librería puente que te da acceso transparente a todas las clases nativas de Objective C que proporciona iOS. Utilizando esto, puedes escribir una aplicación de iOS directamente utilizando las API de iOS nativas.
|
||||
|
||||
Una vez que hayas escrito tu aplicación nativa de iOS, puedes utilizar `Briefcase`_ para empaquetar el código Python como un paquete de aplicaciones de iOS. Briefcase toma la definición `config.py` de `distutils` para tu proyecto Python y usa esa metadata para generar un proyecto base de Xcode para iOS, y agrega tu código Python y las dependencias para que se encuentren cuando ejecutes tu proyecto iOS. El proyecto de base se genera utilizando la `Plantilla Python para iOS`_.
|
||||
|
||||
Sigue el tutorial `en los documentos de Briefcase <https://briefcase.readthedocs.io/en/latest/tutorial/getting-started.html>`__ para empezar!
|
||||
|
||||
.. _Soporte Python para Apple: /es/proyecto/proyectos/soporte/soporte-python-apple
|
||||
.. _Rubicon: /es/proyecto/proyectos/puentes/rubicon
|
||||
.. _Briefcase: /es/proyecto/proyectos/herramientas/briefcase
|
||||
.. _Plantilla Python para iOS: /es/proyecto/proyectos/plantillas/plantilla-python-ios
|
||||
---
|
||||
gutter:
|
||||
|
||||
Proyectos relevantes
|
||||
--------------------------
|
||||
|
||||
.. image:: /static/images/defaultlogo.png
|
||||
:height: 32px
|
||||
:alt: Python Apple support icon
|
||||
:align: left
|
||||
|
||||
`Soporte Python para apple`_
|
||||
|
||||
.. image:: /project/projects/bridges/rubicon/rubicon.png
|
||||
:height: 32px
|
||||
:alt: Rubicon icon
|
||||
:align: left
|
||||
|
||||
`Rubicon`_
|
||||
|
||||
.. image:: /project/projects/tools/briefcase/briefcase.png
|
||||
:alt: Briefcase icon
|
||||
:height: 32px
|
||||
:align: left
|
||||
|
||||
`Briefcase`_
|
||||
|
||||
.. image:: /static/images/defaultlogo.png
|
||||
:height: 32px
|
||||
:alt: Python iOS template icon
|
||||
:align: left
|
||||
|
||||
`Plantilla Python para iOS`_
|
||||
|
||||
.. _Soporte Python para Apple: /es/proyecto/proyectos/soporte/soporte-python-apple
|
||||
.. _Rubicon: /es/proyecto/proyectos/puentes/rubicon
|
||||
.. _Briefcase: /es/proyecto/proyectos/herramientas/briefcase
|
||||
.. _Plantilla Python para iOS: /es/proyecto/proyectos/plantillas/plantilla-python-ios
|
||||
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
_model: page
|
||||
---
|
||||
incomplete: no
|
||||
---
|
||||
sort_key: 1
|
||||
---
|
||||
title: ...write a native iOS app
|
||||
---
|
||||
body:
|
||||
|
||||
Although Apple only promotes Objective-C and Swift for iOS development, you can use any language that compiles with the `clang` toolchain. `Python Apple support`_ is a copy of CPython compiled for Apple platforms, including iOS. This package provides a `Python.framework` that can be dropped directly into an Xcode project. This allows you to embed a Python interpreter into your iOS application, which, in turn, means you can run Python code from inside your iOS application.
|
||||
|
||||
However, it's not much use being able to run Python code if you can't access system libraries. That's where `Rubicon`_ comes in. Rubicon is a bridge library that gives you transparent access to all the native Objective C classes that iOS provides. Using this, you can write an iOS application directly against the native iOS APIs.
|
||||
|
||||
Once you've written your native iOS application, you can use `Briefcase`_ to package your Python code as an iOS application bundle. Briefcase takes the distutils `setup.py` definition for your Python project, and uses that metadata to generate a stub iOS Xcode project, and add your Python code and dependencies so that they will be found when you run your iOS project. The stub project is generated using the `Python iOS template`_.
|
||||
|
||||
Follow the `tutorial in the briefcase docs <https://briefcase.readthedocs.io/en/latest/tutorial/getting-started.html>`__ to get started!
|
||||
|
||||
.. _Python Apple support: /project/projects/support/python-apple-support
|
||||
.. _Rubicon: /project/projects/bridges/rubicon
|
||||
.. _Briefcase: /project/projects/tools/briefcase
|
||||
.. _Python iOS template: /project/projects/templates/python-ios-template
|
||||
|
||||
---
|
||||
gutter:
|
||||
|
||||
Relevant projects
|
||||
------------------
|
||||
|
||||
.. image:: /static/images/defaultlogo.png
|
||||
:height: 32px
|
||||
:alt: Python Apple support icon
|
||||
:align: left
|
||||
|
||||
`Python Apple support`_
|
||||
|
||||
.. image:: /project/projects/bridges/rubicon/rubicon.png
|
||||
:height: 32px
|
||||
:alt: Rubicon icon
|
||||
:align: left
|
||||
|
||||
`Rubicon`_
|
||||
|
||||
.. image:: /project/projects/tools/briefcase/briefcase.png
|
||||
:alt: Briefcase icon
|
||||
:height: 32px
|
||||
:align: left
|
||||
|
||||
`Briefcase`_
|
||||
|
||||
.. image:: /static/images/defaultlogo.png
|
||||
:height: 32px
|
||||
:alt: Python iOS template icon
|
||||
:align: left
|
||||
|
||||
`Python iOS template`_
|
||||
|
||||
.. _Python Apple support: /project/projects/support/python-apple-support
|
||||
.. _Rubicon: /project/projects/bridges/rubicon
|
||||
.. _Briefcase: /project/projects/tools/briefcase
|
||||
.. _Python iOS template: /project/projects/templates/python-ios-template
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
_model: page
|
||||
---
|
||||
title: ... escribir una aplicación web de una sola página
|
||||
---
|
||||
sort_key: 5
|
||||
---
|
||||
incomplete: yes
|
||||
---
|
||||
body:
|
||||
|
||||
Además de la compatibilidad con widgets nativos, `Toga`_ soporta a un navegador web como plataforma de salida.
|
||||
|
||||
Cuando se ejecuta en el navegador, Toga utiliza `Batavia`_ para ejecutar el código de tu aplicación. Batavia es una implementación de una máquina virtual para procesar bytecode generado por CPython, escrita en Javascript.
|
||||
|
||||
Sigue el tutorial `en los documentos de Briefcase <https://briefcase.readthedocs.io/en/latest/tutorial/getting-started.html>`__ para empezar!
|
||||
|
||||
.. _Toga: /project/projects/libraries/toga
|
||||
.. _Batavia: /project/projects/bridges/batavia
|
||||
---
|
||||
gutter:
|
||||
|
||||
Proyectos relevantes
|
||||
---------------------
|
||||
.. image:: /project/projects/libraries/toga/toga.png
|
||||
:height: 32px
|
||||
:alt: Toga icon
|
||||
:align: left
|
||||
|
||||
`Toga`_
|
||||
|
||||
.. image:: /project/projects/bridges/batavia/batavia.png
|
||||
:height: 32px
|
||||
:alt: Batavia icon
|
||||
:align: left
|
||||
|
||||
`Batavia`_
|
||||
|
||||
.. _Toga: /project/projects/libraries/toga
|
||||
.. _Batavia: /project/projects/bridges/batavia
|
||||
---
|
||||
_slug: aplicacion-web-de-una-sola-pagina
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
_model: page
|
||||
---
|
||||
title: ...write a single page web app
|
||||
---
|
||||
sort_key: 5
|
||||
---
|
||||
incomplete: yes
|
||||
---
|
||||
body:
|
||||
|
||||
In addition to support for native widgets, `Toga`_ can support a web browser as an output platform.
|
||||
|
||||
When deployed to the browser, Toga uses `Batavia`_ to run your application's code. Batavia is an implementation of a CPython bytecode virtual machine, written in Javascript.
|
||||
|
||||
Follow the `tutorial in the briefcase docs <https://briefcase.readthedocs.io/en/latest/tutorial/getting-started.html>`__ to get started!
|
||||
|
||||
.. _Toga: /project/projects/libraries/toga
|
||||
.. _Batavia: /project/projects/bridges/batavia
|
||||
|
||||
---
|
||||
gutter:
|
||||
|
||||
Relevant projects
|
||||
------------------
|
||||
|
||||
.. image:: /project/projects/libraries/toga/toga.png
|
||||
:height: 32px
|
||||
:alt: Toga icon
|
||||
:align: left
|
||||
|
||||
`Toga`_
|
||||
|
||||
.. image:: /project/projects/bridges/batavia/batavia.png
|
||||
:height: 32px
|
||||
:alt: Batavia icon
|
||||
:align: left
|
||||
|
||||
`Batavia`_
|
||||
|
||||
.. _Toga: /project/projects/libraries/toga
|
||||
.. _Batavia: /project/projects/bridges/batavia
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""This is a custom local plugin to ad extra functionality to pybee site."""
|
||||
"""This is a custom local plugin to ad extra functionality to BeeWare site."""
|
||||
|
||||
# Standard library imports
|
||||
from datetime import datetime
|
||||
import os
|
||||
import urllib
|
||||
import subprocess
|
||||
import sys
|
||||
from urllib.parse import quote_plus
|
||||
|
||||
# Third party imports
|
||||
from lektor.pluginsystem import Plugin
|
||||
|
|
@ -21,8 +21,8 @@ from pygments.styles import get_all_styles
|
|||
PY3 = sys.version_info[0] == 3
|
||||
|
||||
|
||||
class PyBeePlugin(Plugin):
|
||||
name = 'PyBee Custom Lektor Plugin'
|
||||
class BeeWarePlugin(Plugin):
|
||||
name = 'BeeWare Custom Lektor Plugin'
|
||||
description = 'This is a custom local plugin to add extra functionality.'
|
||||
|
||||
DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
|
||||
|
|
@ -84,8 +84,7 @@ class PyBeePlugin(Plugin):
|
|||
stdout, stderr = execute(cmd)
|
||||
|
||||
if stdout:
|
||||
diff = unicode(stdout, 'utf-8')
|
||||
html_diff = highlight(diff, lexers.DiffLexer(),
|
||||
html_diff = highlight(stdout, lexers.DiffLexer(),
|
||||
HtmlFormatter())
|
||||
|
||||
# print(' '.join(cmd))
|
||||
|
|
@ -186,7 +185,7 @@ class PyBeePlugin(Plugin):
|
|||
|
||||
if len(string) <= limit:
|
||||
string = string.encode('utf8')
|
||||
string = urllib.quote_plus(string)
|
||||
string = quote_plus(string)
|
||||
string = Markup(string)
|
||||
else:
|
||||
string = None
|
||||
|
|
@ -1,22 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""This is a custom local plugin to ad extra functionality to pybee site."""
|
||||
"""This is a custom local plugin to ad extra functionality to BeeWare site."""
|
||||
|
||||
# Third party imports
|
||||
from setuptools import setup
|
||||
|
||||
|
||||
setup(
|
||||
name='lektor-pybee-plugin',
|
||||
name='lektor-beeware-plugin',
|
||||
author='Gonzalo Peña-Castellanos',
|
||||
author_email='goanpeca@gmail.com',
|
||||
url='https://github.com/beeware/beeware.github.io/tree/lektor/packages/lektor_pybee_plugin',
|
||||
url='https://github.com/beeware/beeware.github.io/tree/lektor/packages/lektor_beeware_plugin',
|
||||
version='0.1',
|
||||
license='MIT',
|
||||
py_modules=['lektor_pybee_plugin'],
|
||||
py_modules=['lektor_beeware_plugin'],
|
||||
install_requires=['Lektor', 'MarkupSafe', 'Pygments'],
|
||||
entry_points={
|
||||
'lektor.plugins': [
|
||||
'pybee-plugin = lektor_pybee_plugin:PyBeePlugin',
|
||||
'beeware-plugin = lektor_beeware_plugin:BeeWarePlugin',
|
||||
]
|
||||
}
|
||||
)
|
||||
|
|
@ -55,7 +55,7 @@ def get_files(root_path, extensions=('.html',)):
|
|||
for dirname, subdirlist, filelist in os.walk(root_path):
|
||||
for fname in filelist:
|
||||
if fname.endswith(extensions):
|
||||
print('.', end='')
|
||||
print('.', end='', flush=True)
|
||||
fpath = os.path.join(dirname, fname)
|
||||
all_paths.append(fpath)
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ def check_link(url, root_url, root_path):
|
|||
status = 200
|
||||
else:
|
||||
r = requests.get(url, headers=headers, timeout=TIMEOUT)
|
||||
content = r.content
|
||||
content = r.text
|
||||
status = r.status_code
|
||||
else:
|
||||
r = requests.head(url, headers=headers, timeout=TIMEOUT)
|
||||
|
|
@ -155,15 +155,18 @@ def run_link_checks(root_path, root_url):
|
|||
file_paths = get_files(root_path)
|
||||
file_links = {}
|
||||
|
||||
print('\n\nFound {} files!'.format(len(file_paths)))
|
||||
print('\n\nParsing built files for links:\n')
|
||||
for i, fpath in enumerate(file_paths):
|
||||
for i, fpath in enumerate(file_paths, start=1):
|
||||
# print('\n')
|
||||
# print(i, fpath)
|
||||
print('.', end='')
|
||||
print('.', end='', flush=True)
|
||||
if i % 100 == 0:
|
||||
print(" {}".format(i))
|
||||
file_links[fpath] = set()
|
||||
links = parse_urls(fpath, root_url)
|
||||
for link in links:
|
||||
# print('.', end='')
|
||||
# print('.', end='', flush=True)
|
||||
file_links[fpath].add(link)
|
||||
|
||||
link_files = {}
|
||||
|
|
@ -178,7 +181,7 @@ def run_link_checks(root_path, root_url):
|
|||
print('\n\nFound {0} unique link{1}!\n'.format(issues, plural))
|
||||
print('\nChecking links\n'.format(issues, plural))
|
||||
counter = 0
|
||||
for i, link in enumerate(sorted(link_files)):
|
||||
for i, link in enumerate(sorted(link_files), start=1):
|
||||
# Ignore `edit content on github` links as they would take too long
|
||||
if any(link.startswith(i) for i in WHITELIST):
|
||||
continue
|
||||
|
|
@ -209,7 +212,9 @@ def run_link_checks(root_path, root_url):
|
|||
counter += 1
|
||||
print('\n')
|
||||
else:
|
||||
print('.', end='')
|
||||
print('.', end='', flush=True)
|
||||
if i % 100 == 0:
|
||||
print(" {}".format(i))
|
||||
|
||||
return counter
|
||||
|
||||
|
|
@ -236,7 +241,7 @@ def main():
|
|||
print('\nBuilding static site:\n')
|
||||
for p, stdout in execute(cmd):
|
||||
if stdout and not finished_build:
|
||||
print('.', end='')
|
||||
print('.', end='', flush=True)
|
||||
|
||||
if 'Finished build' in stdout:
|
||||
finished_build = True
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@
|
|||
<i class="fa fa-github "></i><small> {{ t_edit_on_github }}</small>
|
||||
</a>
|
||||
{%- else -%}
|
||||
{# This method is provided by a custom plugin found in /packages/lektor_pybee_plugin/ #}
|
||||
{# This method is provided by a custom plugin found in /packages/lektor_beeware_plugin/ #}
|
||||
{%- set content_value = urlencode_limit(site.get(this.path).contents.as_text(), limit=5000) -%}
|
||||
{%- if content_value and '@' not in this.path -%}
|
||||
<a class="nav-link" href="https://github.com/beeware/beeware.github.io/new/lektor/content{{ this.path }}/contents{{ alt_path }}.lr?filename=contents{{ alt_path }}.lr&value={{ content_value }}" target="_blank">
|
||||
|
|
|
|||
Loading…
Reference in a new issue