Commit graph

170 commits

Author SHA1 Message Date
Ray Zeng
27d7ce08fd Remove compatibility with old metadata API 2019-08-09 17:27:20 -07:00
Jennifer Taylor
b4967f89f6 Fix incorrect description of on_leave for CSTVisitor/CSTTransform. 2019-08-09 17:24:32 -07:00
Ray Zeng
e08e27fa30 Add tox enviroment to run isort and black and update readme 2019-08-09 10:06:29 -07:00
Ray Zeng
9602643419 Patch _MetadataDependent to not be an ABC until Pyre is fixed 2019-08-08 12:00:00 -07:00
Benjamin Woodruff
90e4efb348 Add docs for MaybeSentinel and RemovalSentinel
These were referred to by other parts of the documentation, and they
provide core parts of our functionality, so we should have explicit
documentation for them.
2019-08-08 11:04:02 -07:00
jimmylai
05c8070dfb
[readthedoc] install libcst
* [readthedoc] install libcst

* Update .readthedocs.yml
2019-08-07 15:58:02 -07:00
Benjamin Woodruff
dd22dd0361 Link to ReadTheDocs from our README file
This should make it possible for people to find our more detailed
documentation.
2019-08-07 15:03:38 -07:00
Jennifer Taylor
bf94bad977 Ignore build/ directory. 2019-08-07 14:14:35 -07:00
Benjamin Woodruff
da7b9435ee Add logo and favicon to sphinx documentation
- The white logo variant shows up on the top of the sidebar.
- The favicon shows up when the page is loaded.
2019-08-07 13:32:31 -07:00
jimmylai
1424cfb2e1
add readthedoc config file 2019-08-07 10:41:10 -07:00
Ray Zeng
da112c2f03 Don't run isort and black when running unit tests with tox 2019-08-07 09:33:47 -07:00
Benjamin Woodruff
ef0ce06e12 Remove unused sphinx plugins
It doesn't look like we need:

- `sphinx.ext.githubpages`
- `sphinx.ext.todo`
- `sphinx.ext.mathjax`

So I removed these and then sorted the list of extensions.
2019-08-06 19:39:43 -07:00
Benjamin Woodruff
ff9ed2e8e4 Change FormattedString's end field to a Literal
I noticed this while working on the documentation. I think this predated
pyre's Literal support.

I only did this for `end` and not `start`, because there's a large
combinatorial set of valid `start` values. If we wanted to better type
`start`, we should probably first separate the prefix from the opening
quotes.
2019-08-06 19:39:43 -07:00
Benjamin Woodruff
647ef53f0e Finish documentation pass over expressions
This commit mostly focuses on f-strings, collections, comprehensions,
and subscripts/slices.

I added intersphinx support to the sphinx config so I could link to
`ast.literal_eval`.

I exported BaseSimpleComp, since I felt it had some documentation value.
2019-08-06 19:39:43 -07:00
jimmylai
0839f35d55
[doc] add document to deep_clone and deep_equals
* [doc] add document to deep_clone and deep_equals

* use doctest format
2019-08-06 17:32:23 -07:00
Benjamin Woodruff
4a84389fed Allow Annotation to contain any BaseExpression
An `Annotation` can contain any `BaseExpression`, not just the short
list of types we had listed.

For example, this is valid syntax:

    val: 1 + 2 = None
2019-08-06 17:30:30 -07:00
Ray Zeng
2ba295cc01 Fix some typing issues in metadata API 2019-08-06 16:58:56 -07:00
Ray Zeng
f99cbf4c7c Fix position metadata providers and tests 2019-08-06 16:58:56 -07:00
Ray Zeng
ac595cb8f2 Rewrite metadata around module wrapper 2019-08-06 16:58:56 -07:00
Ray Zeng
69e46654d4 Rename metadata/_interface.py to metadata/dependent.py 2019-08-06 16:58:56 -07:00
Ray Zeng
21eeacc344 Add __init__ to metadata/tests 2019-08-06 16:58:56 -07:00
Ray Zeng
953c590088 Rename metadata runner to _resolver 2019-08-06 16:58:56 -07:00
Ray Zeng
f52ee1b1b2 fix Python version details in readme 2019-08-06 16:55:08 -07:00
Ray Zeng
9ae23ce81a Add installation instructions to readme 2019-08-06 16:55:08 -07:00
Jennifer Taylor
101ff70857 Lots of work on Why LibCST section
Fixed Why LibCST printed example as it was out of date.
Unrolled README example into Why LibCST section to decouple since this page explicitly uses "fn(1, 2)" snippet and the readme is going to change.
Added justification and pros/cons to LibCST.
Added graphviz to render the non-default parts of LibCST tree (identical to how we render non-default parts of the AST).
2019-08-06 16:55:08 -07:00
Ray Zeng
f25109bdec Add tagline below logo 2019-08-06 16:55:08 -07:00
Ray Zeng
dbc10f0dc6 Tweak wording of intro 2019-08-06 16:55:08 -07:00
Ray Zeng
0e826834a2 Update readme with shorter examples and test runner examples 2019-08-06 16:55:08 -07:00
jimmylai
6138e74542
[document] add jupyter based tutorial page
* [document] add jupyter based tutorial page

