git clone git@gist.github.com:3eacdb13be1075a76fb43e20fcc77fa3.gitpython3 -m venv venvsource venv/bin/activatepip3 install -r requirements.txtpython3 calccost.py --helpUsage: calccost.py [OPTIONS] An application to feed onto computer build configuration from a YAML file and return calculated insights on them Options: -f, --filename TEXT Open set of components from file. -t, --totalsum Show the total price of the build. -d, --detailed Show the detailed tabular information. -c, --costdata Show the source URLs and pricing. -m, --metadata Show the metadata for the config. --version Show the version and exit. --help Show this message and exit.python3 calccost.py --totalsum --filename 05112021.yml
or
python3 calccost.py -tf 05112021.ymlQUANTITY: 9 items, TDP: 405W, PRICE: 269253python3 calccost.py --detailed --filename 05112021.yml
or
python3 calccost.py -df 05112021.yml+-------------------------+-------------------------------------------------------------------------------------------+----------+-----+ | CLASS | NAME | QUANTITY | TDP | +-------------------------+-------------------------------------------------------------------------------------------+----------+-----+ | CentralProcessingUnit | AMD Ryzen 7 5800X | 1 | 105 | | ProcessorCooler | Noctua NH-D15 Chromax Pure Black CPU Cooler with Dual 140m Fans | 1 | 0 | | Motherboard | ASUS TUF GAMING X570-PLUS AMD X570 ATX Gaming Motherboard | 1 | 0 | | GraphicalProcessingUnit | ASUS TUF GAMING Radeon RX 6900 XT 16GB GDDR6 Graphic Card TUF-RX6900XT-O16G-GAMING | 1 | 300 | | MemoryModules | G.Skill RipjawsV 64GB (2x32GB) 4400MHz Memory F4-4400C19D-64GVK | 1 | 0 | | PowerSupplyUnit | ASUS ROG Strix 850G 850W 80 PLUS Gold Modular Power Supply | 1 | 0 | | WirelessConnection | ASUS PCE-AX3000 WIRELESS DUAL-BAND WI-FI PCIE ADAPTER | 1 | 0 | | PrimaryStorage | ADATA XPG GAMMIX S50 LITE 1TB 3D NAND GEN4 PCIE X4 M.2 NVME INTERNAL SSD AGAMMIXS50L-1T-C | 1 | 0 | | SecondaryStorage | None | 0 | 0 | | VerticalTowerCabinet | ASUS TUF Gaming GT501 E-ATX Mid Tower Cabinet With Tempered Glass Side Panel | 1 | 0 | +-------------------------+-------------------------------------------------------------------------------------------+----------+-----+python3 calccost.py --costdata --filename 05112021.yml
or
python3 calccost.py -cf 05112021.yml+-------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+--------+ | CLASS | URL | PRICE | +-------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+--------+ | CentralProcessingUnit | https://www.primeabgb.com/online-price-reviews-india/amd-ryzen-7-5800x-desktop-processor-8-cores-16-threads-3-8ghz/ | 34397 | | ProcessorCooler | https://www.primeabgb.com/online-price-reviews-india/noctua-nh-d15-chromax-pure-black-cpu-cooler-dual-140m-fans/ | 8092 | | Motherboard | https://www.primeabgb.com/online-price-reviews-india/asus-tuf-gaming-x570-plus-amd-x570-atx-gaming-motherboard/ | 18450 | | GraphicalProcessingUnit | https://www.primeabgb.com/online-price-reviews-india/asus-tuf-gaming-radeon-rx-6900-xt-16gb-gddr6-graphic-card-tuf-rx6900xt-o16g-gaming/ | 131499 | | MemoryModules | https://www.primeabgb.com/online-price-reviews-india/g-skill-ripjawsv-64gb-2x32gb-4400mhz-memory/ | 32799 | | PowerSupplyUnit | https://www.primeabgb.com/online-price-reviews-india/asus-rog-strix-850g-850w-80-plus-gold-modular-power-supply/ | 14719 | | WirelessConnection | https://www.primeabgb.com/online-price-reviews-india/asus-pce-ax3000-wireless-dual-band-wi-fi-pcie-adapter/ | 3299 | | PrimaryStorage | https://www.primeabgb.com/online-price-reviews-india/adata-xpg-gammix-s50-lite-1tb-3d-nand-gen4-pcie-x4-m-2-nvme-internal-ssd-agammixs50l-1t-c/ | 11499 | | SecondaryStorage | None | 0 | | VerticalTowerCabinet | https://www.primeabgb.com/online-price-reviews-india/asus-tuf-gaming-gt501-e-atx-mid-tower-cabinet-tempered-glass-side-panel/ | 14499 | +-------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------+--------+python3 calccost.py --metadata --filename 05112021.yml
or
python3 calccost.py -mf 05112021.yml+----------+--------------------------+ | KEY | VALUE | +----------+--------------------------+ | Author | Akashdeep Dhar | | Email | akashdeep.dhar@gmail.com | | Datetime | 17:18, 05 Nov 2021 | | Timezone | Asia/Kolkata | +----------+--------------------------+python3 calccost.py --version
or
python3 calccost.py -vPocketDestroyer, version 0.1.0
Last active
November 20, 2021 05:15
-
-
Save gridhead/3eacdb13be1075a76fb43e20fcc77fa3 to your computer and use it in GitHub Desktop.
Gaming PC Performance Build Writeups
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Metadata: | |
| Author: "Akashdeep Dhar" | |
| Email: "akashdeep.dhar@gmail.com" | |
| Datetime: "17:18, 05 Nov 2021" | |
| Timezone: "Asia/Kolkata" | |
| Components: | |
| CentralProcessingUnit: | |
| Name: "AMD Ryzen 7 5800X" | |
| Quantity: 1 | |
| TDP: 105 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/amd-ryzen-7-5800x-desktop-processor-8-cores-16-threads-3-8ghz/" | |
| Price: 34397 | |
| ProcessorCooler: | |
| Name: "Noctua NH-D15 Chromax Pure Black CPU Cooler with Dual 140m Fans" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/noctua-nh-d15-chromax-pure-black-cpu-cooler-dual-140m-fans/" | |
| Price: 8092 | |
| Motherboard: | |
| Name: "ASUS TUF GAMING X570-PLUS AMD X570 ATX Gaming Motherboard" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/asus-tuf-gaming-x570-plus-amd-x570-atx-gaming-motherboard/" | |
| Price: 18450 | |
| GraphicalProcessingUnit: | |
| Name: "ASUS TUF GAMING Radeon RX 6900 XT 16GB GDDR6 Graphic Card TUF-RX6900XT-O16G-GAMING" | |
| Quantity: 1 | |
| TDP: 300 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/asus-tuf-gaming-radeon-rx-6900-xt-16gb-gddr6-graphic-card-tuf-rx6900xt-o16g-gaming/" | |
| Price: 131499 | |
| MemoryModules: | |
| Name: "G.Skill RipjawsV 64GB (2x32GB) 4400MHz Memory F4-4400C19D-64GVK" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/g-skill-ripjawsv-64gb-2x32gb-4400mhz-memory/" | |
| Price: 32799 | |
| PowerSupplyUnit: | |
| Name: "ASUS ROG Strix 850G 850W 80 PLUS Gold Modular Power Supply" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/asus-rog-strix-850g-850w-80-plus-gold-modular-power-supply/" | |
| Price: 14719 | |
| WirelessConnection: | |
| Name: "ASUS PCE-AX3000 WIRELESS DUAL-BAND WI-FI PCIE ADAPTER" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/asus-pce-ax3000-wireless-dual-band-wi-fi-pcie-adapter/" | |
| Price: 3299 | |
| PrimaryStorage: | |
| Name: "ADATA XPG GAMMIX S50 LITE 1TB 3D NAND GEN4 PCIE X4 M.2 NVME INTERNAL SSD AGAMMIXS50L-1T-C" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/adata-xpg-gammix-s50-lite-1tb-3d-nand-gen4-pcie-x4-m-2-nvme-internal-ssd-agammixs50l-1t-c/" | |
| Price: 11499 | |
| SecondaryStorage: | |
| Name: "None" | |
| Quantity: 0 | |
| TDP: 0 | |
| Source: | |
| URL: "None" | |
| Price: 0 | |
| VerticalTowerCabinet: | |
| Name: "ASUS TUF Gaming GT501 E-ATX Mid Tower Cabinet With Tempered Glass Side Panel" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/asus-tuf-gaming-gt501-e-atx-mid-tower-cabinet-tempered-glass-side-panel/" | |
| Price: 14499 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Metadata: | |
| Author: "Akashdeep Dhar" | |
| Email: "akashdeep.dhar@gmail.com" | |
| Datetime: "10:42, 20 Nov 2021" | |
| Timezone: "Asia/Kolkata" | |
| Components: | |
| CentralProcessingUnit: | |
| Name: "AMD Ryzen 7 5900X" | |
| Quantity: 1 | |
| TDP: 105 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/amd-ryzen-9-5900x-desktop-processor-12-cores-24-threads-3-7ghz/" | |
| Price: 48999 | |
| ProcessorCooler: | |
| Name: "Noctua NH-D15 Chromax Pure Black CPU Cooler with Dual 140m Fans" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/noctua-nh-d15-chromax-pure-black-cpu-cooler-dual-140m-fans/" | |
| Price: 8092 | |
| Motherboard: | |
| Name: "ASUS ROG Strix X570-F Gaming AMD X570 ATX Gaming Motherboard" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/asus-rog-strix-x570-f-gaming-amd-x570-atx-gaming-motherboard/" | |
| Price: 25750 | |
| GraphicalProcessingUnit: | |
| Name: "ASUS TUF GAMING Radeon RX 6900 XT 16GB GDDR6 Graphic Card TUF-RX6900XT-O16G-GAMING" | |
| Quantity: 1 | |
| TDP: 300 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/asus-tuf-gaming-radeon-rx-6900-xt-16gb-gddr6-graphic-card-tuf-rx6900xt-o16g-gaming/" | |
| Price: 131499 | |
| MemoryModules: | |
| Name: "G.Skill TZ Royal Silver Series 64GB (2x32GB) 3600 MHz DDR4 Memory F4-3600C16D-64GTRS" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/g-skill-tz-royal-silver-series-64gb-2x32gb-3600-mhz-ddr4-memory-f4-3600c16d-64gtrs/" | |
| Price: 31682 | |
| PowerSupplyUnit: | |
| Name: "ASUS ROG Strix 850G 850W 80 PLUS Gold Modular Power Supply" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/asus-rog-strix-850g-850w-80-plus-gold-modular-power-supply/" | |
| Price: 14719 | |
| WirelessConnection: | |
| Name: "ASUS PCE-AX3000 WIRELESS DUAL-BAND WI-FI PCIE ADAPTER" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/asus-pce-ax3000-wireless-dual-band-wi-fi-pcie-adapter/" | |
| Price: 3299 | |
| PrimaryStorage: | |
| Name: "ADATA XPG GAMMIX S11 Pro 512GB PCIe Gen3x4 M.2 NVME SSD AGAMMIXS11P-512GT-C" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/adata-xpg-gammix-s11-pro-512gb-pcie-gen3x4-m-2-nvme-ssd-agammixs11p-512gt-c/" | |
| Price: 5699 | |
| SecondaryStorage: | |
| Name: "CRUCIAL BX500 1TB 3D NAND INTERNAL SSD CT1000BX500SSD1" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/crucial-bx500-1tb-3d-nand-internal-ssd-ct1000bx500ssd1/" | |
| Price: 7999 | |
| VerticalTowerCabinet: | |
| Name: "ASUS TUF Gaming GT501 E-ATX Mid Tower Cabinet With Tempered Glass Side Panel" | |
| Quantity: 1 | |
| TDP: 0 | |
| Source: | |
| URL: "https://www.primeabgb.com/online-price-reviews-india/asus-tuf-gaming-gt501-e-atx-mid-tower-cabinet-tempered-glass-side-panel/" | |
| Price: 14499 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sys import exit | |
| from click import command, echo, option, style, version_option | |
| from prettytable import PrettyTable | |
| from yaml import CLoader, load | |
| from yaml.scanner import ScannerError | |
| def return_total_price_of_the_build(contents): | |
| sumprice, tdptotal, quantity = 0, 0, 0 | |
| for compitem in contents["Components"]: | |
| sumprice += contents["Components"][compitem]["Source"]["Price"] | |
| tdptotal += contents["Components"][compitem]["TDP"] | |
| quantity += contents["Components"][compitem]["Quantity"] | |
| echo( | |
| style( | |
| "QUANTITY: %s items, TDP: %sW, PRICE: %s" % (quantity, tdptotal, sumprice), | |
| bold=True, | |
| ) | |
| ) | |
| exit() | |
| def return_detailed_tabular_information(contents): | |
| tabletdp = PrettyTable(["CLASS", "NAME", "QUANTITY", "TDP"]) | |
| for compitem in contents["Components"]: | |
| tabletdp.add_row( | |
| [ | |
| style(compitem, fg="green"), | |
| style(contents["Components"][compitem]["Name"]), | |
| style(contents["Components"][compitem]["Quantity"], fg="blue"), | |
| style(contents["Components"][compitem]["TDP"], fg="magenta"), | |
| ] | |
| ) | |
| ( | |
| tabletdp.align["CLASS"], | |
| tabletdp.align["NAME"], | |
| tabletdp.align["QUANTITY"], | |
| tabletdp.align["TDP"], | |
| tabletdp.align["PRICE"], | |
| ) = ("l", "l", "r", "r", "r") | |
| echo(tabletdp) | |
| exit() | |
| def return_source_information(contents): | |
| tableurl = PrettyTable(["CLASS", "URL", "PRICE"]) | |
| for compitem in contents["Components"]: | |
| tableurl.add_row( | |
| [ | |
| style(compitem, fg="green"), | |
| style(contents["Components"][compitem]["Source"]["URL"]), | |
| style(contents["Components"][compitem]["Source"]["Price"], fg="red"), | |
| ] | |
| ) | |
| ( | |
| tableurl.align["CLASS"], | |
| tableurl.align["URL"], | |
| tableurl.align["PRICE"], | |
| ) = ("l", "l", "r") | |
| echo(tableurl) | |
| exit() | |
| def return_config_metadata(contents): | |
| tablecfg = PrettyTable(["KEY", "VALUE"]) | |
| for metaitem in contents["Metadata"]: | |
| tablecfg.add_row( | |
| [style(metaitem, fg="green"), style(contents["Metadata"][metaitem])] | |
| ) | |
| tablecfg.align["KEY"], tablecfg.align["VALUE"] = "l", "l" | |
| echo(tablecfg) | |
| exit() | |
| @command() | |
| @option( | |
| "-f", "--filename", "filename", help="Open set of components from file.", default="" | |
| ) | |
| @option( | |
| "-t", | |
| "--totalsum", | |
| "resultpt", | |
| flag_value="totalsum", | |
| help="Show the total price of the build.", | |
| ) | |
| @option( | |
| "-d", | |
| "--detailed", | |
| "resultpt", | |
| flag_value="detailed", | |
| help="Show the detailed tabular information.", | |
| ) | |
| @option( | |
| "-c", | |
| "--costdata", | |
| "resultpt", | |
| flag_value="costdata", | |
| help="Show the source URLs and pricing.", | |
| ) | |
| @option( | |
| "-m", | |
| "--metadata", | |
| "resultpt", | |
| flag_value="metadata", | |
| help="Show the metadata for the config.", | |
| ) | |
| @version_option(version="0.1.0", prog_name="PocketDestroyer") | |
| def main(filename, resultpt): | |
| """ | |
| An application to feed onto computer build configuration from a YAML file and return calculated insights on them | |
| """ | |
| if filename == "": | |
| echo("No file name provided") | |
| exit() | |
| else: | |
| try: | |
| with open(filename, "r") as compfile: | |
| try: | |
| contents = load(compfile.read(), Loader=CLoader) | |
| if resultpt == "totalsum": | |
| return_total_price_of_the_build(contents) | |
| elif resultpt == "detailed": | |
| return_detailed_tabular_information(contents) | |
| elif resultpt == "costdata": | |
| return_source_information(contents) | |
| elif resultpt == "metadata": | |
| return_config_metadata(contents) | |
| else: | |
| return_config_metadata(contents) | |
| except ScannerError: | |
| echo("File was not correctly formatted") | |
| exit() | |
| except FileNotFoundError: | |
| echo("Specified file was not found") | |
| exit() | |
| if __name__ == "__main__": | |
| main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| click>=8.0.0 | |
| prettytable>=2.4.0 | |
| PyYAML>=6.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment