Skip to main content

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.toml file with metapkg init.
  • Manage Dependencies: Add or remove dependencies with metapkg add and metapkg remove.
  • Scan Imports: Detect missing dependencies in your code with metapkg scan.
  • Generate Requirements: Auto-generate requirements.txt with metapkg reqs.
  • Sync Environment: Install dependencies from pyproject.toml with metapkg sync.
  • Check PyPI Readiness: Validate pyproject.toml for publishing with metapkg 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:

  1. Fork the repository: github.com/yourusername/metapkg

  2. Create a branch:

    git checkout -b feature/your-feature
    
  3. Commit changes:

    git commit -m "Add your feature"
    
  4. Push to your fork:

    git push origin feature/your-feature
    
  5. 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

metapkg-0.1.2.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

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

metapkg-0.1.2-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file metapkg-0.1.2.tar.gz.

File metadata

  • Download URL: metapkg-0.1.2.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

Hashes for metapkg-0.1.2.tar.gz
Algorithm Hash digest
SHA256 66d8cacd8bb42529fad640471bed1ce8e28ae24f5ac37146b9ae22266493aea6
MD5 00ed1cfcd2568892ffbc74d3298cbf73
BLAKE2b-256 148f28ad6401fbd33023fee2054f201472f64e4f79963573f5b533394724a3f6

See more details on using hashes here.

File details

Details for the file metapkg-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: metapkg-0.1.2-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

Hashes for metapkg-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8071547bf6ab6647b7bf626981cda933f9b6870a3a0b6ff7a7de41e97a2c4393
MD5 1df8b38e8e082b61fb0c9ec1e7ce2de1
BLAKE2b-256 1a9c95d403963cd3386ee18a2d2b835568c7c25eb6c773f7ae3f2f336f61c98f

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