|
1 | | -### *easyPythonpi* |
| 1 | +<!-- Replace this with your own banner image or animation --> |
2 | 2 |
|
3 | | -### >Add new methods to easyPythonpi.py file only |
| 3 | +# easyPythonpi |
| 4 | +<br> |
| 5 | + |
| 6 | +<u> |
| 7 | + <h1>Introduction </h1> |
| 8 | +</u> |
| 9 | + |
| 10 | +**easyPythonpi** is a beginner-friendly Python library that focuses on simple calculations. It's designed to encourage open-source contributions, making it an ideal project for newcomers to programming and open source. |
| 11 | +<br> |
| 12 | + |
| 13 | +<u> |
| 14 | + <h3>Getting Started</h3> |
| 15 | +</u> |
| 16 | + |
| 17 | +<br> |
| 18 | +<details> |
| 19 | +<summary>🔍 Fork the Repository</summary> |
| 20 | +<br> |
| 21 | + |
| 22 | +1. Fork this repository by clicking the "Fork" button in the top-right corner of this page. Alternatively, you can fork it directly from [here](https://github.com/extinctsion/easyPy/fork). |
| 23 | +</details> |
| 24 | + |
| 25 | +<details> |
| 26 | +<summary>📥 Clone the Repository</summary> |
| 27 | +<br> |
| 28 | + |
| 29 | +2. Clone your forked repository to your local computer using the following command. Replace `url_you_just_copied` with the URL of your forked repository. |
| 30 | + |
| 31 | + ```sh |
| 32 | + git clone url_you_just_copied |
| 33 | + ``` |
| 34 | +</details> |
| 35 | + |
| 36 | +<details> |
| 37 | +<summary>📂 Open the Repository</summary> |
| 38 | +<br> |
| 39 | + |
| 40 | +3. Open the cloned repository in your preferred code editor. Additionally, open a terminal within the repository directory. |
| 41 | + |
| 42 | + ```sh |
| 43 | + cd easyPythonpi |
| 44 | + ``` |
| 45 | +</details> |
| 46 | + |
| 47 | +<details> |
| 48 | +<summary>🌿 Create a New Branch</summary> |
| 49 | +<br> |
| 50 | + |
| 51 | +4. Create a new branch for your changes. Replace `username` with your GitHub username in the following command: |
| 52 | + |
| 53 | + ```sh |
| 54 | + git checkout -b username |
| 55 | + ``` |
| 56 | +</details> |
| 57 | + |
| 58 | +<details> |
| 59 | +<summary>🚀 Contribute Code</summary> |
| 60 | +<br> |
| 61 | + |
| 62 | +5. Add your new methods or functions to the `easyPythonpi.py` file within the codebase. Ensure that your code adheres to the coding style and conventions used in the existing code for consistency. For example: |
| 63 | + |
| 64 | + ```python |
| 65 | + def calculate_average(numbers): |
| 66 | + """Calculate the average of a list of numbers.""" |
| 67 | + if len(numbers) == 0: |
| 68 | + return 0 |
| 69 | + return sum(numbers) / len(numbers) |
| 70 | + ``` |
| 71 | +</details> |
| 72 | +
|
| 73 | +<details> |
| 74 | +<summary>📝 Commit Your Changes</summary> |
| 75 | +<br> |
| 76 | +
|
| 77 | +6. Once you've added your code, commit your changes to GitHub using the following commands. Make sure you execute them in the precise order, one after another, in your terminal. |
| 78 | +
|
| 79 | + ```sh |
| 80 | + # Stage your changes |
| 81 | + git add . |
| 82 | +
|
| 83 | + # Commit your changes with a descriptive message |
| 84 | + git commit -m "Hacktoberfest contribution" |
4 | 85 |
|
5 | | -*A simple pyhton library for the beginners. The program includes simple calulations. Made for raising pull requests.* |
6 | | -Only simple functions are used to make the code beginner friendly :) |
| 86 | + # Push your changes to your GitHub repository |
| 87 | + git push -u origin your_github_username |
| 88 | + ``` |
| 89 | +</details> |
7 | 90 |
|
8 | | -1. Fork this repository by click the Fork button in the top right of this page or simply [click here](https://github.com/extinctsion/easyPy/fork). |
9 | | -2. Once it is forked, clone the repository in your computer. For this, copy the URL in the address bar, and use the following command: |
| 91 | +<details> |
| 92 | +<summary>📢 Open a Pull Request</summary> |
| 93 | +<br> |
| 94 | +
|
| 95 | +7. Navigate to your forked repository on GitHub. You'll see a yellow box at the top indicating that some changes have been pushed. Click the "Compare & pull request" button. |
| 96 | +
|
| 97 | +8. Submit your pull request by adding a title and description. Congratulations, you have successfully opened a pull request in this repository. |
| 98 | +
|
| 99 | + *Note: To complete the Hacktoberfest challenge, you need to open four valid pull requests. If you've followed the above steps, you've already opened one pull request, and you need three more.* |
| 100 | +</details> |
| 101 | +<br> |
| 102 | +
|
| 103 | +<u> |
| 104 | + <h2>Running Test Cases</h2> |
| 105 | +</u> |
| 106 | +<br> |
| 107 | +
|
| 108 | +To ensure the reliability of your contributions and modifications, it's important to run test cases for the **easyPythonpi** library. |
| 109 | +
|
| 110 | +### Prerequisites |
| 111 | +
|
| 112 | +Before running the test cases, ensure you have the following prerequisites installed on your system: |
| 113 | +
|
| 114 | +- [Python](https://www.python.org/downloads/): The Python programming language. |
| 115 | +
|
| 116 | +<details> |
| 117 | +<summary>🧪 Run Test Cases</summary> |
| 118 | +<br> |
| 119 | +
|
| 120 | +1. Install the required dependencies using pip: |
| 121 | +
|
| 122 | + ```sh |
| 123 | + pip install -r requirements.txt |
| 124 | + ``` |
| 125 | +2. Navigate to the project directory in your terminal. |
| 126 | +3. Run the test suite: |
10 | 127 |
|
11 | | -```sh |
12 | | -git clone url_you_just_copied |
13 | | -``` |
| 128 | + ```sh |
| 129 | + python tests.py |
| 130 | + ``` |
14 | 131 |
|
15 | | -4. Open this cloned repository in your preferred code editor as shown below. Also, open a terminal in this directory. |
16 | | -(Use this command if you are using Linux distribution) |
| 132 | + The test suite will execute, and you'll see the test results in your terminal. Ensure that all tests pass before making any contributions or modifications. |
| 133 | +</details> |
| 134 | +<br> |
| 135 | +
|
| 136 | +<u> |
| 137 | + <h2>Setting Up a Virtual Environment (Optional)</h2> |
| 138 | +</u> |
| 139 | +<br> |
| 140 | +
|
| 141 | +Working in a virtual environment is a good practice as it isolates project dependencies from your global Python environment. |
17 | 142 |
|
18 | | -```sh |
19 | | -cd easyPythonpi |
20 | | -``` |
| 143 | +<details> |
| 144 | +<summary>🔮 Prerequisites</summary> |
| 145 | +<br> |
| 146 | +
|
| 147 | +Before setting up a virtual environment, ensure you have Python installed on your system. |
| 148 | +</details> |
21 | 149 |
|
22 | | -5. Now type in the following command in the terminal and replace `username` with your GitHub username. (This command is necessary or it will prompt errors.) |
| 150 | +<details> |
| 151 | +<summary>📦 Install and Activate a Virtual Environment</summary> |
| 152 | +<br> |
23 | 153 |
|
24 | | -```sh |
25 | | -git checkout -b username |
26 | | -``` |
| 154 | +4. Create a virtual environment (you can replace `venv` with your preferred environment name): |
27 | 155 |
|
| 156 | + ```sh |
| 157 | + python -m venv venv |
| 158 | + ``` |
28 | 159 |
|
29 | | -6. Inert new functions to the code. |
30 | | -``` |
31 | | - Your code appear here |
32 | | -``` |
| 160 | +5. Activate the virtual environment: |
33 | 161 |
|
34 | | -7. Once you have done all this, commit your changes to GitHub. You can do this with the following commands. Make sure you execute them in the precise order one after another in your terminal. |
| 162 | + - On Windows: |
35 | 163 |
|
36 | | -```sh |
37 | | -# copy and paste the following in the terminal |
38 | | -git add . |
| 164 | + ```sh |
| 165 | + venv\Scripts\activate |
| 166 | + ``` |
39 | 167 |
|
40 | | -# copy and paste the following in the terminal after you have executed the previous command |
41 | | -git commit -m "hacktoberfest contribution" |
| 168 | + - On macOS and Linux: |
42 | 169 |
|
43 | | -# copy and paste the following in the terminal after you have executed the previous command |
44 | | -git push -u origin your_github_username |
45 | | -``` |
| 170 | + ```sh |
| 171 | + source venv/bin/activate |
| 172 | + ``` |
46 | 173 |
|
47 | | -8. Now open the forked repository on your GitHub. You will see a yellow box at the top telling you that some changes are pushed. You will also see a button called `Compare & pull request`. Click on it. |
48 | | -9. Now add a title, some description! |
49 | | - You have successfully opened a pull request in this repository. |
| 174 | +6. Install `unittest` (if not already installed): |
50 | 175 |
|
51 | | -*You need to open **four** valid pull requests in order to complete the challenge. If you have performed the above steps, you have already opened one pull request. And you need only three more.* |
| 176 | + ```sh |
| 177 | + pip install unittest |
| 178 | + ``` |
| 179 | +</details> |
52 | 180 |
|
| 181 | +<details> |
| 182 | +<summary>🔬 Run the Test Cases within the Virtual Environment</summary> |
53 | 183 | <br> |
54 | 184 |
|
55 | | ->Note: Those repositories who have `hacktoberfest` as a label are considered for Hacktoberfest challenge only. |
| 185 | +7. Run the test cases as mentioned above. |
| 186 | +</details> |
| 187 | +
|
| 188 | +<details> |
| 189 | +<summary>🔓 Deactivate the Virtual Environment (when done)</summary> |
| 190 | +<br> |
| 191 | +
|
| 192 | +8. When you're finished working on the project, deactivate the virtual environment: |
| 193 | +
|
| 194 | + ```sh |
| 195 | + deactivate |
| 196 | + ``` |
| 197 | +</details> |
| 198 | +<br> |
| 199 | +
|
| 200 | +# Hacktoberfest |
| 201 | +
|
| 202 | +Repositories with the `hacktoberfest` label are considered for the Hacktoberfest challenge. Your contributions to this project can help you achieve your Hacktoberfest goals. |
| 203 | +
|
| 204 | +Thank you for contributing to the open-source community! |
56 | 205 |
|
57 | | -Thanks for contributing to the Open source community. |
| 206 | +</div> |
0 commit comments