Skip to main content

Create directory and file architecture from a tree structure text file

Project description

๐Ÿ—๏ธ mkarchi

mkarchi (make architecture) is a command-line tool that generates complete project structures from simple tree-format text files.
Define your entire project architecture โ€” folders, files, and even file contents โ€” in one readable text file, then generate it instantly with a single command.


โœจ Features

  • ๐Ÿ“ Create directories from a tree structure
  • ๐Ÿ“„ Create empty files automatically
  • โœ๏ธ Create files with content using intuitive (begincontenu) / (endcontenu) syntax
  • ๐ŸŽฏ Preserve indentation (perfect for Python, YAML, JSON, etc.)
  • ๐Ÿ’ฌ Support comments in structure files
  • ๐Ÿš€ Fast & simple โ€” build your whole project in one command

๐Ÿ“ฆ Installation

โœ… Recommended (via pip)

pip install mkarchi

Option 2: Install from source

git clone https://github.com/yourusername/mkarchi.git
cd mkarchi
pip install -e .

Option 3: Run as module (no installation)

git clone https://github.com/yourusername/mkarchi.git
cd mkarchi
python -m mkarchi apply structure.txt

๐Ÿš€ Quick Start

1๏ธโƒฃ Create a structure file

Create a file called structure.txt:

my_project/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ main.py(begincontenu)
โ”‚   โ”‚   def main():
โ”‚   โ”‚       print("Hello, World!")
โ”‚   โ”‚
โ”‚   โ”‚   if __name__ == "__main__":
โ”‚   โ”‚       main()
โ”‚   (endcontenu)
โ”‚   โ””โ”€โ”€ utils.py(begincontenu)
โ”‚       def helper():
โ”‚           return "Helper function"
โ”‚   (endcontenu)
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_main.py
โ”œโ”€โ”€ README.md(begincontenu)
โ”‚   # My Project
โ”‚
โ”‚   This is an awesome project!
โ”‚   (endcontenu)
โ””โ”€โ”€ requirements.txt(begincontenu)
    pytest>=7.0.0
    requests>=2.28.0
(endcontenu)

2๏ธโƒฃ Run mkarchi

mkarchi apply structure.txt

3๏ธโƒฃ See the magic โœจ

๐Ÿš€ Creating structure from structure.txt...

๐Ÿ“ Created directory: my_project
๐Ÿ“ Created directory: my_project/src
๐Ÿ“„ Created file with content: my_project/src/main.py
๐Ÿ“„ Created file with content: my_project/src/utils.py
๐Ÿ“ Created directory: my_project/tests
๐Ÿ“„ Created file: my_project/tests/test_main.py
๐Ÿ“„ Created file with content: my_project/README.md
๐Ÿ“„ Created file with content: my_project/requirements.txt

โœ… Architecture created successfully!

๐Ÿ“– Usage

# Generate structure
mkarchi apply structure.txt

# Help
mkarchi --help

# Version
mkarchi --version

๐Ÿ“„ Structure File Format

๐Ÿ“ Create Directories

Directories must end with /:

my_folder/
โ”œโ”€โ”€ subfolder/
โ””โ”€โ”€ another_folder/

๐Ÿ“„ Create Empty Files

Files without (begincontenu) / (endcontenu) are created empty:

my_folder/
โ”œโ”€โ”€ empty_file.txt
โ””โ”€โ”€ config.json

โœ๏ธ Create Files with Content

Use (begincontenu) and (endcontenu) to define file content:

script.py(begincontenu)
    print("Hello!")
    print("This is Python code")
(endcontenu)

๐ŸŽฏ Indentation Preservation

mkarchi automatically preserves indentation:

utils.py(begincontenu)
    def greet(name):
        if name:
            print(f"Hello, {name}!")
        else:
            print("Hello, World!")
(endcontenu)

Result (utils.py):

def greet(name):
    if name:
        print(f"Hello, {name}!")
    else:
        print("Hello, World!")

๐Ÿ’ฌ Comments Support

Use # for comments in your structure file:

project/
โ”œโ”€โ”€ src/          # Source code
โ”‚   โ””โ”€โ”€ main.py   # Entry point
โ””โ”€โ”€ tests/        # Tests

๐ŸŽฏ Use Cases

โšก Quick Prototyping

๐Ÿ“ฆ Reusable project templates

๐Ÿ“˜ Documentation & tutorials

๐Ÿงฉ Microservices setup

mkarchi apply service1.txt
mkarchi apply service2.txt

๐Ÿ”ง Advanced Example (Python Project)

python_project/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ main.py(begincontenu)
โ”‚       """Main module."""
โ”‚
โ”‚       def main():
โ”‚           print("Starting application...")
โ”‚   (endcontenu)
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ test_main.py(begincontenu)
โ”‚       import pytest
โ”‚       from src.main import main
โ”‚
โ”‚       def test_main():
โ”‚           assert main() is None
โ”‚   (endcontenu)
โ”œโ”€โ”€ setup.py(begincontenu)
โ”‚   from setuptools import setup, find_packages
โ”‚
โ”‚   setup(
โ”‚       name="my-project",
โ”‚       version="0.1.0",
โ”‚       packages=find_packages(),
โ”‚   )
โ”‚   (endcontenu)
โ””โ”€โ”€ README.md

๐Ÿค Contributing

Contributions are welcome! ๐Ÿš€

Fork the repository

Create a feature branch:

git checkout -b feature/amazing-feature

Commit your changes:

git commit -m "Add amazing feature"

Push to your branch:

git push origin feature/amazing-feature

Open a Pull Request

๐Ÿ“ License

This project is licensed under the MIT License. See the LICENSE file for details.

๐Ÿ› Issues & Feedback

Found a bug or have a feature request? Please open an issue on GitHub Issues.

โญ Support the Project

If you find mkarchi useful, please consider giving it a โญ on GitHub!


โค๏ธ Made with passion by Soufyan Rachdi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkarchi-0.1.5.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkarchi-0.1.5-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file mkarchi-0.1.5.tar.gz.

File metadata

  • Download URL: mkarchi-0.1.5.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for mkarchi-0.1.5.tar.gz
Algorithm Hash digest
SHA256 2c7058f6fb63ddc211197e7d38c9e66b1d78fb0f5279dc58a4641bebe1718505
MD5 bc140cc33b4d148b679874081b4f8e93
BLAKE2b-256 3b8176aeda371a23a29d25fbd35f453c92fcce52ed9c5f801d154883b002d333

See more details on using hashes here.

File details

Details for the file mkarchi-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: mkarchi-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for mkarchi-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 376a916eca209de7659e611aa7ce51df71807974f90a47031f5158efafb6ee60
MD5 c8985e8619707387f05990b179ff0505
BLAKE2b-256 7aa550d866ff5310241a9e99aa22c86fcb1e93bc46768cf0f0a68f75abea3e7c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page