Skip to content

Commit

Permalink
Merge 5088992 into 6942431
Browse files Browse the repository at this point in the history
  • Loading branch information
eeintech committed Jun 2, 2022
2 parents 6942431 + 5088992 commit 0a6627f
Show file tree
Hide file tree
Showing 13 changed files with 194 additions and 226 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

strategy:
matrix:
python-version: [3.7, 3.9]
python-version: ['3.8', '3.10']

steps:
- name: Checkout code
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:

strategy:
matrix:
python-version: [3.7, 3.9]
python-version: ['3.8', '3.10']

steps:
- name: Checkout code
Expand Down Expand Up @@ -131,10 +131,10 @@ jobs:
run: |
head pyproject.toml
head kintree/__init__.py
- name: Set up Python 3.9
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Install dependencies
run: pip install -U poetry
- name: Install poetry dependencies
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Ki-nTree was developped by [@eeintech](https://github.com/eeintech) for [SPARK M

### Requirements

* Ki-nTree is currently tested for Python 3.7 to 3.9 versions.
* Ki-nTree is currently tested for Python 3.8 to 3.10 versions.
* Ki-nTree requires a Digi-Key **production** API instance. To create one, go to https://developer.digikey.com/. Create an account, an organization and add a **production** API to your organization. Save both Client ID and Secret keys.
> [Here is a video](https://youtu.be/OI1EGEc0Ju0) to help with the different steps
* Ki-nTree requires a Mouser Search API key. To request one, head over to https://www.mouser.ca/api-search/ and click on "Sign Up for Search API"
Expand Down Expand Up @@ -153,7 +153,7 @@ Enjoy!

### Requirements

You need `python>=3.7` and `poetry`.
You need `python>=3.8` and `poetry`.

You can install poetry by following the instructions [on its official website](https://python-poetry.org/docs/master/#installation), by using `pip install poetry` or by installing a package on your Linux distro.

Expand Down
2 changes: 1 addition & 1 deletion images/python_versions.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions kintree/common/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ def download(url, filetype='API data', fileoutput='', timeout=3, enable_headers=
return None


def download_image(image_url: str, image_full_path: str) -> str:
def download_image(image_url: str, image_full_path: str, silent=False) -> str:
''' Standard method to download image URL to local file '''

if not image_url:
cprint('[INFO]\tError: Missing image URL', silent=False)
cprint('[INFO]\tError: Missing image URL', silent=silent)
return False

# Try without headers
image = download(image_url, filetype='Image', fileoutput=image_full_path)
image = download(image_url, filetype='Image', fileoutput=image_full_path, silent=silent)

if not image:
# Try with headers
image = download(image_url, filetype='Image', fileoutput=image_full_path, enable_headers=True)
image = download(image_url, filetype='Image', fileoutput=image_full_path, enable_headers=True, silent=silent)

# Still nothing
if not image:
Expand Down
4 changes: 2 additions & 2 deletions kintree/config/inventree/parameters.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Parameters
# Name: Unit
(Min) Output Voltage: V
Min Output Voltage: V
Antenna Type: null
B Constant: K
Breakdown Voltage: V
Capacitance: nF
Clamping Voltage: V
Collector-Gate Voltage: V
Collector Gate Voltage: V
DC Resistance: mOhm
ESR: mOhm
Footprint: null
Expand Down
7 changes: 3 additions & 4 deletions kintree/database/inventree_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@

# InvenTree
from inventree.api import InvenTreeAPI
from inventree.base import Parameter, ParameterTemplate
from inventree.company import Company, ManufacturerPart, SupplierPart
from inventree.part import Part, PartCategory
from inventree.part import Part, PartCategory, Parameter, ParameterTemplate


def connect(server: str, username: str, password: str, connect_timeout=5, silent=False) -> bool:
Expand Down Expand Up @@ -145,7 +144,7 @@ def fetch_template_name(template_id):

for part in part_list:
# Get part parameters
db_part_parameters = part.getParameters()
db_part_parameters = Parameter.list(inventree_api, part=part.pk)
part_parameters = {}
for parameter in db_part_parameters:
parameter_name = fetch_template_name(parameter.template)
Expand Down Expand Up @@ -515,7 +514,7 @@ def create_parameter(part_id: int, template_name: int, value: str):

# Check if template_id already exists for this part
part = Part(inventree_api, part_id)
part_parameters = part.getParameters()
part_parameters = Parameter.list(inventree_api, part=part.pk)
is_new_part_parameters_template_id = True
for item in part_parameters:
# cprint(f'[TREE]\t{parameter.template} ?= {template_id}', silent=SILENT)
Expand Down
10 changes: 5 additions & 5 deletions kintree/kicad/templates/capacitor-polarized.kicad_sym
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
(property "Reference" "C" (id 0) (at 0 3.81 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "IPN" (id 1) (at 0 -12.7 0)
(property "Value" "IPN" (id 1) (at 0 -11.43 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Footprint" "Footprint" (id 2) (at 0 -20.32 0)
(property "Footprint" "Footprint" (id 2) (at 0 -19.05 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "inventree_url" (id 3) (at 0 -22.86 0)
(property "Datasheet" "inventree_url" (id 3) (at 0 -21.59 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer" "Manufacturer" (id 4) (at 0 -15.24 0)
(property "Manufacturer" "Manufacturer" (id 4) (at 0 -13.97 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Manufacturer Part Number" "MPN" (id 5) (at 0 -17.78 0)
(property "Manufacturer Part Number" "MPN" (id 5) (at 0 -16.51 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Capacitance (Farad)" "Value" (id 6) (at 0 -3.81 0)
Expand Down
2 changes: 1 addition & 1 deletion kintree/search/lcsc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_api() -> bool:

test_success = True
expected = {
'productIntroEn': '25V 100pF C0G ±5% 0201 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHS',
'productIntroEn': '25V 100pF C0G ±5% 0201 Multilayer Ceramic Capacitors MLCC - SMD/SMT ROHS',
'productCode': 'C2181718',
'brandNameEn': 'TDK',
'productModel': 'C0603C0G1E101J030BA',
Expand Down

0 comments on commit 0a6627f

Please sign in to comment.