![Python](https://raw.githubusercontent.com/yamenk-gribaudo/pymerger/master/badges/python.svg)
![Version](https://raw.githubusercontent.com/yamenk-gribaudo/pymerger/master/badges/version.svg)
![License](https://raw.githubusercontent.com/yamenk-gribaudo/pymerger/master/badges/license.svg)
![Workflow](https://github.com/yamenk-gribaudo/pymerger/actions/workflows/test.yml/badge.svg)
[![Tests](https://raw.githubusercontent.com/yamenk-gribaudo/pymerger/master/badges/tests.svg)](https://htmlpreview.github.io/?https://github.com/yamenk-gribaudo/pymerger/blob/master/reports/junit/report.html)
[![Coverage](https://raw.githubusercontent.com/yamenk-gribaudo/pymerger/master/badges/coverage.svg)](https://htmlpreview.github.io/?https://github.com/yamenk-gribaudo/pymerger/blob/master/htmlcov/index.html)
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`.
1. Run `python setup.py sdist` to create the dist tar which will be uploadad to pip.
1. Run `python -m twine upload dist/$(ls dist | tail -n 1)` to upload the most up to date tar folder in the sir directory.
Raw data
{
"_id": null,
"home_page": "https://github.com/yamenk-gribaudo/pymerger",
"name": "pymerger",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "merger files",
"author": "yyaammeennkk",
"author_email": "yyaammeennkk@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/de/a4/708263bc3759c72582dce4344ac702158997fb1c0e9d601db4c95bf90768/pymerger-1.0.0.tar.gz",
"platform": null,
"description": "![Python](https://raw.githubusercontent.com/yamenk-gribaudo/pymerger/master/badges/python.svg)\n![Version](https://raw.githubusercontent.com/yamenk-gribaudo/pymerger/master/badges/version.svg)\n![License](https://raw.githubusercontent.com/yamenk-gribaudo/pymerger/master/badges/license.svg)\n![Workflow](https://github.com/yamenk-gribaudo/pymerger/actions/workflows/test.yml/badge.svg)\n[![Tests](https://raw.githubusercontent.com/yamenk-gribaudo/pymerger/master/badges/tests.svg)](https://htmlpreview.github.io/?https://github.com/yamenk-gribaudo/pymerger/blob/master/reports/junit/report.html)\n[![Coverage](https://raw.githubusercontent.com/yamenk-gribaudo/pymerger/master/badges/coverage.svg)](https://htmlpreview.github.io/?https://github.com/yamenk-gribaudo/pymerger/blob/master/htmlcov/index.html)\n\n\nThe 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.\n\n# Usage\n\n## Shell example\n\n python -m pymerger src/*\n\nor\n\n python -m pymerger src/lorem.py src/ipsum.py\n\nYou can see shell option with `python -m pymerger -h`\n\n## File example\n\n import pymerger\n\n pymerger.merge([\"src/**\"], output=\"merged_files.py\")\n\nThe function also returns the raw string, so you could do:\n\n import pymerger\n\n output_string = pymerger.merge([\"src/**\"])\n print(output_string)\n\nOnly optional parameter is \"output\", that lets you choose where the output should be saved. \n\n# Contributing \n\n## Developing\n\nYou can download the repo and run the merger with `python -m pymerger <files_to_merge>`\n\n## Lint\n\n pylint pymerger\n\n## Tests \n\nYou can click on the tests badge to check the tests status\n\n pytest \n \n## Coverage\n\nYou can clickon the coverage badge to check the code coverage\n\n coverage run --source=pymerger -m unittest discover && coverage report\n## Reports and badges\n\nRight now, badges are generated locally and uploaded to github, we should really do this in github workflows. \n\nTo generate reports and badges:\n\n python genbadges.py\n\n## Upload to pip\n\n1. Update pymerger version in `pymerger/__init__.py`.\n1. Run `python setup.py sdist` to create the dist tar which will be uploadad to pip.\n1. Run `python -m twine upload dist/$(ls dist | tail -n 1)` to upload the most up to date tar folder in the sir directory.",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python, MicroPython and CircuitPython files merger",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://github.com/yamenk-gribaudo/pymerger"
},
"split_keywords": [
"merger",
"files"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "dea4708263bc3759c72582dce4344ac702158997fb1c0e9d601db4c95bf90768",
"md5": "869b2ad007abdcd295ddff6109407e19",
"sha256": "311cbc6972d72d26e392f8f2740d346be4631f0d91d41b561aec8170346fdf0b"
},
"downloads": -1,
"filename": "pymerger-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "869b2ad007abdcd295ddff6109407e19",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13422,
"upload_time": "2023-09-10T15:41:16",
"upload_time_iso_8601": "2023-09-10T15:41:16.876027Z",
"url": "https://files.pythonhosted.org/packages/de/a4/708263bc3759c72582dce4344ac702158997fb1c0e9d601db4c95bf90768/pymerger-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-10 15:41:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yamenk-gribaudo",
"github_project": "pymerger",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "pymerger"
}