Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOC] added basic examples to works with docsrv #59

Merged
merged 7 commits into from
Oct 10, 2017
Merged

[DOC] added basic examples to works with docsrv #59

merged 7 commits into from
Oct 10, 2017

Conversation

mcarmonaa
Copy link
Contributor

I just added a few basic examples for spark, pyspark, and jupyter. I was trying to use classifyLanguage and extractUASTsfunctionality but they don't work right now, so I didn't add any example about. I'll try to make it work somehow since #57 doesn't work for me.

It would be nice if you could suggest other kind of examples to include, based on some usage cases.

@erizocosmico
Copy link
Contributor

@mcarmonaa if you use the python wrapper branch the issue with the guava dependencies is fixed

@codecov
Copy link

codecov bot commented Sep 27, 2017

Codecov Report

Merging #59 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #59   +/-   ##
=========================================
  Coverage     85.07%   85.07%           
  Complexity       66       66           
=========================================
  Files            18       18           
  Lines           563      563           
  Branches        100      100           
=========================================
  Hits            479      479           
  Misses           36       36           
  Partials         48       48

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd7fe15...a331c28. Read the comment docs.

},
"outputs": [],
"source": [
"repositoriesDf = spark.read.format(\"tech.sourced.api\").option(\"table\",\"repositories\").load(\"/repositories\")\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

there is an updated version of this notebook inside the python wrapper branch that uses the python wrapper

@@ -0,0 +1,178 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer to have all the notebooks in one place. Notebooks are executables, so in this case it should be in the examples folder. Putting them all into the same place we avoid duplication and we can handle api changes better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For the moment this file is duplicated here because of docsrv

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@dpordomingo dpordomingo Oct 5, 2017

Choose a reason for hiding this comment

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

@ajnavarro @mcarmonaa Could it be an alternative to put them wherever they should be, and then update the _examples/README.md link? I mean: point to the original one, instead of pointing to a copy.
(it should fix the problem of the duplication)

If you prefer to use a copy, I'd use a symbolic link to maintain the synchronicity

@mcarmonaa
Copy link
Contributor Author

I've just added examples of classifyLanguages and extractUASTs

@@ -0,0 +1,32 @@
```bash
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about adding title and a brief explanation of what is gonna happen in the snippet below at the start of each of these markdown files?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -0,0 +1,38 @@
## Classifying languages example

This example uses the pyspark-shell to show a basic usage of the UDF `classify_languages()`.
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we should change UDF, because to someone that's not familiar with Spark it sounds really alien

to show how to classify files by their language maybe?

@@ -0,0 +1,39 @@
## Classifying languages and extracting UASTs example

The combined usage of both UDFs `classify_languages()` and `extract_uasts()` has the advantage that doesn't rely the language detection task on the [bblfsh server](https://github.com/bblfsh/server) , so you can save some time.
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

@@ -0,0 +1,41 @@
## Classifying languages example

This example uses the spark-shell to show a basic usage of the UDF `classifyLanguages`.
Copy link
Contributor

Choose a reason for hiding this comment

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

same

@@ -0,0 +1,42 @@
## Classifying languages and extracting UASTs example

The combined usage of both UDFs `classifyLanguages` and `extractUASTs` has the advantage that doesn't rely the language detection task on the [bblfsh server](https://github.com/bblfsh/server) , so you can save some time.
Copy link
Contributor

Choose a reason for hiding this comment

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

same

Copy link
Contributor

@dpordomingo dpordomingo left a comment

Choose a reason for hiding this comment

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

I found problems with absolute links.
You may consider the following example, and apply it in the others.


### pyspark

- [pyspark's shell basic example](https://github.com/src-d/spark-api/blob/master/_examples/pyspark/pyspark-shell-basic.md)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the link is broken.

If you go to the original file:
https://github.com/mcarmonaa/spark-api/blob/feature/docsrv/_examples/README.md
And try it, it fails.

If you change it by the relative format, it seems to work:

- [pyspark's shell  basic example](pyspark/pyspark-shell-basic.md)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll change the links to the relative format!

Copy link
Contributor

@dpordomingo dpordomingo left a comment

Choose a reason for hiding this comment

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

Many thanks for the documentation and examples!

@erizocosmico
Copy link
Contributor

Shall we merge this?

@ajnavarro ajnavarro merged commit fbd8f70 into src-d:master Oct 10, 2017
@mcarmonaa mcarmonaa deleted the feature/docsrv branch October 11, 2017 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants