Download & install
- Go to the libRainbow github webpage: Click here!
- Find the “Open with GitHub Desktop” in the “code” dropdown.
- Press “Open URL:x-github-client” in the following popup
- Wait for the download to finish. Thereafter execute the installation program
- Open the “GitHub desktop” app. Control that your working repository is the libRainbow 5.1 In Case your working repository is not libRainbow 5.2 Press “Sign-in” 5.2 Sign-in with your github account. Recommendation: Use firefox or chrome for the sign-in browser
- Press “Authorize desktop”
- Press “Open GitHubDesktop.exe”
-
Congratulation, you are done with the installation. If it does not work, don’t hesitate to contact the maintainer
- Next: Before uploading your code, you need to create an issue and create a branch. The main branch is not for development.
Create Issue and Branch
- First open “GitHub Desktop”. Then, Find the “Create issue on GitHub” button from the the “Repository” dropdown
- Follow the link to the GitHub webpage.
- Write title. Describe the problem you are trying to solve in one sentence
- Write describtion. Elaborate on what your problem is. State any crucial assumptions.
- Assign Assignees
- Assign label
- Submit issue
- Remember the issue number. The issue number will be needed for the branch name.
- Find the “New branch” button in the “Branch” dropdown
- Create branch page
- Name: Use the issue number: “< issue number >b””
- Make sure, that you branch from the main branch
- Press “Create branch”
- Press “Publish branch”
- Select your branch
Upload code
- We have coded a new simulator that we want to submit to the libRAINBOW repository for this example.
Therefore we start by navigating to the simulator folder. Then, if you have made another implementation, such as a mathematical module, you place it in the math folder. In the simulation folder, create a new folder with your implementation name. In this case, “new_simulator”.
- Then, in your newly created folder, insert your implementation.
- Open “GitHub Desktop”. Ensure that all your implementation is visible in “changed file”.
- Write title use the format: < issue number >: your commit messages. Thereafter, write a short description. Then press “commit”.
- Press “Push origin”
- Return to the GitHub webpage. Press “Compare & pull results”
- Define “pull results”
- Assign Reviewers
- Assign Assignees
- Assign Label
- Assign Issue
- Before merge -> All revierwers mus approve
- Before merge -> All tests must pass
- Then press “Squash and merge”
- Next, adding unittest to your code.
Make Unittest
- Consider the following module. We have created two functions for testing—a function that works and a function that fails. The “Correct” function “simulator_func” and the “Incorrect” function “simulator_func_error”.
- First, insert the module in the correct folder. In this case libRAINBOW > python > isl > simulators > new_simulator
- Then adding test. Navigate to the test folder.
- In the test folder. Create a new folder, use the format: < test_< your name > >. In this case: test_new_simulator
- Navigate to your newly created folder
- Create a test file using the format < test_ < your name ». In this case test_new_simulator.
- In your test file. Copy all the imports and sys.path..
To test your implementation, you need to import it:
isl.simulators.< Your implementation folder >.< Simulator name> as sn.
In this case:
isl.simulators.new_simulators.brandNewSimulator as bns
- We use the unittest framework, therefore you need to define a test class. First, inherit from the “unittest” module. Then every member function must start with the prefix “test_”. Third, give the self variable as parameter to all member functions. For adding the test.
- For testing a Numpy array, start by importing the Numpy library. Then import “utils”. Finally, to test if two arrays are equal, use the “array_equal”.
- Ensure that all your test and implementation is shown in “GitHub Desktop”
- Make a commit to you branch. Use the same name format as before
- Press “Push Origin”
- In case of a test fail, click details.
- If all test passed and all reviewers approves, you are allowed to merge
Documentation
- Change to the “gh-pages” branch
- Navigate to “_documentation_pages” folder
- Copy paste the .template folder. Rename the copy using the format:
< folder name >_< file name >_< function name >.md
- The template should look like this
- Type the needed information eg.