Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.

How-To Update for docs. #819

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

How-To Update for docs. #819

wants to merge 17 commits into from

Conversation

alexjdw
Copy link
Contributor

@alexjdw alexjdw commented Jun 13, 2019

Docs felt a bit rusty. I decided to add some pages. I tried to think of what I would've liked to know on my first commit, and I included some of the questions I had to have addressed by the team. Please let me know what you think and if there's any sections that could be added/improved.

  • "tour of the code" added with basic project structure and a list of helpful functions
  • builtins guide improved and geared toward new contributors
  • added a similar guide for types geared toward new contributors
  • broke out test contributions into its own guide
  • expanded on it with more examples and an overview of the cleaners.
  • How-to index updated to include the new stuff.

Possible issues:

  • A bit repetitive between the three updated files.
  • Very wordy, so tl;dr risk?

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome 👍 - thanks for all this. I've flagged a few things inline - mostly fairly minor clarifications or style requests.

@@ -1,104 +1,138 @@
Implementing Python Built-ins in JavaScript
===========================================

Python's builtins give Python its trademark magical feel. If you're new to Python, read up on them here: https://docs.python.org/3/library/functions.html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be better as an inline link, rather than a raw URL

@@ -1,104 +1,138 @@
Implementing Python Built-ins in JavaScript
===========================================

Python's builtins give Python its trademark magical feel. If you're new to Python, read up on them here: https://docs.python.org/3/library/functions.html

Most builtins have already been added to the project, but many do not follow the spec outlined below.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid colloquial abbreviations; specification, not spev. Although in this case, "description" is probably more accurate; it's not really a formal spec.

var <fn> = function(<args>, <kwargs>) {
// These builtins are designed to be used only inside Batavia, as such they need to ensure
// they are being used in a compatible manner.
// Example: <fn> accepts exactly one argument, and no keyword arguments
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're cleaning this up... I'm not wild about using "" as an example. It's potentially confusing, since as written, it's not valid Javascript or Python syntax. I'd rather use an actual concrete example, with a preface note that says "we're going to use abs() as an example here; abs() is already implemented, but the pattern will be the same for any other builtin". (Substitute abs() for whatever builtin makes sense in the content)

docs/how-to/builtins.rst Outdated Show resolved Hide resolved
docs/how-to/contribute-tests.rst Show resolved Hide resolved
Core Code
*********

Batavia implements the Python native types, builtins, and standard library partially in JavaScript.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a a little clearer - "the core language (types, builtins and the core interpreter) are all javascript, as well those portions of the standard library that depend on system services".


Support
*******
You'll also notice folders for tests, docs, and a few other bits and bobs, like ``testserver``, which is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid the colloquial - "bits and bobs"

Support
*******
You'll also notice folders for tests, docs, and a few other bits and bobs, like ``testserver``, which is
a Django project that allows code execution from your browser. Contributions to the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be better to describe testserver as a sample deployment that lets you test Batavia.

This contains all of the native Python builtin functions, like ``str``, ``len``, and ``iter``.

When dealing with Python types, many of the native JavaScript operations have been modified to
try to use builtins first. For instance, .toString() will often just call the object's __str__ if
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code markup on tostring and str

core/callables.js
^^^^^^^^^^^^^^^^^

These methods ensure that all Python code is executed using the proper __call__ procedure, which could be
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

markup on call

docs/how-to/tour.rst Outdated Show resolved Hide resolved
Your goal is to mimic the CPython implementation as much as possible. If you do so, you'll often fix multiple issues at once. Here's some tips:

* The original implementation is documented in detail at https://docs.python.org/3/ -- reading up there will definitely improve your understanding.
* If you're inherting your class from JavaScript, which is very common, you get JavaScript's internal methods for free. Oftentimes, they can be left as is or lightly wrapped.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@awildtechno Tiny nitpick: inherting I think could be inheriting?

I'm also not sure if it makes sense to add something referring to tox / tox.ini or https://github.com/beeware/beekeeper (could be in a later PR though)?

Otherwise in my quick overview before sleep, this PR looks awesome and way better than what I just started writing, will definitely enjoy going through it in more depth when PyConAU dev sprints continue tomorrow!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants