A blog engine core with JSON storage
Project description
Masterblog‑core 📦
📑 Table of Contents
- ⚠️ Disclaimer
- 📝 Description
- ✨ Features
- 📁 Project Structure
- 📦 Installation
- 🚀 Usage
- 🔖 Versioning
- 👥 Contributing
- 🏷️ Badges
- 🔗 See Also
- 📄 License
⚠️ Disclaimer
This project began as part of my learning journey during a multi‑month software engineering course.
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:
BlogandPostclasses 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
├── __init__.py # Public API (Blog, Post, storage)
├── 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
📦 Installation
From PyPI:
pip install masterblog-core
For local development:
git clone https://github.com/paul-wosch/Masterblog-core.git
cd Masterblog-core
pip install -e .
Requirements
- Python 3.10 or newer
- No external dependencies beyond the Python standard library
⚡ Quick Start
pip install masterblog-core
from masterblog_core import Blog
blog = Blog("blog.json", "sequence.json")
blog.add({"author": "Me", "title": "Hello", "content": "First post!"})
🚀 Usage
After installation, you can import and use the package in Python:
from pathlib import Path
from masterblog_core import Blog, Post
# Define file paths for persistence
PROJECT_ROOT = Path(__file__).resolve().parent
BLOG_FILE_PATH = (PROJECT_ROOT / "blog.json").resolve()
SEQUENCE_FILE_PATH = (PROJECT_ROOT / "sequence.json").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)
🔖 Versioning
The package version is defined once in pyproject.toml and exposed at runtime via
masterblog_core.__version__. This is automatically synchronized using
importlib.metadata, so you only need to update the version in one place.
You can check the installed version programmatically:
import masterblog_core
print(masterblog_core.__version__)
How it works
Inside masterblog_core/__init__.py, the version is resolved from the installed
package metadata:
from importlib.metadata import version, PackageNotFoundError
try:
__version__ = version("masterblog-core")
except PackageNotFoundError:
# Fallback for local development when package metadata is not available
__version__ = "0.0.0"
This ensures consistency between the distribution metadata and the runtime API.
👥 Contributing
This project is primarily a learning exercise, but contributions, suggestions, or feedback are welcome. If you’d like to propose improvements:
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m "feat: Add your feature") - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
🏷️ Badges
- PyPI version – latest release on PyPI
- Downloads – monthly installs from PyPI (click for details on pepy.tech)
- Python – minimum supported Python version
- Code style – follows PEP8 guidelines
- Status – indicates this is a learning project
- License – MIT license
🔗 See Also
This package was extracted from the original Masterblog project, which includes a Flask server and frontend.
- Use Masterblog‑core if you want the reusable backend logic as a library.
- Use Masterblog if you want the full web application with UI.
📄 License
This project is licensed under the terms of the MIT License.
See the LICENSE file for full details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file masterblog_core-0.1.1.tar.gz.
File metadata
- Download URL: masterblog_core-0.1.1.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b402f9e56859c08e5da7f08febedd8a55c78103906767bcbe1a1951ae9963717
|
|
| MD5 |
24cd7a06796d1ff8b7196069dd1a2ad1
|
|
| BLAKE2b-256 |
030725b059ab53c9f63a02973cdedfb7c9d2c56671753759c6e716a9b6f60962
|
File details
Details for the file masterblog_core-0.1.1-py3-none-any.whl.
File metadata
- Download URL: masterblog_core-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea7ea75e970d3832a1809c5b9c4abbe721bc545908cab7f5aec75fdac4a4383e
|
|
| MD5 |
1ef97850b3a6575cf002ed1af6886fc4
|
|
| BLAKE2b-256 |
28d0dae03656f362d41e1df619eb5ec1c3685a6802b0a75f76e47dea65cd2d9a
|