CLI tool to manage pyproject.toml and generate requirements.txt
Project description
metapkg – Simplify Python Project Metadata Management
metapkg is a fast, intuitive CLI tool designed to streamline Python project metadata management. It simplifies creating, updating, and maintaining pyproject.toml, managing dependencies, and preparing your project for PyPI publishing.
Whether you're starting a new project or maintaining an existing one, metapkg keeps your metadata organized and your workflow efficient.
🚀 Features
- Initialize Projects: Create a
pyproject.tomlfile withmetapkg init. - Manage Dependencies: Add or remove dependencies with
metapkg addandmetapkg remove. - Scan Imports: Detect missing dependencies in your code with
metapkg scan. - Generate Requirements: Auto-generate
requirements.txtwithmetapkg reqs. - Sync Environment: Install dependencies from
pyproject.tomlwithmetapkg sync. - Check PyPI Readiness: Validate
pyproject.tomlfor publishing withmetapkg check.
🔧 Installation
metapkg requires Python 3.12 or higher. It is recommended to use a virtual environment.
Install via PyPI
pip install metapkg
Install from Source
git clone https://github.com/yourusername/metapkg.git
cd metapkg
python -m pip install -e .
Verify Installation
metapkg --help
📋 Usage
Run metapkg --help to see all available commands.
Initialize a New Project
metapkg init
Example Interaction:
/path/to/project/pyproject.toml already exists. Overwrite? [y/N]: y
Project name [my-project]: my-project
Version [0.1.0]:
Description []: My Python project
Author []: Jane Doe
License [MIT]:
Minimum Python version (e.g., >=3.8, ==3.12) [>=3.8]: >=3.12
Build backend (setuptools, hatchling, flit) [setuptools]:
Writing to /path/to/project/pyproject.toml
Successfully created /path/to/project/pyproject.toml
Add a Dependency
metapkg add requests>=2.28.1
Output:
Checking for pyproject.toml at /path/to/project/pyproject.toml
Writing to /path/to/project/pyproject.toml
Added requests>=2.28.1 to pyproject.toml
Remove a Dependency
metapkg remove requests
Output:
Checking for pyproject.toml at /path/to/project/pyproject.toml
Writing to /path/to/project/pyproject.toml
Removed requests from pyproject.toml
Scan Code for Imports
echo 'import pandas' > analysis.py
metapkg scan
Output:
Checking for pyproject.toml at /path/to/project/pyproject.toml
Missing dependencies detected:
- pandas
Add missing dependencies to pyproject.toml? [y/N]: y
Writing to /path/to/project/pyproject.toml
Updated /path/to/project/pyproject.toml with missing dependencies.
Generate requirements.txt
metapkg reqs
Output:
Checking for pyproject.toml at /path/to/project/pyproject.toml
Generated requirements.txt
Generated requirements.txt:
requests>=2.28.1
pandas>=2.0.0
Sync Dependencies
metapkg sync
Output:
Checking for pyproject.toml at /path/to/project/pyproject.toml
Successfully installed missing dependencies.
Check PyPI Readiness
metapkg check
Output:
Checking for pyproject.toml at /path/to/project/pyproject.toml
pyproject.toml is ready for PyPI publishing!
If issues are found:
Warnings found in pyproject.toml:
- Missing recommended field: classifiers (useful for PyPI categorization)
🛠️ Example Workflow
Set up a new Python project with metapkg:
mkdir my-project
cd my-project
python -m venv venv
source venv/bin/activate
pip install metapkg
metapkg init
metapkg add flask>=2.0.0
echo 'import pandas' > app.py
metapkg scan
metapkg sync
metapkg reqs
metapkg check
This will:
- Create a project
- Add
flask - Detect
pandas - Install dependencies
- Generate
requirements.txt - Verify PyPI readiness
🤝 Contributing
We welcome contributions! To get started:
-
Fork the repository: github.com/yourusername/metapkg
-
Create a branch:
git checkout -b feature/your-feature
-
Commit changes:
git commit -m "Add your feature"
-
Push to your fork:
git push origin feature/your-feature
-
Open a pull request
See our CONTRIBUTING.md for more details.
📬 Feedback & Issues
Found a bug or have a feature request? Open an issue on GitHub: github.com/yourusername/metapkg/issues
Please use the issue templates to provide clear and actionable reports.
📝 License
metapkg is licensed under the MIT License.
Let’s make Python project management simpler, together!
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
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 metapkg-0.1.0.tar.gz.
File metadata
- Download URL: metapkg-0.1.0.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e03c568164643ce62d4ac94ad1c9ee5774cc6c87d956ff29da9dd8242530776
|
|
| MD5 |
ac01cd401a3f0e29f61b08a71d9211d0
|
|
| BLAKE2b-256 |
965f1448f38c8e20a5da3835c75b17f3fdbc82b9d7f6ff91b253ba3b6b552cc5
|
File details
Details for the file metapkg-0.1.0-py3-none-any.whl.
File metadata
- Download URL: metapkg-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b8cbee0aa777791a66bf8fca00bf52541636867e6d92c68840cdca36efeebbb
|
|
| MD5 |
da30a0e13c76fc6dd6b5f6d11df430b1
|
|
| BLAKE2b-256 |
4aa89789258ffcaa415098228eb160e307eacbb421d08a3ff58495695085e555
|