Reformat files according to template
[oam.git] / code / network-generator / CONTRIBUTING.md
1 # How to develop on this project
2
3 network_generation welcomes contributions from the community.
4
5 **You need PYTHON3!**
6
7 This instructions are for linux base systems. (Linux, MacOS, BSD, etc.)
8 ## Setting up your own fork of this repo.
9
10 - Clone this repo. 
11 ```
12   git clone "https://gerrit.o-ran-sc.org/r/oam" && (cd "oam" && mkdir -p `git rev-parse --git-dir`/hooks/ && curl -Lo `git rev-parse --git-dir`/hooks/commit-msg https://gerrit.o-ran-sc.org/r/tools/hooks/commit-msg && chmod +x `git rev-parse --git-dir`/hooks/commit-msg)
13 ```
14 - Enter the directory `cd oam/code/network-generation`
15 - Please see [O-RAN-SC Code Contributions Tutorial](https://wiki.o-ran-sc.org/display/ORAN/Tutorial%3A+Making+code+contributions+to+O-RAN+open+source+project)
16
17 ## Prerequisites
18
19 ```
20 pip install isort
21 pip install black
22 ```
23
24 ## Setting up your own virtual environment
25
26 Run `make virtualenv` to create a virtual environment.
27 then activate it with `source .venv/bin/activate`.
28
29 ## Install the project in develop mode
30
31 Run `make install` to install the project in develop mode.
32
33 ## Run the tests to ensure everything is working
34
35 Run `make test` to run the tests.
36
37 ## Create a new branch to work on your contribution
38
39 Run `git checkout -b my_contribution`
40
41 ## Make your changes
42
43 Edit the files using your preferred editor. (we recommend VIM or VSCode)
44
45 ## Format the code
46
47 Run `make fmt` to format the code.
48
49 ## Run the linter
50
51 Run `make lint` to run the linter.
52
53 ## Test your changes
54
55 Run `make test` to run the tests.
56
57 Ensure code coverage report shows `100%` coverage, add tests to your PR.
58
59 ## Build the docs locally
60
61 Run `make docs` to build the docs.
62
63 Ensure your new changes are documented.
64
65 ## Commit your changes
66
67 This project uses [conventional git commit messages](https://www.conventionalcommits.org/en/v1.0.0/).
68
69 Example: `fix(package): update setup.py arguments 🎉` (emojis are fine too)
70
71 ## Push your changes to your fork
72
73 Run `git push origin my_contribution`
74
75 ## Submit a pull request
76
77 On github interface, click on `Pull Request` button.
78
79 Wait CI to run and one of the developers will review your PR.
80 ## Makefile utilities
81
82 This project comes with a `Makefile` that contains a number of useful utility.
83
84 ```bash 
85 ❯ make
86 Usage: make <target>
87
88 Targets:
89 help:             ## Show the help.
90 install:          ## Install the project in dev mode.
91 fmt:              ## Format code using black & isort.
92 lint:             ## Run pep8, black, mypy linters.
93 test: lint        ## Run tests and generate coverage report.
94 watch:            ## Run tests on every change.
95 clean:            ## Clean unused files.
96 virtualenv:       ## Create a virtual environment.
97 release:          ## Create a new tag for release.
98 docs:             ## Build the documentation.
99 switch-to-poetry: ## Switch to poetry package manager.
100 init:             ## Initialize the project based on an application template.
101 ```
102
103 ## Making a new release
104
105 This project uses [semantic versioning](https://semver.org/) and tags releases with `X.Y.Z`
106 Every time a new tag is created and pushed to the remote repo, github actions will
107 automatically create a new release on github and trigger a release on PyPI.
108
109 For this to work you need to setup a secret called `PIPY_API_TOKEN` on the project settings>secrets, 
110 this token can be generated on [pypi.org](https://pypi.org/account/).
111
112 To trigger a new release all you need to do is.
113
114 1. If you have changes to add to the repo
115     * Make your changes following the steps described above.
116     * Commit your changes following the [conventional git commit messages](https://www.conventionalcommits.org/en/v1.0.0/).
117 2. Run the tests to ensure everything is working.
118 4. Run `make release` to create a new tag and push it to the remote repo.
119
120 the `make release` will ask you the version number to create the tag, ex: type `0.1.1` when you are asked.
121
122 > **CAUTION**:  The make release will change local changelog files and commit all the unstaged changes you have.