Skip to content

Commit

Permalink
Contributing update and completions filtering (#191)
Browse files Browse the repository at this point in the history
* Contributing update and completions filtering

* frontend diff

---------

Co-authored-by: Red-Giuliano <red.giuliano@zero-true.com>
  • Loading branch information
Red-Giuliano and Red-Giuliano authored Mar 1, 2024
1 parent fe845a1 commit 1477a2d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 18 deletions.
47 changes: 30 additions & 17 deletions CONTIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
# Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
Communicate with the maintainers of the repo and let us know what you're planning on doing! We will have to maintain the features in the long run so we have to carefully consider what
to add and what to leave as an external dependency. We are working on creating a way for users to create external components and plugins that can be installed... stay tuned for
instructions on how to do that!

Please note we have a code of conduct, please follow it in all your interactions with the project.

## Pull Request Process

1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
2. Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters.
3. Increase the version numbers in any examples files and the README.md to the new version that this Pull Request would represent.
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you.

---

# Welcome to GitHub Docs Contributing Guide

Thank you for investing your time in contributing to our project! Any contribution you make will be reflected on docs.github.com ✨.
Thank you for investing your time in contributing to our project! Any contribution you make will be reflected in zero-true!

Read our [Code of Conduct](#code-of-conduct) to keep our community approachable and respectable.

Expand All @@ -29,24 +23,43 @@ In this guide you will get an overview of the contribution workflow from opening

## New Contributor Guide

To get an overview of the project, read the README file. Here are some resources to help you get started with open source contributions:
To get an overview of the project, read the README file. Here are some resources to help you get started with open source contributions if this is something completely new to you:

- [Finding ways to contribute to open source on GitHub](https://docs.github.com/en/get-started/exploring-projects-on-github/finding-ways-to-contribute-to-open-source-on-github)
- [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git)
- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)

## Getting Started

To navigate our codebase with confidence, learn omre about pydantic (for type safety of the python side), sphynx (for building docs), and Vuetify for our frontend.
To navigate our codebase with confidence, learn more about pydantic (for type safety of the python side),fastapi, sphynx (for building docs), pytest/selenium for testing
and Vuetify for our frontend.

Check to see what types of contributions we accept before making changes. Some of them might not even require writing a single line of code ✨.
When you pip install zero-true it is packaged with two cli utilities:
```bash
zero-true notebook
```
```bash
zero-true-dev notebook
```

## Issues
When you type zero-true in your terminal it will open a regular notebook. On the other hand zero-true-dev is the cli we use when we want to be able to
hot reload and see any changes to the interface or backend during development. This makes testing any changes that you make quick and easy. In order to use
the dev cli you need to have access to the source code which means you need to fork and then clone our repo. Then clone the code you've forked, navigate into
the directory with the source code and simply run zero-true-dev from the cli. The steps to do this are included below:

### Create a New Issue
```bash
git clone https://github.com/[YOUR-USERNAME]/zero-true.git
cd zero-true
zero-true-dev notebook
```

This will launch a notebook in dev mode. Make changes to either the frontend or backend and watch the changes hot reload.

## Issues

If you spot a problem with the docs, search if an issue already exists. If a related issue doesn't exist, you can open a new issue using a relevant issue form.
If you run into any issues that you suspect are bugs please check the issues in our repo to see if we have any open issues about already and if so please contribute to that discussion.
It is always helful to have a minimal reproducible example so that anyone debugging can spin up a notebook, run your code in it and then try to diagnose the problem.

### Solve an Issue

Scan through our existing issues to find one that interests you. You can narrow down the search using labels as filters. See Labels for more information. As a general rule, we don’t assign issues to anyone. If you find an issue to work on, you are welcome to open a PR with a fix.
If you'd like to solve one of our open issues please get in touch first! As we noted above not every issue/feature request is something that we can actively maintain!
10 changes: 10 additions & 0 deletions zt_backend/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ def write_notebook():
logger.debug("Toml saved for notebook %s", zt_notebook.notebookId)

def get_code_completions(cell_id:str, code: str, line: int, column: int) -> list:

code_list = code.split("\n")
try:
last_char = code_list[line-1][column-1]
if last_char in ['.', '(', '[', '{']:
return {"cell_id": cell_id, "completions": []}

except Exception as e:
logger.info("Error formatting completions for cell_id %s: %s", cell_id, traceback.format_exc())

try:
script = jedi.Script(code)
completions = script.complete(line, column)
Expand Down
1 change: 0 additions & 1 deletion zt_frontend/src/components/CodeComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ import Cell from '@/components/Cell.vue'
import { inlineSuggestion } from 'codemirror-extension-inline-suggestion'
export default {
components: {
"cell": Cell,
Expand Down

0 comments on commit 1477a2d

Please sign in to comment.