From cbdb3c52ee47d804b4202c77082109ef3c561594 Mon Sep 17 00:00:00 2001 From: Martin Skorupski Date: Fri, 3 Nov 2023 12:38:52 +0100 Subject: [PATCH] Prepare project for python template - gitignore created - Contribution.md created - History.md created - Manifest.in created - requiremetns.txt created Issue-ID: OAM-380 Change-Id: Idf288bca3ae2eb7483b4a7bddba37c354cc3d387 Signed-off-by: Martin Skorupski --- code/network-generator/CONTRIBUTING.md | 116 ++++++++++++++++++++++++++++++++ code/network-generator/HISTORY.md | 6 ++ code/network-generator/MANIFEST.in | 19 ++++++ code/network-generator/requirements.txt | 15 +++++ 4 files changed, 156 insertions(+) create mode 100644 code/network-generator/CONTRIBUTING.md create mode 100644 code/network-generator/HISTORY.md create mode 100644 code/network-generator/MANIFEST.in create mode 100644 code/network-generator/requirements.txt diff --git a/code/network-generator/CONTRIBUTING.md b/code/network-generator/CONTRIBUTING.md new file mode 100644 index 0000000..edddb6f --- /dev/null +++ b/code/network-generator/CONTRIBUTING.md @@ -0,0 +1,116 @@ +# How to develop on this project + +network_generation welcomes contributions from the community. + +**You need PYTHON3!** + +This instructions are for linux base systems. (Linux, MacOS, BSD, etc.) +## Setting up your own fork of this repo. + +- Clone this repo. +``` + 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) +``` +- Enter the directory `cd oam/code/network-generation` +- 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) + + +## Setting up your own virtual environment + +Run `make virtualenv` to create a virtual environment. +then activate it with `source .venv/bin/activate`. + +## Install the project in develop mode + +Run `make install` to install the project in develop mode. + +## Run the tests to ensure everything is working + +Run `make test` to run the tests. + +## Create a new branch to work on your contribution + +Run `git checkout -b my_contribution` + +## Make your changes + +Edit the files using your preferred editor. (we recommend VIM or VSCode) + +## Format the code + +Run `make fmt` to format the code. + +## Run the linter + +Run `make lint` to run the linter. + +## Test your changes + +Run `make test` to run the tests. + +Ensure code coverage report shows `100%` coverage, add tests to your PR. + +## Build the docs locally + +Run `make docs` to build the docs. + +Ensure your new changes are documented. + +## Commit your changes + +This project uses [conventional git commit messages](https://www.conventionalcommits.org/en/v1.0.0/). + +Example: `fix(package): update setup.py arguments 🎉` (emojis are fine too) + +## Push your changes to your fork + +Run `git push origin my_contribution` + +## Submit a pull request + +On github interface, click on `Pull Request` button. + +Wait CI to run and one of the developers will review your PR. +## Makefile utilities + +This project comes with a `Makefile` that contains a number of useful utility. + +```bash +❯ make +Usage: make + +Targets: +help: ## Show the help. +install: ## Install the project in dev mode. +fmt: ## Format code using black & isort. +lint: ## Run pep8, black, mypy linters. +test: lint ## Run tests and generate coverage report. +watch: ## Run tests on every change. +clean: ## Clean unused files. +virtualenv: ## Create a virtual environment. +release: ## Create a new tag for release. +docs: ## Build the documentation. +switch-to-poetry: ## Switch to poetry package manager. +init: ## Initialize the project based on an application template. +``` + +## Making a new release + +This project uses [semantic versioning](https://semver.org/) and tags releases with `X.Y.Z` +Every time a new tag is created and pushed to the remote repo, github actions will +automatically create a new release on github and trigger a release on PyPI. + +For this to work you need to setup a secret called `PIPY_API_TOKEN` on the project settings>secrets, +this token can be generated on [pypi.org](https://pypi.org/account/). + +To trigger a new release all you need to do is. + +1. If you have changes to add to the repo + * Make your changes following the steps described above. + * Commit your changes following the [conventional git commit messages](https://www.conventionalcommits.org/en/v1.0.0/). +2. Run the tests to ensure everything is working. +4. Run `make release` to create a new tag and push it to the remote repo. + +the `make release` will ask you the version number to create the tag, ex: type `0.1.1` when you are asked. + +> **CAUTION**: The make release will change local changelog files and commit all the unstaged changes you have. diff --git a/code/network-generator/HISTORY.md b/code/network-generator/HISTORY.md new file mode 100644 index 0000000..8d7e1ee --- /dev/null +++ b/code/network-generator/HISTORY.md @@ -0,0 +1,6 @@ +Changelog +========= + +0.1.0 (2023-12-??) +------------------ +- Initial version for O-RAN-SC I-Release diff --git a/code/network-generator/MANIFEST.in b/code/network-generator/MANIFEST.in new file mode 100644 index 0000000..2a78d95 --- /dev/null +++ b/code/network-generator/MANIFEST.in @@ -0,0 +1,19 @@ +# Copyright 2023 highstreet technologies GmbH +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +include ../../LICENSES +include HISTORY.md +# include Containerfile +# graft tests +# graft network_generation diff --git a/code/network-generator/requirements.txt b/code/network-generator/requirements.txt new file mode 100644 index 0000000..de6de74 --- /dev/null +++ b/code/network-generator/requirements.txt @@ -0,0 +1,15 @@ +# Copyright 2023 highstreet technologies GmbH +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# none at this point in time \ No newline at end of file -- 2.16.6