Skip to content

Commit 4865b24

Browse files
Update readme (#19)
* Updated README.md * Updated README.md * Fixed Github CI, set to 3.12 * Fixed Github CI, set to 3.12 and PyYAML to 6.0.2 * Fixed test_initializer.py
1 parent 36c452b commit 4865b24

File tree

5 files changed

+27
-16
lines changed

5 files changed

+27
-16
lines changed

.github/workflows/python-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Set up Python
2121
uses: actions/setup-python@v5
2222
with:
23-
python-version: '3.x'
23+
python-version: '3.12'
2424

2525
- name: Install dependencies (production)
2626
run: |

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ __pycache__/
1313
/config.yaml
1414
/dev/my_gitmodules/
1515
/dev/my_libs/
16+
venv/
17+

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# <img src=".github/logo_v2.png" alt="Not Gitmodules!" height="30" /> Not Gitmodules
1+
# <img src="https://raw.githubusercontent.com/a-jean-andreasian/not_gitmodules/refs/heads/master/.github/logo_v2.png" alt="Not Gitmodules!" height="30" /> Not Gitmodules
22

33
---
44

@@ -58,7 +58,7 @@ Choose the most convenient way to install Not Gitmodules:
5858

5959
2. **Install via a package manager** and use **as a Python package** _(example with pip)_:
6060

61-
![PyPI](https://img.shields.io/pypi/v/not-gitmodules)
61+
![PyPI](https://img.shields.io/pypi/v/not-gitmodules)
6262
```bash
6363
pip install not-gitmodules
6464
```
@@ -181,22 +181,22 @@ CMD ["python", "main.py"]
181181
182182
1. Not Gitmodules **doesn't require to keep the folders** with modules. You can safely .gitignore or delete them.
183183
2. **Do not use matching names** for the repositories in `notgitmodules.yaml` file. In that case only the first repository
184-
will be downloaded and the second one will be skipped.
184+
will be downloaded and the second one will be skipped.
185185
3. Not Gitmodules **needs** `Git` and `PyYAML` for functioning.
186186
4. Not Gitmodules, just like Gitmodules, **doesn't automatically install the dependencies of submodules** _(such as requirements.txt for Python or package.json for JavaScript)_.
187187
5. Not Gitmodules **doesn't download the sub-dependency submodules** (if they are not defined properly for Git).
188-
- Reason: it's practically inefficient, may lead to bugs and bottlenecks, and better to maintain manually.
189-
- Solution: Include the sub-dependency submodule to YAML file manually.
188+
- Reason: it's practically inefficient, may lead to bugs and bottlenecks, and better to maintain manually.
189+
- Solution: Include the sub-dependency submodule to YAML file manually.
190190
6. Not Gitmodules keeps the view of keeping the project structure clean. All submodules among one
191191
project/microservice need to go to one folder. It's recommended to use dependency injection in case of having nested `not_gitmodules`.
192-
7. **Possible bottleneck** with private repositories.
192+
7. **Possible bottleneck** with private repositories.
193193
- If cloning fails, but you have access to the repository, provide the HTTPS repo URL instead of SSH url in YAML file.
194-
194+
8. If your python version is incompatible with `PyYAML==6.0` try to install the compatible version of `PyYAML`.
195195

196196
---
197197

198198
<div style="text-align: center;">
199-
<img src=".github/pic1.png" width="300" height="300">
199+
<img src="https://raw.githubusercontent.com/a-jean-andreasian/not_gitmodules/refs/heads/master/.github/pic1.png" width="300" height="300">
200200
</div>
201201

202202
---
@@ -218,6 +218,6 @@ Armen-Jean Andreasian, 2024
218218
---
219219

220220
<div style="text-align: center;">
221-
<img src=".github/pic2.png" />
221+
<img src="https://raw.githubusercontent.com/a-jean-andreasian/not_gitmodules/refs/heads/master/.github/pic2.png" />
222222
</div>
223223

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
PyYAML~=6.0
1+
PyYAML==6.0.2

test_initializer.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@
44
from not_gitmodules import initializer
55
from not_gitmodules.cli import cli
66

7+
module_for_test = "https://github.com/not-gitmodules/notgitmodules-file-manager-py"
8+
79

810
class TestInitializerFunction(unittest.TestCase):
911
@patch(
1012
"builtins.open",
1113
new_callable=mock_open,
12-
read_data="file_manager: https://github.com/Armen-Jean-Andreasian/FileManager-Git-Module",
14+
read_data=f"file_manager: {module_for_test}",
1315
)
1416
@patch("not_gitmodules.core.read_yaml")
1517
def test_initializer_with_valid_yaml(self, mock_read_yaml, mock_file):
1618
mock_read_yaml.return_value = {
17-
"file_manager": "https://github.com/Armen-Jean-Andreasian/FileManager-Git-Module"
19+
"file_manager": {
20+
"main": module_for_test
21+
}
1822
}
1923

2024
initializer("notgitmodules.yaml")
@@ -25,7 +29,11 @@ def test_initializer_with_valid_yaml(self, mock_read_yaml, mock_file):
2529
@patch("builtins.print")
2630
@patch("subprocess.run")
2731
def test_initializer_with_invalid_yaml(self, mock_subprocess, mock_print, mock_read_yaml, mock_file):
28-
mock_read_yaml.return_value = {"file_manager": "invalid_repo"}
32+
mock_read_yaml.return_value = {
33+
"file_manager": {
34+
"broken": "invalid_repo"
35+
}
36+
}
2937

3038
mock_subprocess.side_effect = subprocess.CalledProcessError(
3139
returncode=1, cmd="git clone", stderr="error"
@@ -34,16 +42,17 @@ def test_initializer_with_invalid_yaml(self, mock_subprocess, mock_print, mock_r
3442
initializer("notgitmodules.yaml")
3543

3644
expected_calls = [
37-
call("Directory 'my_gitmodules/file_manager' already exists. Skipping..."),
45+
call("Directory 'my_gitmodules/file_manager/broken' already exists. Skipping..."),
3846
call("Failed to clone invalid_repo: error"),
3947
]
4048

4149
self.assertTrue(any(call in mock_print.mock_calls for call in expected_calls))
4250

51+
4352
@patch(
4453
"builtins.open",
4554
new_callable=mock_open,
46-
read_data="file_manager: https://github.com/Armen-Jean-Andreasian/FileManager-Git-Module",
55+
read_data=f"file_manager: {module_for_test}",
4756
)
4857
@patch("not_gitmodules.core.read_yaml")
4958
def test_cli_with_default_input(self, mock_read_yaml, mock_file):

0 commit comments

Comments
 (0)