-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Contributing #109
base: master
Are you sure you want to change the base?
Contributing #109
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,125 @@ | ||||||||||
# Contribution Guide - How to Setup Environment | ||||||||||
|
||||||||||
# WARNING - 19 Apr 2020 - The below creates an environment where you can successfully run the tests | ||||||||||
|
||||||||||
# However it still needs testing again; and also needs worked example on actually contributing 'value' and not putting noise back into the repository! | ||||||||||
|
||||||||||
Whilst using Diagrams is easy and some folks will find setting up and extending Diagrams easy - for others with Python, Bash and Go dependancies it is harder... | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
So a worked guide to setting up a VM with linux so you can contribute to Diagrams. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
Thanks: Thanks to ViktorOrda for assist on getting this to work. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
This guide was written using ubuntu 18.04 on Azure. | ||||||||||
|
||||||||||
## VM | ||||||||||
Easiest and cleanest way is to boot a new Linux VM on your cloud provide of choice. | ||||||||||
* 16 GB HDD is more than enough | ||||||||||
* 2 GB Ram is more than enough | ||||||||||
|
||||||||||
## Required Software | ||||||||||
|
||||||||||
To contribute to Diagrams you will need the required software (all installed from command prompt): | ||||||||||
|
||||||||||
* Update apt (so you can find stuff) | ||||||||||
```shell | ||||||||||
sudo apt update | ||||||||||
``` | ||||||||||
|
||||||||||
* Python - You want version 3 (Diagrams needs this) | ||||||||||
```shell | ||||||||||
python --version | ||||||||||
``` | ||||||||||
If this returns a 2.7.x type number you are going to have to check python 3 is installed; You need Python 3.6.x | ||||||||||
|
||||||||||
```shell | ||||||||||
python3 --version | ||||||||||
``` | ||||||||||
If Python3 does not return a suitable version you will need to install Python3. | ||||||||||
```shell | ||||||||||
sudo apt-get install python3 | ||||||||||
``` | ||||||||||
|
||||||||||
Then to make sure the Diagrams autogen.sh script will work correctly we need to make the alias for 'python' to map to python3. | ||||||||||
To make python3 the default run this: | ||||||||||
```shell | ||||||||||
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10 | ||||||||||
|
||||||||||
|
||||||||||
NOT: sudo update-alternatives --set python /usr/bin/python3.6 | ||||||||||
``` | ||||||||||
Or Google 'how to alias python3 to python' and similar to get into the whole aliasing topic. | ||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
* pip (to make your life easier) - will probably report already installed. | ||||||||||
```shell | ||||||||||
sudo apt install python3-pip | ||||||||||
``` | ||||||||||
* Git | ||||||||||
```shell | ||||||||||
sudo apt install git | ||||||||||
``` | ||||||||||
* Go | ||||||||||
* Security warning (hence --classic) and hence why use VM | ||||||||||
```shell | ||||||||||
sudo snap install go --classic | ||||||||||
``` | ||||||||||
|
||||||||||
* Black (used by autogen.sh) | ||||||||||
```shell | ||||||||||
pip3 install black | ||||||||||
``` | ||||||||||
Comment on lines
+69
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can let poetry install |
||||||||||
|
||||||||||
*NOW DISCONNECT from SSH and reconnect* (to reset your environment path otherwise Black won't work) | ||||||||||
|
||||||||||
## Requirements as per Contributing page | ||||||||||
* Round | ||||||||||
```shell | ||||||||||
go get github.com/mingrammer/round | ||||||||||
sudo cp go/bin/round /bin | ||||||||||
``` | ||||||||||
|
||||||||||
* Inkscape | ||||||||||
```shell | ||||||||||
sudo apt install inkscape | ||||||||||
``` | ||||||||||
* Convert | ||||||||||
```shell | ||||||||||
pip install convert | ||||||||||
``` | ||||||||||
Comment on lines
+87
to
+90
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you saved me probably at least (:trollface: ) 15 minutes on this one 🙏 . → ./autogen.sh
image magick is not installed A quick search in the codebase shows that it's fixed by installing brew install imagemagick |
||||||||||
|
||||||||||
## Grab the Diagrams Code | ||||||||||
```shell | ||||||||||
git clone https://github.com/mingrammer/diagrams.git | ||||||||||
``` | ||||||||||
## To Run the Autogen | ||||||||||
```shell | ||||||||||
cd diagrams | ||||||||||
./autogen.sh | ||||||||||
``` | ||||||||||
|
||||||||||
# Actually Building the solution and installing diagrams; getting tests to pass | ||||||||||
|
||||||||||
Whilst ./autogen.sh works the tests don't (because Diagrams isn't actually installed yet) and also as Diagrams isn't installed you can generate any pictures i.e. test your contribution | ||||||||||
So some more things to install before you can run Diagrams. | ||||||||||
|
||||||||||
*Be careful here as you will create folders in the diagrams folder that you don't want to contribute back into the repository!* | ||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
```shell | ||||||||||
sudo apt-get install graphviz | ||||||||||
sudo pip install poetry | ||||||||||
sudo apt-get install python3-venv | ||||||||||
poetry build | ||||||||||
poetry install | ||||||||||
``` | ||||||||||
|
||||||||||
Now from the diagrams folder run: | ||||||||||
```shell | ||||||||||
python -m unittest tests/*.py -v | ||||||||||
``` | ||||||||||
and all the tests should pass. | ||||||||||
|
||||||||||
|
||||||||||
Comment on lines
+123
to
+125
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.