-
Notifications
You must be signed in to change notification settings - Fork 102
Contribute
The aim of this section is to assist those seeing to contribute. This section covers:
- How to Contribute
- Setting up a Development Environment
- Library Structure
- Your Code Contribution
- Open Issues
- Join the Slack Channel
To contribute, fork the repo and clone to your system using:
$ git clone https://github.com/<name-of-your-repo>/supplychainpy
A development environment can be set up using the Anaconda package management environment provided by Continuum Analytics.
-
Install Anaconda from Continuum Analytics.
-
Create a conda environment substituting
environment-name
with a memorable name:$ conda create -n environment-name python=3.5
-
Activate the environment:
Windows
C:\ activate environment-name
nix
$ source activate environment-name
-
Install requirements for development (make sure you are in the root folder of the supplychainpy library check to see if you can see the dev_requirements.txt file in the current folder):
```
$ pip install dev_requiments.txt
```
-
Run all the unit test to verify your environment is setup correctly. This may take some time depending on your machine; you might want to get some coffee. If any of the tests fail due to missing package, install the missing package:
$ python -m unittest discover tests/
-
All good? Awesome! Happy Dev'ing (if not check the issues board and raise a new issue. Make sure to copy and paste the output. In addition to posting an issue, hop on slack).
The library is structured for ease of maintenance. There is a separation between public and private modules, making refactoring or reimplementation less likely to break contracts and minimise non-compatible change to the API. This is a constant battle and the aim is to keep improving.
The public API consists of the following modules:
- model_inventory.py
- model_decisions.py
- model_demand.py
- simulate.py
Most of the public API modules have corresponding packages with the 'model_' prefix removed, containing the supporting classes and modules. Seperating the interface from the main code, allows easier refactoring and changes to the logic without breaking contracts.
Each issue marked as 'community' will contain information regarding the contribution. Any relevant module and class currently in the library, will be indicated.
Some tests for the public API may already be written. The tests may either be essential or for guidance and will be indicated accordingly. It is expected that any other tests required will be added by the contributor, to maintain a high level of coverage.
## Your Code ContributionAs much as possible, following the usual rules for good design is expected.
- Don't repeat yourself (DRY).
- Small functions, single purpose functions.
- Aim for orthogonality (package independence).
- Careful consideration of third party dependencies (let's talk about it)
Comments can quickly become obsolete and litter the code base, so use them sparingly.
For all functions please provide docstrings and examples. The Google style format followed in this library. If you are using an IDE like PyCharm then you can set this style as a default.
All public APIs must be accompanied by documentation in addition to the docstrings. The documentation should detail the functionality and an example. The documentation is located in the docs folder.
Sphinx is used to compile the documentation. All of the documentation is written in restructured text. The markup language guide for rst can be found here.
Add documentation with the following steps:
-
Add an '.rst' file to the main docs folder. Give the file an obvious file name that corresponds to the feature you have implemented.
-
Title the file and document the feature.
-
Add the new file's name to the index.rst file.
-
From the command line navigate to the
docs/
folder and run the following command (make sure you are in the environment with all the dev dependencies installed):$ make clean $ sphinx-apidocs -o . ../supplychainpy -f $ make html
Reach out! We want to build a friendly collaborative environment with plenty of healthy debate about the direction and the code. Send an email requesting an invite to our slack channel and we will get back to you ASAP.