Skip to main content

A blog engine core with JSON storage

Project description

Masterblog‑core 📦

Python Code style: PEP8 Status License: MIT


📑 Table of Contents


⚠️ Disclaimer

This project began as part of my learning journey during a multi‑month software engineering course. It should be viewed as such: a work in progress where I applied my best effort and current knowledge.

The original Masterblog repository included a Flask server and frontend. This fork, Masterblog‑core, strips away the web layer and focuses only on the reusable backend logic. The emphasis has shifted toward packaging and redistribution as a standalone Python library.

  • No new features have been added — in fact, the frontend has been removed.
  • The goal is to ensure the underlying models and storage still work as expected.
  • It remains a learning project and is not intended for production use.

📝 Description

Masterblog‑core provides the essential building blocks of a simple blogging system:

  • Blog and Post classes for managing posts.
  • JSON‑based persistence with auto‑incrementing IDs.
  • A lightweight storage layer (filestore, sequence).

This package is designed for reuse in other projects or as a learning reference for object‑oriented design and Python packaging.


✨ Features

  • ➕ Create new blog posts
  • ✏️ Update existing posts
  • ❌ Delete posts
  • ❤️ Like posts (with persistence)
  • 📦 JSON storage with auto‑increment IDs
  • 🔌 File‑path injection for flexible persistence

📁 Project Structure

.
├── .gitignore           # Ignore sensitive/generated files
├── LICENSE              # MIT license text
├── pyproject.toml       # Project metadata and dependencies
├── README.md            # Project documentation
└── src/                 # Main application source code
    └── masterblog_core
        ├── models/      # Data models
        │   ├── blog.py  # Blog class managing posts
        │   └── post.py  # Post class with attributes and methods
        └── storage/     # Persistence layer
            ├── filestore.py  # JSON read/write helpers
            └── sequence.py   # Auto-increment ID handling

🛠️ Development Setup

🚀 Quick Start

For experienced users who just want to get the app running:

git clone https://github.com/paul-wosch/Masterblog-core.git \
&& cd Masterblog-core \
&& pip install -e .

Then open http://127.0.0.1:5000 in your browser.
On a fresh install, you’ll see a message with a link to Add Post.


📖 Step‑by‑Step Guide

  1. Clone the repository:

    git clone https://github.com/paul-wosch/Masterblog-core.git
    cd Masterblog-core
    
  2. Create virtual environment (optional):

    python -m venv .venv
    
  3. Activate virtual environment (optional):

    source .venv/bin/activate   # Mac/Linux
    .venv\Scripts\activate      # Windows
    
  4. Install local package:

    pip install -e .
    
  5. Use the app

    See below!

  6. Deactivate environment (optional):

    deactivate
    

The pip install -e . makes masterblog_core importable, ensuring imports resolve correctly.


🚀 Usage

Import and use in Python:

from pathlib import Path
from masterblog_core.models.blog import Blog

# Define file paths for persistence
PARENT_FOLDER_COUNT = 0
PROJECT_ROOT = Path(__file__).resolve().parents[PARENT_FOLDER_COUNT]
BLOG_FILE = "blog.json"
SEQUENCE_FILE = "sequence.json"

BLOG_FILE_PATH = (PROJECT_ROOT / BLOG_FILE).resolve()
SEQUENCE_FILE_PATH = (PROJECT_ROOT / SEQUENCE_FILE).resolve()

# Initialize Blog with file paths
my_blog = Blog(BLOG_FILE_PATH, SEQUENCE_FILE_PATH)

# Example usage
my_post = {"author": "Your Name",
           "title": "Hello World",
           "content": "This is my first post!",
           "likes": 0
           }
my_blog.add(my_post)

👥 Contributing

This project is primarily a learning exercise, but contributions, suggestions, or feedback are welcome. If you’d like to propose improvements:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Commit your changes (git commit -m "feat: Add your feature")
  4. Push to the branch (git push origin feature/your-feature)
  5. Open a Pull Request

📄 License

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

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

masterblog_core-0.1.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

masterblog_core-0.1.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file masterblog_core-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for masterblog_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 72928cf206086fb35ef2fbb4fa0a8982aada0674fb9226c752ee1bc63f580508
MD5 9b36b460c367c8c8e248d349ab6a442c
BLAKE2b-256 2cb4f0e379ad38b0bb8d6c86dee149d245e2d021ed183fa6d7b46b90375cc47f

See more details on using hashes here.

File details

Details for the file masterblog_core-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for masterblog_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e4b3c5db906a9ff432755bc1d1a848c779c6b26cf564f64a7f2a48b47ddab96
MD5 35e434fdf6551c0b2ddf0fc5f8ef9c0c
BLAKE2b-256 04c38c729d9b34a256143434c048f3582b6376a0263edef3ff4e9d7dfac2b84d

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