Skip to main content

JLC2KiCadLib

PyPI version Python versions Downloads Code style: ruff Code style: ruff License: MIT

JLC2KiCadLib is a python script that generate a component library (symbol, footprint and 3D model) for KiCad from the JLCPCB/easyEDA library. This script requires Python 3.8 or higher.

Example

easyEDA origin KiCad result
JLCSymbol KiCadSymbol
JLCFootprint KiCadFootprint
JLC3Dmodel KiCad3Dmodel

Installation

Install using pip:

pip install JLC2KiCadLib

Install from source:

git clone https://github.com/TousstNicolas/JLC2KiCad_lib.git
cd JLC2KiCad_lib 
pip install . 

Usage

usage: JLC2KiCadLib [-h] [-dir OUTPUT_DIR] [--no_footprint] [--no_symbol] [-symbol_lib SYMBOL_LIB] [-footprint_lib FOOTPRINT_LIB]
                    [-models [{STEP,WRL} ...]] [--skip_existing] [-model_base_variable MODEL_BASE_VARIABLE]
                    [-logging_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}] [--log_file] [--version]
                    JLCPCB_part_# [JLCPCB_part_# ...]

take a JLCPCB part # and create the according component's kicad's library

positional arguments:
  JLCPCB_part_#         list of JLCPCB part # from the components you want to create

options:
  -h, --help            show this help message and exit
  -dir OUTPUT_DIR       base directory for output library files
  --no_footprint        use --no_footprint if you do not want to create the footprint
  --no_symbol           use --no_symbol if you do not want to create the symbol
  -symbol_lib SYMBOL_LIB
                        set symbol library name, default is "default_lib"
  -symbol_lib_dir SYMBOL_LIB_DIR
                        Set symbol library path, default is "symbol" (relative to OUTPUT_DIR)
  -footprint_lib FOOTPRINT_LIB
                        set footprint library name, default is "footprint"
  -models [{STEP,WRL} ...]
                        Select the 3D model you want to use. Default is STEP. 
                        If both are selected, only the STEP model will be added to the footprint (the WRL model will still be generated alongside the STEP model). 
                        If you do not want any model to be generated, use the --models without arguments
  -model_dir MODEL_DIR  Set directory for storing 3d models, default is "packages3d" (relative to FOOTPRINT_LIB)
  --skip_existing       use --skip_existing if you want do not want to replace already existing footprints and symbols
  -model_base_variable MODEL_BASE_VARIABLE
                        use -model_base_variable if you want to specify the base path of the 3D model using a path variable
  -logging_level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                        set logging level. If DEBUG is used, the debug logs are only written in the log file if the option --log_file is set
  --log_file            use --log_file if you want logs to be written in a file
  --version             Print versin number and exit

exemple use : 
        JLC2KiCadLib C1337258 C24112 -dir My_lib -symbol_lib My_Symbol_lib --no_footprint

The only required arguments are the JLCPCP_part number (e.g. Cxxxxx)

Example usage :

JLC2KiCadLib C1337258 C24112 -dir My_lib                       \
                             -model_dir My_model_dir           \
                             -footprint_lib My_footprint_lib   \
                             -symbol_lib_dir My_symbol_lib_dir \
                             -symbol_lib My_symbol_lib

This example will create the symbol, footprint and 3D model for the two components specified and will output the symbol in the ./My_lib/symbol/My_symbol_lib.lib file, the footprint and 3D model will be created in the ./My_lib/Footprint. This will result in the following tree to be created :

My_lib
├── My_footprint_lib
│   ├── My_model_dir
│   │   ├── QFN-24_L4.0-W4.0-P0.50-BL-EP2.7.step
│   │   └── VQFN-48_L7.0-W7.0-P0.50-BL-EP5.5.step
│   ├── QFN-24_L4.0-W4.0-P0.50-BL-EP2.7.kicad_mod
│   └── VQFN-48_L7.0-W7.0-P0.50-BL-EP5.5.kicad_mod
└── My_symbol_lib_dir
    └── My_symbol_lib.kicad_sym

Most of those arguments are optional. The only required argument is the JLCPCB part #.

The JLCPCB part # is found in the part info section of every component in the JLCPCB part library.

By default, the library folder will be created in the execution directory. You can specify an absolute path with the -dir option.

Dependencies

JLC2KiCadLib relies on the KicadModTree framework to generate the footprints.

Testing

The project has a pytest-based test suite in test/:

  • Unit tests (e.g. test/test_courtyard.py) run offline and exercise individual handlers/helpers with synthetic data.
  • Integration tests (test/test_components.py) generate real components from JLCPCB part numbers (defined in test/component_cases.py) and validate them against KiCad's KLC rules, using the kicad-library-utils git submodule.

To run the tests:

git submodule update --init
uv sync --group test
uv run pytest                       # unit tests only
uv run pytest -m integration        # integration tests (requires network access)

Notes

  • Even so I tested the script on a lot of components, be careful and always check the output footprint and symbol.
  • EasyEDA does not provide courtyard data, so footprints now get an auto-generated approximate courtyard (F.CrtYd, 0.25mm clearance around the copper/fab/paste/mask/edge-cuts bounding box), mirroring the approach used by KiCad's own EasyEDA importer.
  • I consider this project completed. I will continue to maintain it if a bug report is filed, but I will not develop new functionality in the near future. If you feel that an important feature is missing, please open an issue to discuss it, then you can fork this project with a new branch before submitting a PR.

License

Copyright © 2021 TousstNicolas

The code is released under the MIT license

Metadata

Release files for JLC2KiCadLib 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for JLC2KiCadLib 1.3.1
File Size Uploaded
jlc2kicadlib-1.3.1.tar.gz 1.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for JLC2KiCadLib 1.3.1
File Interpreter ABI Platform
jlc2kicadlib-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / jlc2kicadlib-1.3.1.tar.gz

Download URL jlc2kicadlib-1.3.1.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
ce1ac72dbb33eb4356d5b5112146cfd7efb8b55f42edaf1d161d4a22270814a2
BLAKE2b-256 checksum
How to use checksums
d8ecc730b7362e3c8557cb487ef99284067432243207e9d450867dd7f4297605
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / jlc2kicadlib-1.3.1-py3-none-any.whl

Download URL jlc2kicadlib-1.3.1-py3-none-any.whl
Size 23.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe926bdc11f545fecfe81929217f1eec676351bd6122dc3e5a1ea6697bd7d3a7
BLAKE2b-256 checksum
How to use checksums
ec973291327a6475cd5c733b483e6fe1ce6e821029157d25768efff7c7c63162
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

1.3.2

2 release files

This release

1.3.1 This release

2 release files

1.3.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.37

1 release file

1.0.36

3 release files

1.0.32

2 release files

1.0.31

2 release files

1.0.30

2 release files

1.0.29

2 release files

1.0.28

2 release files

1.0.27

2 release files

1.0.25

2 release files

1.0.23

2 release files

1.0.21

2 release files

1.0.20

2 release files

1.0.19

2 release files

1.0.18

2 release files

1.0.17

2 release files

1.0.16

2 release files

1.0.15

2 release files

1.0.14

2 release files

1.0.12

2 release files

1.0.11

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

3 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page