Skip to content

Commit

Permalink
ADD: basic instructions for pyhton ghplugin
Browse files Browse the repository at this point in the history
  • Loading branch information
9and3 committed Apr 15, 2024
1 parent 0bf7ecd commit b88d852
Showing 1 changed file with 59 additions and 2 deletions.
61 changes: 59 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,64 @@ git commit -m "Remove a submodule name"
```

---
# PyPI
# Python
DiffCheck is distributed as a Python Grasshopperr plug-in via yak and its source code via PyPI. The plug-in is composed by a series of `.ghuser` components.

There are 3 ways you can contribute to the Python GH plug-in:
1. By adding new components to the plug-in.
2. By fixing bugs of existing components in the plug-in.
3. By adding new functionalities to existing components in the plug-in.

Before committing to the repository you need to have tested the components in the Grasshopper environment and be sure that this is working correctly. Also, provide a sufficient documentation in the PR (for now) please.

Follow these steps to develop and test the Python GH plug-in:
- [GHPy: A) preparation](#ghpy-a-preparation)
- [GHPy: B) development/debug](#ghpy-b-developmentdebug)
- [GHPy: C) Release](#ghpy-c-release)
- [GHPy: D) Documentation](#ghpy-d-documentation)

## GHPy: A) preparation
Download this repo if you haven't already.
```terminal
git clone https://github.com/diffCheckOrg/diffCheck.git
```

Next, if you used diffCheck before as an end-user clean all the `diffCheck folders` in the following directory (the last name will change):
```terminal
C:\Users\<user-name>\.rhinocode\py39-rh8\site-envs\default-wMh5LZL3
```
> note that if you drop an official released diffCheck component from yak, this one will have the `#r : diffCheck==<version_number>` notation at the top of the script. Get rid of all these release components before to start and be sur to erase again the previous folders (they recreated each time `#r : diffCheck` is called).
Lastly, install the pip pacakge from the repository in editable mode. This way, all the modifications made to the source code of the repository will be reflected in the installed package. Open a terminal and run the following command (replace the path with where you download the repository):
```terminal
C:\Users\<your-username>\.rhinocode\py39-rh8\python.exe -m pip install -e "<path-to-repository-root>\src\gh\diffCheck"
```

That's it you are now a contributor to the diffCheck! We raccomand to not download anymore from yak package but rather use the source code in the repository. If you want the latest diffCheck, checkout and pull the main.

## GHPy: B) development/debug

### Code structure
For DiffCheck there are 2 main folders in the repository:
* `src/gh/diffCheck/components` here you can add new components or modify existing ones (for more info on how to create one we point you to [this documentation](https://github.com/compas-dev/compas-actions.ghpython_components)). Here we call the
* `src/gh/diffCheck/diffCheck` this is our package where the core functionalities are implemented.

### IDE
We reccomand to use `VSCode` as IDE for developing the components. This is because it has a good integration with the `Grasshopper` environment and it is easy to debug the components. To set up the IDE follow these steps:
1. Install the `ScriptSync` extension for `VSCode`.
2. Install the `ScriptSync` from the yak manager in Rhino.
3. Open the `code.py` from the `src/gh/diffCheck/components` folder you are working on in `VSCode`, and set its path to the ScriptSync ghcomponent.
4. If you modify the code in `VSCode`, the changes will be reflected in the Grasshopper component as soon as you save in `VSCode` again the `code.py`.


## GHPy: C) Release
The release will be made via CI from main. As a contributor you don't need to worry about this. The plug-in is componentized, pushed to yak/PyPI and the user can download the latest version from yak.

## GHPy: D) Documentation
More to come.


<!-- ## PyPI
To push the package to PyPI, you need to:
1. Install the package `twine`:
```bash
Expand All @@ -76,7 +133,7 @@ index-servers=pypi
[pypi]
username = __token__
password = pypi-<your-TOKEN>
```
``` -->

---
# C++
Expand Down

0 comments on commit b88d852

Please sign in to comment.