Skip to content

Commit b88d852

Browse files
committed
ADD: basic instructions for pyhton ghplugin
1 parent 0bf7ecd commit b88d852

File tree

1 file changed

+59
-2
lines changed

1 file changed

+59
-2
lines changed

CONTRIBUTING.md

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,64 @@ git commit -m "Remove a submodule name"
4949
```
5050

5151
---
52-
# PyPI
52+
# Python
53+
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.
54+
55+
There are 3 ways you can contribute to the Python GH plug-in:
56+
1. By adding new components to the plug-in.
57+
2. By fixing bugs of existing components in the plug-in.
58+
3. By adding new functionalities to existing components in the plug-in.
59+
60+
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.
61+
62+
Follow these steps to develop and test the Python GH plug-in:
63+
- [GHPy: A) preparation](#ghpy-a-preparation)
64+
- [GHPy: B) development/debug](#ghpy-b-developmentdebug)
65+
- [GHPy: C) Release](#ghpy-c-release)
66+
- [GHPy: D) Documentation](#ghpy-d-documentation)
67+
68+
## GHPy: A) preparation
69+
Download this repo if you haven't already.
70+
```terminal
71+
git clone https://github.com/diffCheckOrg/diffCheck.git
72+
```
73+
74+
Next, if you used diffCheck before as an end-user clean all the `diffCheck folders` in the following directory (the last name will change):
75+
```terminal
76+
C:\Users\<user-name>\.rhinocode\py39-rh8\site-envs\default-wMh5LZL3
77+
```
78+
> 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).
79+
80+
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):
81+
```terminal
82+
C:\Users\<your-username>\.rhinocode\py39-rh8\python.exe -m pip install -e "<path-to-repository-root>\src\gh\diffCheck"
83+
```
84+
85+
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.
86+
87+
## GHPy: B) development/debug
88+
89+
### Code structure
90+
For DiffCheck there are 2 main folders in the repository:
91+
* `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
92+
* `src/gh/diffCheck/diffCheck` this is our package where the core functionalities are implemented.
93+
94+
### IDE
95+
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:
96+
1. Install the `ScriptSync` extension for `VSCode`.
97+
2. Install the `ScriptSync` from the yak manager in Rhino.
98+
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.
99+
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`.
100+
101+
102+
## GHPy: C) Release
103+
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.
104+
105+
## GHPy: D) Documentation
106+
More to come.
107+
108+
109+
<!-- ## PyPI
53110
To push the package to PyPI, you need to:
54111
1. Install the package `twine`:
55112
```bash
@@ -76,7 +133,7 @@ index-servers=pypi
76133
[pypi]
77134
username = __token__
78135
password = pypi-<your-TOKEN>
79-
```
136+
``` -->
80137

81138
---
82139
# C++

0 commit comments

Comments
 (0)