Skip to content

Commit

Permalink
Merge pull request #145 from sparkmicro/1.0.0
Browse files Browse the repository at this point in the history
1.0.0
  • Loading branch information
eeintech authored Apr 14, 2023
2 parents 9af3782 + a99d6d3 commit 74c19e6
Show file tree
Hide file tree
Showing 21 changed files with 817 additions and 2,456 deletions.
11 changes: 4 additions & 7 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
[run]
omit =
# Do not run coverage on virtual environment files
env-kintree/*
.venv/*
# Skip UI coverage
# Do not run coverage on environment files
*env*
# Skip GUI coverage
kintree/kintree_gui.py
kintree/common/progress.py
kintree/gui/*
# Skip wrapt_timeout_decorator
kintree/wrapt_timeout_decorator/*
kintree/common/progress.py
# Skip test script
run_tests.py
48 changes: 25 additions & 23 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.8', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- name: Checkout code
Expand Down Expand Up @@ -49,16 +49,15 @@ jobs:
INVENTREE_ENV: 0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TOKEN_DIGIKEY: ${{ secrets.TOKEN_DIGIKEY }}
DIGIKEY_CLIENT_ID: ${{ secrets.DIGIKEY_CLIENT_ID }}
DIGIKEY_CLIENT_SECRET: ${{ secrets.DIGIKEY_CLIENT_SECRET }}

continue-on-error: true
strategy:
matrix:
python-version: ['3.8', '3.10']
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
# - name: Test SnapEDA API
# run: |
# curl snapeda.eeinte.ch/?SN74LV4T125PWR
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand All @@ -74,7 +73,7 @@ jobs:
git clone https://github.com/inventree/InvenTree/
mkdir InvenTree/static
cp tests/files/inventree_default_db.sqlite3 InvenTree/
cd InvenTree/ && invoke install && invoke migrate && cd -
cd InvenTree/ && git switch stable && invoke install && invoke migrate && cd -
- name: Ki-nTree setup
run: |
invoke install
Expand All @@ -90,37 +89,40 @@ jobs:
cat gui.log
export len_log=$(cat gui.log | wc -l)
[[ ${len_log} -eq 0 ]] && true || false
- name: Digi-Key API setup
- name: Setup Digi-Key token
if: github.event.pull_request.head.repo.full_name == 'sparkmicro/Ki-nTree'
run: |
git clone https://[email protected]/eeintech/digikey-token.git
cp digikey-token/token_storage.json ~/.config/kintree/cache/
cat ~/.config/kintree/cache/token_storage.json
cd digikey-token/
python digikey_token_refresh.py
git config --global user.email "[email protected]"
git config --global user.name "Ki-nTree Github Actions"
git add -u
git diff-index --quiet HEAD || git commit -m "Update token"
git push origin master
cp token_storage.json ~/.config/kintree/cache/
dk_token=$(cat ~/.config/kintree/cache/token_storage.json)
echo -e "Digi-Key Token: $dk_token\n"
cd ..
- name: Run tests
if: github.event.pull_request.head.repo.full_name == 'sparkmicro/Ki-nTree'
run: |
invoke test
invoke test -e 1
env:
DIGIKEY_CLIENT_ID: ${{ secrets.DIGIKEY_CLIENT_ID }}
DIGIKEY_CLIENT_SECRET: ${{ secrets.DIGIKEY_CLIENT_SECRET }}
MOUSER_PART_API_KEY: ${{ secrets.MOUSER_PART_API_KEY }}
ELEMENT14_PART_API_KEY: ${{ secrets.ELEMENT14_PART_API_KEY }}
- name: Run tests (skip APIs)
if: github.event.pull_request.head.repo.full_name != 'sparkmicro/Ki-nTree'
run: |
invoke test -e 0
- name: Coveralls
if: github.event.pull_request.head.repo.full_name == 'sparkmicro/Ki-nTree'
run: |
coveralls --version
coveralls --service=github
- name: Run build
run: |
invoke build
- name: Push Digi-Key Token
run: |
cd digikey-token/
git pull
cp ~/.config/kintree/cache/token_storage.json .
git config --global user.email "[email protected]"
git config --global user.name "Ki-nTree Github Actions"
git add -u
git diff-index --quiet HEAD || git commit -m "Updated token"
git push origin master
cd ..
test-publish:
name: Publish to Test PyPI, then PyPI
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
dist/
build/
*.spec
# Cache-backup files
# Cache and backup files
*__pycache__*
*.bck
# Test files
Expand Down
14 changes: 3 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
# <img src="https://raw.githubusercontent.com/sparkmicro/Ki-nTree/main/images/logo.png" width="auto" height="32"> Ki-nTree
### Fast part creation in [KiCad](https://kicad.org/) and [InvenTree](https://inventree.org/)
### Fast part creation for [KiCad](https://kicad.org/) and [InvenTree](https://inventree.org/)
[![License: GPL v3.0](https://img.shields.io/badge/license-GPL_v3.0-green.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Python Versions](https://raw.githubusercontent.com/sparkmicro/Ki-nTree/main/images/python_versions.svg)](https://www.python.org/)
[![PyPI](https://img.shields.io/pypi/v/kintree)](https://pypi.org/project/kintree/)
[![Tests | Linting | Publishing](https://github.com/sparkmicro/Ki-nTree/actions/workflows/test_deploy.yaml/badge.svg)](https://github.com/sparkmicro/Ki-nTree/actions)
[![Coverage Status](https://coveralls.io/repos/github/sparkmicro/Ki-nTree/badge.svg?branch=main&service=github)](https://coveralls.io/github/sparkmicro/Ki-nTree?branch=main)

## New version (1.0) is coming soon!

To install the release candidate:
``` shell
pip install --pre -U kintree
```
## :fast_forward: [Demo Video](https://youtu.be/YeWBqOCb4pw)

<img src="https://raw.githubusercontent.com/sparkmicro/Ki-nTree/main/images/doc/kintree_v1_example.png" width="auto" height="auto">

## Demo Videos :fast_forward: [Full Demo](https://youtu.be/haSAu926BOI) :fast_forward: [KiCad Demo](https://youtu.be/NSMfCCD0uVw)

## Introduction
Ki-nTree (pronounced "Key Entry" or "Key 'n' Tree") aims to:
* automate part creation of KiCad library parts
Expand Down Expand Up @@ -44,7 +37,7 @@ Ki-nTree was developped by [@eeintech](https://github.com/eeintech) for [SPARK M

### Requirements

* Ki-nTree is currently tested for Python 3.8 to 3.10 versions.
* Ki-nTree is currently tested for Python 3.8 to 3.11 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 @@ -111,7 +104,6 @@ Configuration files are stored in the folder pointed by the `Configuration Files

<img src="https://raw.githubusercontent.com/sparkmicro/Ki-nTree/main/images/doc/kintree_v1_settings_user.png" width="600" height="auto">


<details>
<summary><b>Click here to read about configuration files</b></summary>
<p>
Expand Down
2 changes: 1 addition & 1 deletion images/python_versions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 0 additions & 18 deletions kintree/database/inventree_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,24 +362,6 @@ def create_part(category_id: int, name: str, description: str, revision: str, im
return 0


def delete_part(part_id: int) -> bool:
''' Delete InvenTree part (only used for testing) '''
global inventree_api

part = Part(inventree_api, part_id)
if part.pk:
part._data['active'] = False
# Remove image url (API rejects it as it is not a file)
try:
del part._data['image']
except:
pass
part.save()
return part.delete()
else:
return True


def create_company(company_name: str, manufacturer=False, supplier=False) -> bool:
''' Create InvenTree company '''
global inventree_api
Expand Down
7 changes: 6 additions & 1 deletion kintree/database/inventree_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,9 +545,14 @@ def inventree_create(part_info: dict, kicad=False, symbol=None, footprint=None,
cprint('[TREE]\tWarning: Failed to upload part image', silent=settings.SILENT)

if kicad:
try:
symbol_name = ipn
except UnboundLocalError:
symbol_name = inventree_part.get('manufacturer_part_number')

# Create symbol & footprint parameters
if symbol:
symbol = f'{symbol.split(":")[0]}:{ipn}'
symbol = f'{symbol.split(":")[0]}:{symbol_name}'
inventree_part['parameters']['Symbol'] = symbol
if footprint:
inventree_part['parameters']['Footprint'] = footprint
Expand Down
10 changes: 8 additions & 2 deletions kintree/gui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def init_gui(page: ft.Page):
# Theme
update_theme(page)

# Creating a progress bar that will be used to show the user that the app is busy doing something.
# Creating a progress bar that will be used
# to show the user that the app is busy doing something
page.splash = ft.ProgressBar(visible=False)

# Init dialogs
Expand Down Expand Up @@ -94,7 +95,12 @@ def view_pop(e):
# Route and render
page.go(top_view.route)
if 'main' in top_view.route:
handle_transition(page, transition=False, update_page=True, timeout=0.3)
handle_transition(
page,
transition=False,
update_page=True,
timeout=0.3,
)
if 'part' in top_view.route:
part_view.partial_update()
elif 'inventree' in top_view.route:
Expand Down
File renamed without changes
3 changes: 1 addition & 2 deletions kintree/gui/views/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@

# Main AppBar
main_appbar = ft.AppBar(
# leading=ft.Icon(ft.icons.DOUBLE_ARROW),
leading=ft.Container(
content=ft.Image(
src=os.path.join(settings.PROJECT_DIR, 'logo.png'),
src=os.path.join(settings.PROJECT_DIR, 'gui', 'logo.png'),
fit=ft.ImageFit.CONTAIN,
),
padding=ft.padding.only(left=10),
Expand Down
Empty file removed kintree/kicad/__init__.py
Empty file.
5 changes: 0 additions & 5 deletions kintree/kicad/kicad_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,3 @@ def inventree_to_kicad(part_data: dict, library_path: str, template_path=None, s
template_path=template_path,
show_progress=show_progress
)

# NOT YET SUPPORTED - REMOVE?
# def delete_part(part_number: str, library_path: str) -> bool:
# ''' Delete KiCad symbol from library '''
# pass
5 changes: 0 additions & 5 deletions kintree/kicad/kicad_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,3 @@ def add_symbol_to_library_from_inventree(self, symbol_data, template_path=None,
pass

return part_in_lib, new_part

# NOT YET SUPPORTED - REMOVE?
# def delete_symbol_from_lib(self, part_number):
# ''' Remove symbol from KiCad library '''
# pass
Loading

0 comments on commit 74c19e6

Please sign in to comment.