Package: toml-union
AboutPython usage exampleOverridesCLIAboutpipinstalltoml-unionThis PyPI package is located in one script and combines several*.tomlfiles (usiallypyproject.toml) into one. If it finds some conflict between items, they are kept for manual review.It has a docker image (docker pull pasaopasen/toml-union) and anexampleof its usage.Python usage examplefrompathlibimportPathfromtoml_unionimporttoml_union_process# run uniontoml_union_process(files=Path('input').glob('*.toml'),# get all *.toml files from examples diroutfile='output.toml',# set output file pathreport='report.json',# path for conflicts report on conflict case)It combines next files:[tool.poetry]name="project 1"version="1.6.0"description="Some words"authors=["Me"][tool.poetry.dependencies]"pdfminer.six"="^20220524"cmake="^3.21.1"other_package="1"[tool.poetry.group.dev.dependencies]autopep8="^1.5"black="~21.8b0"ipython="^8.0"pylint-django="^2.3.0"pytest-django="^4.5.2"[tool.poetry]name="project 2"version="1.6.0"description="Some words"authors=["Me"][tool.poetry.dependencies]"pdfminer.six"="^2022333333334"torch={version="1.10.1+cu113",source="pytorch"}torchvision={version="0.11.2+cu113",source="pytorch"}other_package="2"[tool.poetry.group.dev.dependencies]autopep8="^1.5"black="~21.8b0"pytest-django="^4.5.2"[build-system]requires=["poetry-core>=1.0.0"]build-backend="poetry.core.masonry.api"[tool.poetry]name="project 1"version="1.6.0"description="Some words"authors=["Somebody"][tool.poetry.dependencies]"pdfminer.six"="^20220524"ansi2html="^1.7"beautifulsoup4="^4.10.0"boto3="^1.16.56"chardet="^4.0.0"Django="~3.1"django-allauth="^0.51"django-rosetta="^0.9.5"djangorestframework="3.13.1"cmake="~3.21.1"[tool.poetry.group.dev.dependencies]autopep8=">=1.5.6"[build-system]requires=["poetry>=0.12"]build-backend="poetry.masonry.api"to this:[build-system]build-backend=["poetry.core.masonry.api","poetry.masonry.api",]requires=["poetry-core>=1.0.0","poetry>=0.12",][tool.poetry]authors=["Me","Somebody",]description="Some words"name=["project 1","project 2",]version="1.6.0"[tool.poetry.dependencies]"pdfminer.six"=["^20220524","^2022333333334",]ansi2html="^1.7"beautifulsoup4="^4.10.0"boto3="^1.16.56"chardet="^4.0.0"cmake=["^3.21.1","~3.21.1",]Django="~3.1"django-allauth="^0.51"django-rosetta="^0.9.5"djangorestframework="3.13.1"other_package=["1","2",][tool.poetry.dependencies.torch]source="pytorch"version="1.10.1+cu113"[tool.poetry.dependencies.torchvision]source="pytorch"version="0.11.2+cu113"[tool.poetry.group.dev.dependencies]autopep8=["^1.5",">=1.5.6",]black="~21.8b0"ipython="^8.0"pylint-django="^2.3.0"pytest-django="^4.5.2"As u see, some of packages has confict versions. In this case the report file is created and contains the sources of this conflicts:"pdfminer.six":{"^20220524":["input/file1.toml","input/file3.toml"],"^2022333333334":["input/file2.toml"]},"cmake":{"^3.21.1":["input/file1.toml"],"~3.21.1":["input/file3.toml"]},"other_package":{"1":["input/file1.toml"],"2":["input/file2.toml"]}OverridesThere is the ability to override some items in target*.tomlfile. Use syntax:toml_union_process(files=Path('input').glob('*.toml'),outfile='output.toml',report='report.json',overrides={'tool.poetry.name':'union','tool.poetry.version':'12'})In the result u will have:[tool.poetry]name="union"version="12"CLIEquivalent CLI command:toml-unionexamples/input/file1.tomlexamples/input/file2.tomlexamples/input/file3.toml-ooutput.toml-rreport.json-ktool.poetry.name=union-ktool.poetry.version=12Help message:toml-union-h

usage:toml_union.py[-h][--outputOUTFILE][--unicode-escape][--reportREPORT][--remove-field[REMOVE_FIELDS[REMOVE_FIELDS...]]][--key-valueKEY=VALUE][--ckey-valueKEY=VALUE]INPUT[INPUT...]Combinesseveraltomlfilestoonewithconflictsshowing

positionalarguments:INPUTinputtomlfilespaths

optionalarguments:-h,--helpshowthishelpmessageandexit--outputOUTFILE,-oOUTFILEoutputtomlfilepath,emptyvaluemeanstoprinttoconsole(default:None)--unicode-escape,-uwhethertotrytoescapeunicodesequencesintheoutfile,usefulwhenoutfilehasmanyslashesandcodes(default:False)--reportREPORT,-rREPORTpathtoreportjsononfailure(default:None)--remove-field[REMOVE_FIELDS[REMOVE_FIELDS...]],-e[REMOVE_FIELDS[REMOVE_FIELDS...]]Fieldstoremove.Mayappearmultipletimes(default:None)--key-valueKEY=VALUE,-kKEY=VALUEAddkey/valueparams.Mayappearmultipletimes(default:{})--ckey-valueKEY=VALUE,-cKEY=VALUESameas--key-valuebutwillbeperformedonlyonconflictcases(default:{})