not-gitmodules


Namenot-gitmodules JSON
Version 0.4.4 PyPI version JSON
download
home_pagehttps://github.com/Armen-Jean-Andreasian/not_gitmodules
SummaryA library for managing git repositories in a directory.
upload_time2024-12-18 22:46:53
maintainerNone
docs_urlNone
authorArmen-Jean Andreasian
requires_pythonNone
licenseCustom License
keywords
VCS
bugtrack_url
requirements PyYAML
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<div style="text-align: center;">
  <img src=".github/pic1.png" />
</div>

---

# What's  `not_gitmodules`?

Watch the intro:

[![](https://markdown-videos-api.jorgenkh.no/youtube/QkFxP_6NA84)](https://youtu.be/QkFxP_6NA84)

Long story short: `not_gitmodules` is a lightweight, production-ready Python utility designed to simplify managing external modules in
your project.

---

# Why `not_gitmodules`?

1. Simplicity: Minimalistic design—no unnecessary complexities.
2. Production-Ready: Explicitly licensed for production use.
3. Dependency-Free: Uses only Python's built-in tools.
4. OS-Agnostic: Works seamlessly on Linux, MacOS and any other platforms where Python is available by default.

--- 

## Important note

1. not_gitmodules just like Gitmodules doesn't `automatically install the dependencies`/`do not include the dependencies to your project dependency file (such as requirements.txt for Python or package.json for JavaScript)` of the submodule.
2. not_gitmodules doesn't `download the submodules mentioned in the not_gimodules.yaml file of the submodule`.
- Reason: it's practically inefficient, may lead to bugs and bottlenecks, and better to maintain manually.

How to handle?
1. Move the containing of the dependency file to your project's dependency file and rerun the dependency installer.

2.1. Important note. `not_gitmodules` keeps the view of keeping the project structure clean. All submodules amoung one project/micro-service need to go to one folder. It's recommended to use dependency injection in case of having nested not_gitmodules.

2.2. Move submodules to your `not_gimodules.yaml` file and rerun install accordingly.

## Installation and Usage

### Installation

Choose one of the following methods to install `not_gitmodules`:

#### 1. Clone the repository:

```bash  
git clone https://github.com/Armen-Jean-Andreasian/not_gitmodules.git
```  

#### 2. Install via pip:

```bash  
pip install not-gitmodules
```  

---

# Preparation and Usage Options

## 1. Preparation (IMPORTANT)

Create a `notgitmodules.yaml` file in your project's root directory.

```yaml
# directory_name: url (ssh or https)  

# Example: 
utils:
  file_manager: https://github.com/not-gitmodules/notgitmodules-file-manager-py
  file_encryptor: https://github.com/not-gitmodules/notgitmodules-file-encryptor-py

services:
  forsaken_mail: https://github.com/malaohu/forsaken-mail
  sim_mail: https://github.com/Webador/SlmMail
```  

## 2. Usage Options

You can use `not_gitmodules` in two ways:

1. **As a part of your project's code.**  
   Just clone/download this repository and include it to your project.
    - **Pros:** No additional dependencies or overhead.
    - **Cons:** No CLI usage; increases the project's file size.


2. **As a Python Package (Recommended).**  
   Install using **pip**

- **Pros:** This method allows you to leverage CLI commands for better flexibility, ease with Docker, keeps the project
  lightweight
    - **Cons:** Additional dependency

**Not recommended** option: clone/download this repository and run `pip install .`

---

# Usage

## A. As Part of Your Project's Code

### Command:

```bash  
git clone https://github.com/Armen-Jean-Andreasian/not_gitmodules.git
```  

### Implementation:

- If `notgitmodules.yaml` is located in the project root:

```python
from not_gitmodules import initializer

initializer()  
```  

- If `notgitmodules.yaml` is located somewhere else. _Or has a different name._

```python
from not_gitmodules import initializer

initializer('custom/path/to/config.yaml')  # Specify a custom path  
```  

  
---  

## B. As a Python Package (Recommended)

This method allows you to leverage CLI commands for better flexibility.

### 1. Install the package

```  
pip install not_gitmodules 
```  

---  

### 2. Add it to `requirements.txt`

As this package is not used in code itself, it's easy to forget to add. So better to add in advance.

#### Run:

```bash  
pip show not_gitmodules
```  

**Check the `Version` and include it to `requirements.txt` with `~=` assignment:**

- Example:
    ```text
    not_gitmodules~=0.0
    ```

---  

### 3. Install the modules:

| Flag (all of them are optional) | Description                                                                                                                                                                                                                                      | Example                                                                                                                                |
|---------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
| `-y`, `--yaml-path`             | Specify a custom path for the `notgitmodules.yaml` configuration file. <br>By default, it looks for `notgitmodules.yaml` in the current working directory. Naming it `notgitmodules` is a matter of best practices; you can name it as you want. | • `not_gitmodules -y /path/to/custom_notgitmodules.yaml`: Uses a custom YAML file located at `/path/to/custom_notgitmodules.yaml`      |
| `-t`, `--threaded`              | Enable threaded execution, where repositories are cloned in parallel (using threads). This flag is mutually exclusive with `-s`. <br> This is the default behavior if neither `-t` nor `-s` is specified.                                        | • `not_gitmodules -t`: Clones repositories in parallel using threads <br> • `not_gitmodules --threaded`: Same as `-t`, using long form |
| `-s`, `--sequential`            | Enable sequential execution, where repositories are cloned one by one in the order they appear in the YAML file. This flag is mutually exclusive with `-t`.                                                                                      | • `not_gitmodules -s`: Clones repositories one by one in order <br> • `not_gitmodules --sequential`: Same as `-s`, using long form     |

### More command examples:

- ### Default command:

This will look for `notgitmodules.yaml` in the project root and create a directory named `my_gitmodules` in the root to
download the modules into, in parallel mode using threads.

```bash  
not_gitmodules install
```

- ### Command pattern:

```bash  
not_gitmodules install --yaml-path </path/to/notgitmodules.yaml>  --threaded
```  

or

```bash  
not_gitmodules install -y </path/to/notgitmodules.yaml>  -t
```

---

## Comparison

Usually with undefined amount of workers in `ThereadPool` in parallel mode take more than **52%** less time than in
parallel mode.


---  

### 4. Dockerizing

Double-check that you:

1. Created a `notgitmodules.yaml`
2. Included `not_gitmodules` version to `requirements.txt`

Then:

3. Create your `Dockerfile`. Example:

```dockerfile  
FROM python:3.10-slim  

# Install git for not_gitmodules
RUN apt-get update && apt-get install -y git  
  
WORKDIR /app  
  
COPY . .  
  
RUN pip install --no-cache-dir -r requirements.txt   

# copy the notgitmodules.yaml file (default). Modify accordingly.
COPY notgitmodules.yaml .

# install modules using not_gitmodules
RUN not_gitmodules install -y notgitmodules.yaml -t
  
CMD ["python", "main.py"]
```

---

## Possible Issues with Private Repositories

If cloning fails but you have access to the repository, provide the HTTPS repo URL instead of SSH  
in `notgitmodules.yaml`.

---

## Worth to mention

- `not_gitmodules` doesn't require for you to keep the folders with modules. You can safely .gitignore/delete them.
- Do not use matching names for the repositories in `notgitmodules.yaml` file. In that case only the first repository
  will be downloaded and the second one - skipped.

---

## License

This project is licensed under a **Custom License**. See the [LICENSE](./LICENSE) file for full details.

Key points:

- You may use this project for commercial or personal purposes.

---

## Author

Armen-Jean Andreasian, 2024

---

<div style="text-align: center;">
  <img src=".github/pic2.png" />
</div>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Armen-Jean-Andreasian/not_gitmodules",
    "name": "not-gitmodules",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Armen-Jean Andreasian",
    "author_email": "armen_andreasian@proton.me",
    "download_url": "https://files.pythonhosted.org/packages/ac/1c/d2b4350773f7f33627f79e09aadbfa59e2f2208cbedb44a3772e5a56362e/not_gitmodules-0.4.4.tar.gz",
    "platform": null,
    "description": "\n<div style=\"text-align: center;\">\n  <img src=\".github/pic1.png\" />\n</div>\n\n---\n\n# What's  `not_gitmodules`?\n\nWatch the intro:\n\n[![](https://markdown-videos-api.jorgenkh.no/youtube/QkFxP_6NA84)](https://youtu.be/QkFxP_6NA84)\n\nLong story short: `not_gitmodules` is a lightweight, production-ready Python utility designed to simplify managing external modules in\nyour project.\n\n---\n\n# Why `not_gitmodules`?\n\n1. Simplicity: Minimalistic design\u2014no unnecessary complexities.\n2. Production-Ready: Explicitly licensed for production use.\n3. Dependency-Free: Uses only Python's built-in tools.\n4. OS-Agnostic: Works seamlessly on Linux, MacOS and any other platforms where Python is available by default.\n\n--- \n\n## Important note\n\n1. not_gitmodules just like Gitmodules doesn't `automatically install the dependencies`/`do not include the dependencies to your project dependency file (such as requirements.txt for Python or package.json for JavaScript)` of the submodule.\n2. not_gitmodules doesn't `download the submodules mentioned in the not_gimodules.yaml file of the submodule`.\n- Reason: it's practically inefficient, may lead to bugs and bottlenecks, and better to maintain manually.\n\nHow to handle?\n1. Move the containing of the dependency file to your project's dependency file and rerun the dependency installer.\n\n2.1. Important note. `not_gitmodules` keeps the view of keeping the project structure clean. All submodules amoung one project/micro-service need to go to one folder. It's recommended to use dependency injection in case of having nested not_gitmodules.\n\n2.2. Move submodules to your `not_gimodules.yaml` file and rerun install accordingly.\n\n## Installation and Usage\n\n### Installation\n\nChoose one of the following methods to install `not_gitmodules`:\n\n#### 1. Clone the repository:\n\n```bash  \ngit clone https://github.com/Armen-Jean-Andreasian/not_gitmodules.git\n```  \n\n#### 2. Install via pip:\n\n```bash  \npip install not-gitmodules\n```  \n\n---\n\n# Preparation and Usage Options\n\n## 1. Preparation (IMPORTANT)\n\nCreate a `notgitmodules.yaml` file in your project's root directory.\n\n```yaml\n# directory_name: url (ssh or https)  \n\n# Example: \nutils:\n  file_manager: https://github.com/not-gitmodules/notgitmodules-file-manager-py\n  file_encryptor: https://github.com/not-gitmodules/notgitmodules-file-encryptor-py\n\nservices:\n  forsaken_mail: https://github.com/malaohu/forsaken-mail\n  sim_mail: https://github.com/Webador/SlmMail\n```  \n\n## 2. Usage Options\n\nYou can use `not_gitmodules` in two ways:\n\n1. **As a part of your project's code.**  \n   Just clone/download this repository and include it to your project.\n    - **Pros:** No additional dependencies or overhead.\n    - **Cons:** No CLI usage; increases the project's file size.\n\n\n2. **As a Python Package (Recommended).**  \n   Install using **pip**\n\n- **Pros:** This method allows you to leverage CLI commands for better flexibility, ease with Docker, keeps the project\n  lightweight\n    - **Cons:** Additional dependency\n\n**Not recommended** option: clone/download this repository and run `pip install .`\n\n---\n\n# Usage\n\n## A. As Part of Your Project's Code\n\n### Command:\n\n```bash  \ngit clone https://github.com/Armen-Jean-Andreasian/not_gitmodules.git\n```  \n\n### Implementation:\n\n- If `notgitmodules.yaml` is located in the project root:\n\n```python\nfrom not_gitmodules import initializer\n\ninitializer()  \n```  \n\n- If `notgitmodules.yaml` is located somewhere else. _Or has a different name._\n\n```python\nfrom not_gitmodules import initializer\n\ninitializer('custom/path/to/config.yaml')  # Specify a custom path  \n```  \n\n  \n---  \n\n## B. As a Python Package (Recommended)\n\nThis method allows you to leverage CLI commands for better flexibility.\n\n### 1. Install the package\n\n```  \npip install not_gitmodules \n```  \n\n---  \n\n### 2. Add it to `requirements.txt`\n\nAs this package is not used in code itself, it's easy to forget to add. So better to add in advance.\n\n#### Run:\n\n```bash  \npip show not_gitmodules\n```  \n\n**Check the `Version` and include it to `requirements.txt` with `~=` assignment:**\n\n- Example:\n    ```text\n    not_gitmodules~=0.0\n    ```\n\n---  \n\n### 3. Install the modules:\n\n| Flag (all of them are optional) | Description                                                                                                                                                                                                                                      | Example                                                                                                                                |\n|---------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|\n| `-y`, `--yaml-path`             | Specify a custom path for the `notgitmodules.yaml` configuration file. <br>By default, it looks for `notgitmodules.yaml` in the current working directory. Naming it `notgitmodules` is a matter of best practices; you can name it as you want. | \u2022 `not_gitmodules -y /path/to/custom_notgitmodules.yaml`: Uses a custom YAML file located at `/path/to/custom_notgitmodules.yaml`      |\n| `-t`, `--threaded`              | Enable threaded execution, where repositories are cloned in parallel (using threads). This flag is mutually exclusive with `-s`. <br> This is the default behavior if neither `-t` nor `-s` is specified.                                        | \u2022 `not_gitmodules -t`: Clones repositories in parallel using threads <br> \u2022 `not_gitmodules --threaded`: Same as `-t`, using long form |\n| `-s`, `--sequential`            | Enable sequential execution, where repositories are cloned one by one in the order they appear in the YAML file. This flag is mutually exclusive with `-t`.                                                                                      | \u2022 `not_gitmodules -s`: Clones repositories one by one in order <br> \u2022 `not_gitmodules --sequential`: Same as `-s`, using long form     |\n\n### More command examples:\n\n- ### Default command:\n\nThis will look for `notgitmodules.yaml` in the project root and create a directory named `my_gitmodules` in the root to\ndownload the modules into, in parallel mode using threads.\n\n```bash  \nnot_gitmodules install\n```\n\n- ### Command pattern:\n\n```bash  \nnot_gitmodules install --yaml-path </path/to/notgitmodules.yaml>  --threaded\n```  \n\nor\n\n```bash  \nnot_gitmodules install -y </path/to/notgitmodules.yaml>  -t\n```\n\n---\n\n## Comparison\n\nUsually with undefined amount of workers in `ThereadPool` in parallel mode take more than **52%** less time than in\nparallel mode.\n\n\n---  \n\n### 4. Dockerizing\n\nDouble-check that you:\n\n1. Created a `notgitmodules.yaml`\n2. Included `not_gitmodules` version to `requirements.txt`\n\nThen:\n\n3. Create your `Dockerfile`. Example:\n\n```dockerfile  \nFROM python:3.10-slim  \n\n# Install git for not_gitmodules\nRUN apt-get update && apt-get install -y git  \n  \nWORKDIR /app  \n  \nCOPY . .  \n  \nRUN pip install --no-cache-dir -r requirements.txt   \n\n# copy the notgitmodules.yaml file (default). Modify accordingly.\nCOPY notgitmodules.yaml .\n\n# install modules using not_gitmodules\nRUN not_gitmodules install -y notgitmodules.yaml -t\n  \nCMD [\"python\", \"main.py\"]\n```\n\n---\n\n## Possible Issues with Private Repositories\n\nIf cloning fails but you have access to the repository, provide the HTTPS repo URL instead of SSH  \nin `notgitmodules.yaml`.\n\n---\n\n## Worth to mention\n\n- `not_gitmodules` doesn't require for you to keep the folders with modules. You can safely .gitignore/delete them.\n- Do not use matching names for the repositories in `notgitmodules.yaml` file. In that case only the first repository\n  will be downloaded and the second one - skipped.\n\n---\n\n## License\n\nThis project is licensed under a **Custom License**. See the [LICENSE](./LICENSE) file for full details.\n\nKey points:\n\n- You may use this project for commercial or personal purposes.\n\n---\n\n## Author\n\nArmen-Jean Andreasian, 2024\n\n---\n\n<div style=\"text-align: center;\">\n  <img src=\".github/pic2.png\" />\n</div>\n",
    "bugtrack_url": null,
    "license": "Custom License",
    "summary": "A library for managing git repositories in a directory.",
    "version": "0.4.4",
    "project_urls": {
        "Homepage": "https://github.com/Armen-Jean-Andreasian/not_gitmodules"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "073adec00020fe090dfaf746b38b6e69cf6af4071537df12bb7e41220299f5fe",
                "md5": "0b05035ae346a60202c726dff9d97816",
                "sha256": "b20c939bb371947a76027e9192c299072187ca1c9f8e28e4f938fe05075442f6"
            },
            "downloads": -1,
            "filename": "not_gitmodules-0.4.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0b05035ae346a60202c726dff9d97816",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 10359,
            "upload_time": "2024-12-18T22:46:51",
            "upload_time_iso_8601": "2024-12-18T22:46:51.317097Z",
            "url": "https://files.pythonhosted.org/packages/07/3a/dec00020fe090dfaf746b38b6e69cf6af4071537df12bb7e41220299f5fe/not_gitmodules-0.4.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ac1cd2b4350773f7f33627f79e09aadbfa59e2f2208cbedb44a3772e5a56362e",
                "md5": "a06bfc34c90137d1a1db671817d2bbdf",
                "sha256": "c0221290c61c04cb6a5ccac20e09a33c183f4e186e62c4828a3e5cb38fc8ad9c"
            },
            "downloads": -1,
            "filename": "not_gitmodules-0.4.4.tar.gz",
            "has_sig": false,
            "md5_digest": "a06bfc34c90137d1a1db671817d2bbdf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10527,
            "upload_time": "2024-12-18T22:46:53",
            "upload_time_iso_8601": "2024-12-18T22:46:53.547244Z",
            "url": "https://files.pythonhosted.org/packages/ac/1c/d2b4350773f7f33627f79e09aadbfa59e2f2208cbedb44a3772e5a56362e/not_gitmodules-0.4.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-18 22:46:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Armen-Jean-Andreasian",
    "github_project": "not_gitmodules",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "PyYAML",
            "specs": [
                [
                    "~=",
                    "6.0"
                ]
            ]
        }
    ],
    "lcname": "not-gitmodules"
}
        
Elapsed time: 1.36606s