Skip to main content

Python, MicroPython and CircuitPython files merger

Project description

Python Version License Workflow Tests Coverage

The Python Files Merger is a tool that seamlessly combines multiple Python files into a single, well-organized unit while automatically handling imports, checking definition collisions, and resolving dependencies. It can be used to merge standard Python files but works especially well hadnling files designed for microcontrollers. The package supports Python, MicroPython, and CircuitPython files.

Usage

Shell example

python -m pymerger src/*

or

python -m pymerger src/lorem.py src/ipsum.py

You can see shell option with python -m pymerger -h

File example

import pymerger

pymerger.merge(["src/**"], output="merged_files.py")

The function also returns the raw string, so you could do:

import pymerger

output_string = pymerger.merge(["src/**"])
print(output_string)

Only optional parameter is "output", that lets you choose where the output should be saved.

Contributing

Developing

You can download the repo and run the merger with python -m pymerger <files_to_merge>

Lint

pylint pymerger

Tests

You can click on the tests badge to check the tests status

pytest 

Coverage

You can clickon the coverage badge to check the code coverage

coverage run --source=pymerger -m unittest discover && coverage report

Reports and badges

Right now, badges are generated locally and uploaded to github, we should really do this in github workflows.

To generate reports and badges:

python genbadges.py

Upload to pip

  1. Update pymerger version in pymerger/__init__.py.
  2. Run python setup.py sdist to create the dist tar which will be uploadad to pip.
  3. Run python -m twine upload dist/$(ls dist | tail -n 1) to upload the most up to date tar folder in the sir directory.

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

pymerger-1.0.0.tar.gz (13.4 kB view details)

Uploaded Source

File details

Details for the file pymerger-1.0.0.tar.gz.

File metadata

  • Download URL: pymerger-1.0.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for pymerger-1.0.0.tar.gz
Algorithm Hash digest
SHA256 311cbc6972d72d26e392f8f2740d346be4631f0d91d41b561aec8170346fdf0b
MD5 869b2ad007abdcd295ddff6109407e19
BLAKE2b-256 dea4708263bc3759c72582dce4344ac702158997fb1c0e9d601db4c95bf90768

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