Prepare project for python 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
18 ## Setting up your own virtual environment
19
20 Run `make virtualenv` to create a virtual environment.
21 then activate it with `source .venv/bin/activate`.
22
23 ## Install the project in develop mode
24
25 Run `make install` to install the project in develop mode.
26
27 ## Run the tests to ensure everything is working
28
29 Run `make test` to run the tests.
30
31 ## Create a new branch to work on your contribution
32
33 Run `git checkout -b my_contribution`
34
35 ## Make your changes
36
37 Edit the files using your preferred editor. (we recommend VIM or VSCode)
38
39 ## Format the code
40
41 Run `make fmt` to format the code.
42
43 ## Run the linter
44
45 Run `make lint` to run the linter.
46
47 ## Test your changes
48
49 Run `make test` to run the tests.
50
51 Ensure code coverage report shows `100%` coverage, add tests to your PR.
52
53 ## Build the docs locally
54
55 Run `make docs` to build the docs.
56
57 Ensure your new changes are documented.
58
59 ## Commit your changes
60
61 This project uses [conventional git commit messages](https://www.conventionalcommits.org/en/v1.0.0/).
62
63 Example: `fix(package): update setup.py arguments 🎉` (emojis are fine too)
64
65 ## Push your changes to your fork
66
67 Run `git push origin my_contribution`
68
69 ## Submit a pull request
70
71 On github interface, click on `Pull Request` button.
72
73 Wait CI to run and one of the developers will review your PR.
74 ## Makefile utilities
75
76 This project comes with a `Makefile` that contains a number of useful utility.
77
78 ```bash 
79 ❯ make
80 Usage: make <target>
81
82 Targets:
83 help:             ## Show the help.
84 install:          ## Install the project in dev mode.
85 fmt:              ## Format code using black & isort.
86 lint:             ## Run pep8, black, mypy linters.
87 test: lint        ## Run tests and generate coverage report.
88 watch:            ## Run tests on every change.
89 clean:            ## Clean unused files.
90 virtualenv:       ## Create a virtual environment.
91 release:          ## Create a new tag for release.
92 docs:             ## Build the documentation.
93 switch-to-poetry: ## Switch to poetry package manager.
94 init:             ## Initialize the project based on an application template.
95 ```
96
97 ## Making a new release
98
99 This project uses [semantic versioning](https://semver.org/) and tags releases with `X.Y.Z`
100 Every time a new tag is created and pushed to the remote repo, github actions will
101 automatically create a new release on github and trigger a release on PyPI.
102
103 For this to work you need to setup a secret called `PIPY_API_TOKEN` on the project settings>secrets, 
104 this token can be generated on [pypi.org](https://pypi.org/account/).
105
106 To trigger a new release all you need to do is.
107
108 1. If you have changes to add to the repo
109     * Make your changes following the steps described above.
110     * Commit your changes following the [conventional git commit messages](https://www.conventionalcommits.org/en/v1.0.0/).
111 2. Run the tests to ensure everything is working.
112 4. Run `make release` to create a new tag and push it to the remote repo.
113
114 the `make release` will ask you the version number to create the tag, ex: type `0.1.1` when you are asked.
115
116 > **CAUTION**:  The make release will change local changelog files and commit all the unstaged changes you have.