-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7b4ef8a
Showing
11 changed files
with
4,930 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Build and publish Python 🐍 distributions 📦 to PyPI | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
pypi-publish: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/kicadcliwrapper | ||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install build --user | ||
- name: Build a binary wheel and a source tarball | ||
run: | | ||
python -m build --sdist --wheel --outdir dist/ . | ||
- name: Publish distribution 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
env/ | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*,cover | ||
.hypothesis/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# dotenv | ||
.env | ||
|
||
# virtualenv | ||
.venv/ | ||
venv/ | ||
ENV/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# IDE stuff | ||
.vscode | ||
|
||
_local | ||
.local |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
repos: | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
# Ruff version. | ||
rev: v0.4.4 | ||
hooks: | ||
- id: ruff | ||
- id: ruff-format | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 faebryk | ||
|
||
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. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# KiCAD CLI python bindings | ||
|
||
Strongly typed, auto-generated python bindings for KiCAD's command line interface. | ||
|
||
|
||
## Usage | ||
|
||
### Setup | ||
```bash | ||
pip install kicadcliwrapper | ||
``` | ||
|
||
### Examples | ||
```python | ||
from kicadcliwrapper.generated.kicad_cli import kicad_cli | ||
|
||
# Get version | ||
kicad_cli( | ||
kicad_cli.version(), | ||
).exec() | ||
|
||
|
||
# Export pdf for pcb | ||
kicad_cli( | ||
kicad_cli.pcb( | ||
kicad_cli.pcb.export( | ||
kicad_cli.pcb.export.pdf( | ||
input_file="input.kicad_pcb" | ||
) | ||
) | ||
), | ||
).exec() | ||
``` | ||
|
||
|
||
## Development | ||
|
||
```bash | ||
git clone https://github.com/faebryk/kicadcliwrapper.git | ||
poetry install | ||
|
||
# Re-generate bindings (make sure kicad-cli is installed) | ||
python src/kicadcliwrapper/main.py | ||
``` |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
[build-system] | ||
requires = ["poetry-core>=1.0.0"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[tool.poetry.urls] | ||
"Bug Tracker" = "https://github.com/faebryk/kicadcliwrapper/issues " | ||
|
||
|
||
[tool.poetry] | ||
name = "kicadcliwrapper" | ||
version = "1.0.0" | ||
authors = ["ioannis_iteng <[email protected]>"] | ||
readme = ["README.md", "LICENSE"] | ||
license = "MIT" | ||
description = "Kicad-CLI python bindings" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: MIT License", | ||
"Operating System :: OS Independent", | ||
] | ||
repository = "https://github.com/faebryk/kicadcliwrapper" | ||
homepage = "https://github.com/faebryk/kicadcliwrapper" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.12" | ||
black = "^24.4.2" | ||
typing-extensions = "^4.6.3" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
typer = { version = "^0.9.0", extras = ["all"] } | ||
pre-commit = "^2.20.0" | ||
pytest = "^7.1.3" | ||
isort = "^5.6.4" | ||
ruff = "^0.4.4" | ||
|
||
[tool.pytest.ini_options] | ||
addopts = ["--import-mode=importlib"] | ||
|
||
[tool.ruff] | ||
line-length = 88 # Same as Black. | ||
target-version = "py312" | ||
exclude = ["src/kicadcliwrapper/generated"] | ||
|
||
[tool.ruff.format] | ||
|
||
[tool.ruff.lint] | ||
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default. | ||
select = [ | ||
# Pycodestyle | ||
"E", | ||
"W", | ||
# Pyflakes | ||
"F", | ||
# Isort | ||
"I001", | ||
] | ||
ignore = [ | ||
# Line too long | ||
#"E501", | ||
] | ||
|
||
# Allow autofix for all enabled rules (when `--fix`) is provided. | ||
fixable = [ | ||
"A", | ||
"B", | ||
"C", | ||
"D", | ||
"E", | ||
"F", | ||
"G", | ||
"I", | ||
"N", | ||
"Q", | ||
"S", | ||
"T", | ||
"W", | ||
"ANN", | ||
"ARG", | ||
"BLE", | ||
"COM", | ||
"DJ", | ||
"DTZ", | ||
"EM", | ||
"ERA", | ||
"EXE", | ||
"FBT", | ||
"ICN", | ||
"INP", | ||
"ISC", | ||
"NPY", | ||
"PD", | ||
"PGH", | ||
"PIE", | ||
"PL", | ||
"PT", | ||
"PTH", | ||
"PYI", | ||
"RET", | ||
"RSE", | ||
"RUF", | ||
"SIM", | ||
"SLF", | ||
"TCH", | ||
"TID", | ||
"TRY", | ||
"UP", | ||
"YTT", | ||
] | ||
unfixable = [] | ||
|
||
# Exclude a variety of commonly ignored directories. | ||
exclude = [ | ||
".bzr", | ||
".direnv", | ||
".eggs", | ||
".git", | ||
".git-rewrite", | ||
".hg", | ||
".mypy_cache", | ||
".nox", | ||
".pants.d", | ||
".pytype", | ||
".ruff_cache", | ||
".svn", | ||
".tox", | ||
".venv", | ||
"__pypackages__", | ||
"_build", | ||
"buck-out", | ||
"build", | ||
"dist", | ||
"node_modules", | ||
"venv", | ||
] | ||
per-file-ignores = {} | ||
|
||
# Allow unused variables when underscore-prefixed. | ||
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" | ||
|
||
|
||
[tool.ruff.lint.mccabe] | ||
# Unlike Flake8, default to a complexity level of 10. | ||
max-complexity = 10 |
Oops, something went wrong.