* add return type and fix typos
2019-08-06 16:34:03 -07:00
jimmylai
04804d03af
improve setup.py to be ready for publishing package to pypi
* improve setup.py to be ready for publishing package to pypi

* remove dev from version
2019-08-06 16:09:47 -07:00
Jennifer Taylor
d3ce7da7ce Drop annotation indicator attribute.
We pass down the correct default annotation indicator to use in 100% of code rendering places, so this becomes a useless bit of initialization. We already set this to a sentinel by default, and the only thing that having an explicit str gives us is the inability to copy an annotation from a param to a return or vice versa. So, out it goes. This means we can't render Annotation by itself, so the test that was using this behavior is out too.
2019-08-05 17:13:17 -07:00
Ray Zeng
8428ad906f Added docstring to libcst.tool.dump and reordered args to hint at their precedence 2019-08-05 16:44:19 -07:00
Jennifer Taylor
567fc1884c Refactor libcst.tool to allow for "dump" to be exported. 2019-08-05 16:44:19 -07:00
Jennifer Taylor
944f987b1f Better documentation for visitors. 2019-08-05 10:56:33 -07:00
jimmylai
f7a192306c Add Logo to README 2019-08-05 10:44:17 -07:00
Benjamin Woodruff
593968da65 Add the logo to the docs/source/_static/ directory 2019-08-05 10:44:17 -07:00
Jennifer Taylor
9ca3d39fb6 Rename Ellipses to Ellipsis to match AST and Python stuff. 2019-08-02 17:17:38 -07:00
Benjamin Woodruff
a4af00dd7f Update the expression documentation
I haven't gone through every expression and cleaned it up yet, but I
have completed the `Names and Object Attributes`, `Operations and
Comparisons`, `Control Flow`, and `Lambda and Function Calls` sections,
as well as part of the `Literal Values` section.
2019-08-02 15:50:17 -07:00
Jennifer Taylor
c5c9425d05 Loosen types on deep_equals.
As written, this makes it a type-checker error if you pass in a value of
other that doesn't match the type of the node you're checking against.
If you want to ask a generic question similar to 'Does this equal
Node("True")', you can't use this function. It calls into a helper that
allows for (and checks as a base case) different types to be passed in,
so lets loosen types here to make this useful.
2019-08-02 15:34:37 -07:00
Jennifer Taylor
ac1a6fd054 Fix deprecation warning. 2019-08-01 18:28:54 -07:00
Jennifer Taylor
64ff2b1996 Better repr for partial configuration.
This adds a __repr__ to various types in the parser config, so that the
generated documentation for functions using these types renders easier
to read.
2019-08-01 16:14:12 -07:00
Jennifer Taylor
47a3c75670 Add documentation for parse_module and parse_expression. 2019-08-01 14:55:19 -07:00
Benjamin Woodruff
f2c887604f Group expression documentation into subcategories
Groups the expression nodes into much smaller subcategories for improved
readablility.

Some nodes defined in the expression module were grouped with statements
because they made more sense there (from a documentation perspective).

This also adds a local table of contents to the top of the nodes page
which better reveals all of the subcategories.

It also exports and categorizes
`BaseAssignTargetExpression`/`BaseDelTargetExpression`. These nodes were
referenced in type annotations of other nodes, so they need to be
exported if only for documentation reasons.
2019-08-01 14:54:36 -07:00
Jennifer Taylor
8d000ababc Add a motivation section for LibCST documentation. 2019-08-01 14:51:00 -07:00
jimmylai
aee5ff7857
[document] formatting why_libcst 2019-08-01 14:05:29 -07:00
Jennifer Taylor
8e81384789 Update base README.rst to at least advertise the current python version. 2019-08-01 14:04:38 -07:00
Jennifer Taylor
47be0b1681 Hardcode parser version to Python 3.7 for now. 2019-08-01 14:04:38 -07:00
Jennifer Taylor
374d66d09a Minor formatting nits. 2019-08-01 14:03:51 -07:00
Benjamin Woodruff
aec1e9f2f3
Clean up relative sphinx class/func references
Removes the leading dot in node references (due to a misunderstanding I had), and uses tilde-based prefixes for restructured text references for consistency with the rest of the docs.
2019-08-01 13:40:27 -07:00
jimmylai
d642fbfff7
[document] fix code block formatting 2019-08-01 13:34:32 -07:00