spreadsheet-wrangler


Namespreadsheet-wrangler JSON
Version 0.1.6 PyPI version JSON
download
home_pageNone
SummaryPlace components in a kicad file programmatically.
upload_time2024-05-16 01:13:28
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2023, Simon Hobbs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords spreadsheet_wrangler kicad python eda electronics pcb manufacturing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # spreadsheet-wrangler
Command line tool for interacting with spreadsheet data

## Installation
### pypi
```
pip install spreadsheet-wrangler
```

### Source
```
git clone https://github.com/snhobbs/spreadsheet-wrangler.git
cd spreadsheet-wrangler
pip install .
```

## Functions
- merge: Left merge two spreadsheets and save as xlsx
- compare: Compare two spreadsheets on a column name, prints out the discrepancies
- cluster: Combine the same values in a specified column as an array with the same name as the clustered column. The remainder of the first rows data is kept.
- uncluster: Unpack clustered columns into one entry for each. The row is duplicated for each entry.
- filter

## Usage Examples
These examples follow the use case of working with a bill of materials (BOM). A specialized tool that uses this library for this use case is
available here[https://github.com/snhobbs/BOMTools].

### Expand a list of designators and unique identifiers with additional data
To expand a list of reference designators and unique identifier of a part (bom.xlsx) with
additionally available data (data_store.xlsx) use the spreadsheet_wrangler tool:
```
spreadsheet_wrangler.py merge --on="pn" -l bom.xlsx -r data_store.xlsx -p '{"pn":["Internal Part Number"]}'
```
Any unique identifier will work, examples are: manufacturers part number, internal part number, index to a database, etc.
Equivalent names for columns are passed to the tool in a JSON format. A file titled bom_Merged_data_store_On_pn.xlsx will be generated with this command.

### Compare the data in two BOMS
To compare the available data of two BOMs to compare function of spreadsheet_wrangler should be used. If a BOM was exported
and needs to be checked against another with questionable history run:
```
spreadsheet_wrangler.py compare --on="ref-des" -l bom.xlsx -r bom_Merged_data_store_On_pn.xlsx
```
This will compare the original BOM with the merged one from the first example. Comparisons are done column by column with rows matched by the value in the column passed with the argument "--on". This should be a unique for each instance of a part (i.e a ref des).
The shared columns will be checked as well as any passed in with the --columns argument. Discrepancies are printed to screen.

### Generate a BOM sorted by the type of parts
BOMs used for ordering, shipping, budgeting, or shipping to a CM are typically ordered by the type of part.

The ordering BOM sorts by reference designator and combines the BOM into unique part types. This can then be used for ordering or quoting. This can be passed to a tool like kicost or used with supplier BOM Managers or the Octopart BOM Manager (recommended).

To sort a BOM by the type of part and with a list of the reference designators run:
```
spreadsheet_wrangler.py cluster --column="ref-des" --on="pn" -s bom_clustered_on_ref-des.xlsx
```

### Compare a BOM sorted by the type of parts with a design BOM
To compare a BOM sorted by the part type (as shown above) with a BOM sorted by reference designator the BOM needs to be unpacked first and then compared.
To unpack run:
```
spreadsheet_wrangler.py uncluster --column="ref-des" -s bom_unclustered.xlsx
```
This will separate the lines like the original bom.xlsx. This BOM can now be compared using the compare function described above.

NOTE: Note the data in each grouped row is duplicated for each clustered element. This is not necessarily correct if data was dissimilar and lost during the clustering step.

### Clustering a partially filled in BOM
After exporting a design BOM with each component in it's own line you end up with what I call a design BOM except without the useful fields included.

![unclustered BOM](unclustered_bom.png)

For this I want to cluster based on "Comment" and "Footprint", that is I want all 0603 10K resistors together and not include any other 0603 or 10K parts in the cluster. The command would then be:

```
spreadsheet_wrangler.py cluster --spreadsheet BOM-1x2_tester.csv --column "Designator" --on "Comment" --on "Footprint" -o BOM_clustered.xlsx
```
This call turns the above BOM into:

![clustered on comment and footprint](clustered_on_comment_and_footprint.png)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "spreadsheet-wrangler",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "spreadsheet_wrangler, kicad, python, eda, electronics, pcb, manufacturing",
    "author": null,
    "author_email": "Simon Hobbs <simon.hobbs@electrooptical.net>",
    "download_url": "https://files.pythonhosted.org/packages/34/af/85ea2029fb36647c0fe5d8d866b9f7617a2faa5a2e85c5723e2fb0d0bf94/spreadsheet_wrangler-0.1.6.tar.gz",
    "platform": null,
    "description": "# spreadsheet-wrangler\nCommand line tool for interacting with spreadsheet data\n\n## Installation\n### pypi\n```\npip install spreadsheet-wrangler\n```\n\n### Source\n```\ngit clone https://github.com/snhobbs/spreadsheet-wrangler.git\ncd spreadsheet-wrangler\npip install .\n```\n\n## Functions\n- merge: Left merge two spreadsheets and save as xlsx\n- compare: Compare two spreadsheets on a column name, prints out the discrepancies\n- cluster: Combine the same values in a specified column as an array with the same name as the clustered column. The remainder of the first rows data is kept.\n- uncluster: Unpack clustered columns into one entry for each. The row is duplicated for each entry.\n- filter\n\n## Usage Examples\nThese examples follow the use case of working with a bill of materials (BOM). A specialized tool that uses this library for this use case is\navailable here[https://github.com/snhobbs/BOMTools].\n\n### Expand a list of designators and unique identifiers with additional data\nTo expand a list of reference designators and unique identifier of a part (bom.xlsx) with\nadditionally available data (data_store.xlsx) use the spreadsheet_wrangler tool:\n```\nspreadsheet_wrangler.py merge --on=\"pn\" -l bom.xlsx -r data_store.xlsx -p '{\"pn\":[\"Internal Part Number\"]}'\n```\nAny unique identifier will work, examples are: manufacturers part number, internal part number, index to a database, etc.\nEquivalent names for columns are passed to the tool in a JSON format. A file titled bom_Merged_data_store_On_pn.xlsx will be generated with this command.\n\n### Compare the data in two BOMS\nTo compare the available data of two BOMs to compare function of spreadsheet_wrangler should be used. If a BOM was exported\nand needs to be checked against another with questionable history run:\n```\nspreadsheet_wrangler.py compare --on=\"ref-des\" -l bom.xlsx -r bom_Merged_data_store_On_pn.xlsx\n```\nThis will compare the original BOM with the merged one from the first example. Comparisons are done column by column with rows matched by the value in the column passed with the argument \"--on\". This should be a unique for each instance of a part (i.e a ref des).\nThe shared columns will be checked as well as any passed in with the --columns argument. Discrepancies are printed to screen.\n\n### Generate a BOM sorted by the type of parts\nBOMs used for ordering, shipping, budgeting, or shipping to a CM are typically ordered by the type of part.\n\nThe ordering BOM sorts by reference designator and combines the BOM into unique part types. This can then be used for ordering or quoting. This can be passed to a tool like kicost or used with supplier BOM Managers or the Octopart BOM Manager (recommended).\n\nTo sort a BOM by the type of part and with a list of the reference designators run:\n```\nspreadsheet_wrangler.py cluster --column=\"ref-des\" --on=\"pn\" -s bom_clustered_on_ref-des.xlsx\n```\n\n### Compare a BOM sorted by the type of parts with a design BOM\nTo compare a BOM sorted by the part type (as shown above) with a BOM sorted by reference designator the BOM needs to be unpacked first and then compared.\nTo unpack run:\n```\nspreadsheet_wrangler.py uncluster --column=\"ref-des\" -s bom_unclustered.xlsx\n```\nThis will separate the lines like the original bom.xlsx. This BOM can now be compared using the compare function described above.\n\nNOTE: Note the data in each grouped row is duplicated for each clustered element. This is not necessarily correct if data was dissimilar and lost during the clustering step.\n\n### Clustering a partially filled in BOM\nAfter exporting a design BOM with each component in it's own line you end up with what I call a design BOM except without the useful fields included.\n\n![unclustered BOM](unclustered_bom.png)\n\nFor this I want to cluster based on \"Comment\" and \"Footprint\", that is I want all 0603 10K resistors together and not include any other 0603 or 10K parts in the cluster. The command would then be:\n\n```\nspreadsheet_wrangler.py cluster --spreadsheet BOM-1x2_tester.csv --column \"Designator\" --on \"Comment\" --on \"Footprint\" -o BOM_clustered.xlsx\n```\nThis call turns the above BOM into:\n\n![clustered on comment and footprint](clustered_on_comment_and_footprint.png)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023, Simon Hobbs  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Place components in a kicad file programmatically.",
    "version": "0.1.6",
    "project_urls": {
        "github": "https://github.com/snhobbs/spreadsheet-wrangler.git"
    },
    "split_keywords": [
        "spreadsheet_wrangler",
        " kicad",
        " python",
        " eda",
        " electronics",
        " pcb",
        " manufacturing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "96f9d4a6396a49eaf491f5b81ca340152c282b8df073c5fb589b0a691eea3f2f",
                "md5": "4e4f030c7aa5abcd667ed14a82bb7373",
                "sha256": "1770b69e7695eda6ccb1e2a32e68fc04c8a0a480b2d67ea8abe8ca4660752cd6"
            },
            "downloads": -1,
            "filename": "spreadsheet_wrangler-0.1.6-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4e4f030c7aa5abcd667ed14a82bb7373",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.8",
            "size": 12878,
            "upload_time": "2024-05-16T01:13:27",
            "upload_time_iso_8601": "2024-05-16T01:13:27.779737Z",
            "url": "https://files.pythonhosted.org/packages/96/f9/d4a6396a49eaf491f5b81ca340152c282b8df073c5fb589b0a691eea3f2f/spreadsheet_wrangler-0.1.6-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "34af85ea2029fb36647c0fe5d8d866b9f7617a2faa5a2e85c5723e2fb0d0bf94",
                "md5": "fd67243f0a0fa52781e61f8515dc73fe",
                "sha256": "cccac28de08ba6eb7b100e727d24669059d238dfb56fa663dd79de4d3417d426"
            },
            "downloads": -1,
            "filename": "spreadsheet_wrangler-0.1.6.tar.gz",
            "has_sig": false,
            "md5_digest": "fd67243f0a0fa52781e61f8515dc73fe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 141257,
            "upload_time": "2024-05-16T01:13:28",
            "upload_time_iso_8601": "2024-05-16T01:13:28.960575Z",
            "url": "https://files.pythonhosted.org/packages/34/af/85ea2029fb36647c0fe5d8d866b9f7617a2faa5a2e85c5723e2fb0d0bf94/spreadsheet_wrangler-0.1.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-16 01:13:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "snhobbs",
    "github_project": "spreadsheet-wrangler",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "spreadsheet-wrangler"
}
        
Elapsed time: 0.30671s