Skip to content
This repository was archived by the owner on Apr 12, 2026. It is now read-only.

Commit 6124512

Browse files
committed
feat: initial commit with server pack builder script and documentation
0 parents  commit 6124512

4 files changed

Lines changed: 480 additions & 0 deletions

File tree

.gitignore

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
target/
76+
77+
# Jupyter Notebook
78+
.ipynb_checkpoints
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/
130+
131+
# IDEs
132+
.vscode/
133+
.idea/
134+
*.swp
135+
*.swo
136+
*~
137+
138+
# OS
139+
.DS_Store
140+
.DS_Store?
141+
._*
142+
.Spotlight-V100
143+
.Trashes
144+
ehthumbs.db
145+
Thumbs.db
146+
147+
testIn
148+
testOut

AGENTS.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# AGENTS.md - Coding Guidelines for modpacktoserver Repository
2+
3+
This document provides guidelines for coding agents (such as yourself) working in this repository. It outlines commands for building, linting, and testing, as well as code style conventions to ensure consistency and quality.
4+
5+
Always use Context7 MCP when I need library/API documentation, code generation, setup or configuration steps without me having to explicitly ask.
6+
7+
## Build/Lint/Test Commands
8+
9+
This project is a Python-based CLI tool. There is no compilation step, but we use tools for linting and testing.
10+
11+
### Prerequisites
12+
- Python 3.8+ required (3.11+ recommended for built-in `tomllib`).
13+
- Install dependencies: `pip install -r requirements.txt` (if present; otherwise, core dependencies like `tomli` for Python <3.11).
14+
- For linting: Install `flake8`, `black`, `isort`, `mypy` (e.g., `pip install flake8 black isort mypy`).
15+
16+
### Build Commands
17+
- No build required: Run scripts directly with `python`.
18+
- Example: `python server_pack_builder.py --source mods --destination server_mods`
19+
20+
### Linting Commands
21+
- **Full Lint**: `flake8 .` (checks style, errors, complexity).
22+
- **Format Code**: `black .` (auto-format Python files).
23+
- **Sort Imports**: `isort .` (organize import statements).
24+
- **Type Check**: `mypy .` (static type analysis; run after formatting).
25+
- **Combined Lint+Format**: `black . && isort . && flake8 . && mypy .`
26+
27+
### Testing Commands
28+
- Use `pytest` for unit tests (install via `pip install pytest`).
29+
- **Run All Tests**: `pytest`
30+
- **Run Tests in Verbose Mode**: `pytest -v`
31+
- **Run a Single Test**: `pytest tests/test_file.py::test_function_name` (e.g., `pytest tests/test_mod_filter.py::test_fabric_client_only`)
32+
- **Run Tests with Coverage**: `pytest --cov=server_pack_builder --cov-report=html`
33+
- **Run Specific Module Tests**: `pytest tests/ -k "fabric"` (filters tests by keyword).
34+
- If no tests exist yet, create them in a `tests/` directory using `pytest` conventions (e.g., `test_*.py` files).
35+
36+
### CI/CD Integration
37+
- For automated checks, run: `black . && isort . && flake8 . && mypy . && pytest`
38+
- Ensure all commands pass before committing.
39+
40+
## Code Style Guidelines
41+
42+
Follow PEP 8 (Python Enhancement Proposal 8) as the baseline, with additions for this project. Aim for readable, maintainable, and type-safe code. Use tools like `black` and `isort` for enforcement.
43+
44+
### General Principles
45+
- Write code for humans first: Prioritize clarity over brevity.
46+
- Use descriptive names; avoid abbreviations unless widely understood (e.g., `jar` for JAR file is acceptable).
47+
- Keep functions short (under 50 lines); break into smaller helpers if needed.
48+
- Add docstrings to all public functions/classes using Google-style (brief description + args/returns).
49+
- Comments: Explain *why* (not what), especially for complex logic. Avoid redundant comments.
50+
- Logging: Use `logging` module for output; avoid `print` in production code.
51+
- Security: Never hardcode secrets; validate inputs to prevent path traversal (e.g., use `os.path.join` safely).
52+
53+
### Imports
54+
- Use absolute imports: `from modpacktoserver.utils import helper` (not `from .utils`).
55+
- Group imports: Standard library, third-party, local (separated by blank lines).
56+
- Use `isort` to sort alphabetically within groups.
57+
- Avoid wildcard imports (`from module import *`).
58+
- Lazy imports in functions if needed for performance.
59+
60+
### Formatting
61+
- Line length: 88 characters (Black default).
62+
- Indentation: 4 spaces (never tabs).
63+
- Blank lines: 1 between functions/classes, 2 between top-level definitions.
64+
- Trailing commas: Always in multi-line structures for consistency.
65+
- String quotes: Double quotes for consistency (e.g., `"hello"`), single for contractions (e.g., `don't`).
66+
- Use `black` to auto-format; do not manually adjust spacing.
67+
68+
### Types
69+
- Use type hints everywhere: For functions, variables, and classes.
70+
- Import from `typing`: `List`, `Dict`, `Optional`, `Tuple`, etc.
71+
- Enable `mypy` strict mode if possible (in `mypy.ini` or pyproject.toml).
72+
- Avoid `Any`; use unions or generics instead.
73+
- Example: `def process_mods(mods: List[str]) -> Dict[str, bool]:`
74+
75+
### Naming Conventions
76+
- **Variables/Functions**: `snake_case` (e.g., `is_client_only`).
77+
- **Constants**: `UPPER_SNAKE_CASE` (e.g., `DEFAULT_TIMEOUT = 120`).
78+
- **Classes**: `PascalCase` (e.g., `ModProcessor`).
79+
- **Modules**: `snake_case` (e.g., `mod_filter.py`).
80+
- **Private**: Prefix with `_` (e.g., `_helper_function`).
81+
- Boolean variables: Start with `is_`, `has_`, `can_` (e.g., `is_fabric_mod`).
82+
- Avoid single-letter names except in loops (e.g., `for mod in mods:`).
83+
84+
### Error Handling
85+
- Use exceptions over return codes for errors.
86+
- Catch specific exceptions (e.g., `FileNotFoundError`, not `Exception`).
87+
- Provide meaningful error messages; log at appropriate levels (`error` for fatal, `warning` for recoverable).
88+
- Use `try/except/else/finally` blocks; avoid bare `except`.
89+
- For CLI tools, exit with codes: 0 (success), 1 (error).
90+
- Example: Raise `ValueError` for invalid inputs; handle at top level.
91+
92+
### Functions and Classes
93+
- Functions: Pure where possible; side effects in docstrings.
94+
- Classes: Use for stateful logic (e.g., a `ModPackBuilder` class if expanded).
95+
- Avoid global state; pass dependencies explicitly.
96+
- Use `@staticmethod` or `@classmethod` for utility methods.
97+
98+
### File Structure
99+
- Main script: `server_pack_builder.py` (entry point).
100+
- Tests: `tests/` directory with `test_*.py` files mirroring source structure.
101+
- Config: Use `pyproject.toml` or `setup.cfg` for tool configs (e.g., Black, Flake8).
102+
- Keep flat structure until >10 files.
103+
104+
### Best Practices
105+
- DRY (Don't Repeat Yourself): Extract common logic into functions.
106+
- SOLID Principles: Single responsibility per function/class.
107+
- Testing: Write tests first (TDD); cover happy path, edge cases, and errors.
108+
- Performance: Profile with `cProfile` if needed; avoid premature optimization.
109+
- Dependencies: Minimize; pin versions in `requirements.txt`.
110+
- Git: Commit often; use conventional commits (e.g., `feat: add forge support`).
111+
112+
### Project-Specific Notes
113+
- This is a CLI tool for Minecraft mod filtering; keep it simple and CLI-focused for future GUI integration.
114+
- Handle JAR files safely: Use `zipfile` for reading; validate paths.
115+
- Extensibility: Design for easy addition of new mod loaders (e.g., via strategy pattern).
116+
117+
### Cursor Rules
118+
No Cursor rules found (.cursor/rules/ or .cursorrules).
119+
120+
### Copilot Rules
121+
No Copilot rules found (.github/copilot-instructions.md).
122+
123+
### Additional Resources
124+
- PEP 8: https://peps.python.org/pep-0008/
125+
- Black: https://black.readthedocs.io/
126+
- MyPy: https://mypy.readthedocs.io/
127+
- Pytest: https://docs.pytest.org/

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# modpacktoserver
2+
3+
A Python CLI tool for filtering Minecraft modpacks to create server-compatible mod sets.
4+
5+
## Installation
6+
7+
Ensure Python 3.8+ is installed. Install dependencies:
8+
9+
```bash
10+
pip install -r requirements.txt
11+
```
12+
13+
## Usage
14+
15+
Run the tool with source and destination directories:
16+
17+
```bash
18+
python server_pack_builder.py --source /path/to/mods --destination /path/to/server_mods
19+
```
20+
21+
## Features
22+
23+
- Filters out client-only mods
24+
- Supports Fabric and Forge mod loaders
25+
- Preserves server-required mods
26+
27+
## Development
28+
29+
For linting and testing:
30+
31+
```bash
32+
black . && isort . && flake8 . && mypy .
33+
pytest
34+
```

0 commit comments

Comments
 (0)