jitx 4.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. jitx-4.0.0/.github/workflows/build.yaml +44 -0
  2. jitx-4.0.0/.github/workflows/release.yaml +49 -0
  3. jitx-4.0.0/.gitignore +5 -0
  4. jitx-4.0.0/PKG-INFO +31 -0
  5. jitx-4.0.0/build.err +0 -0
  6. jitx-4.0.0/build.log +1 -0
  7. jitx-4.0.0/docs/Makefile +55 -0
  8. jitx-4.0.0/docs/make.bat +35 -0
  9. jitx-4.0.0/docs/requirements.txt +3 -0
  10. jitx-4.0.0/docs/source/conf.py +61 -0
  11. jitx-4.0.0/docs/source/index.rst +14 -0
  12. jitx-4.0.0/hooks/pre-commit +20 -0
  13. jitx-4.0.0/lint.log +4 -0
  14. jitx-4.0.0/pyproject.toml +121 -0
  15. jitx-4.0.0/pyright.json +11 -0
  16. jitx-4.0.0/src/jitx/__init__.py +212 -0
  17. jitx-4.0.0/src/jitx/__main__.py +165 -0
  18. jitx-4.0.0/src/jitx/_instantiation.py +105 -0
  19. jitx-4.0.0/src/jitx/_structural.py +913 -0
  20. jitx-4.0.0/src/jitx/_translate/board.py +250 -0
  21. jitx-4.0.0/src/jitx/_translate/bundle.py +39 -0
  22. jitx-4.0.0/src/jitx/_translate/circuit.py +825 -0
  23. jitx-4.0.0/src/jitx/_translate/component.py +330 -0
  24. jitx-4.0.0/src/jitx/_translate/copper.py +20 -0
  25. jitx-4.0.0/src/jitx/_translate/design.py +151 -0
  26. jitx-4.0.0/src/jitx/_translate/dispatch.py +80 -0
  27. jitx-4.0.0/src/jitx/_translate/enums.py +89 -0
  28. jitx-4.0.0/src/jitx/_translate/feature.py +127 -0
  29. jitx-4.0.0/src/jitx/_translate/fileinfo.py +33 -0
  30. jitx-4.0.0/src/jitx/_translate/idmap.py +211 -0
  31. jitx-4.0.0/src/jitx/_translate/landpattern.py +230 -0
  32. jitx-4.0.0/src/jitx/_translate/layerindex.py +11 -0
  33. jitx-4.0.0/src/jitx/_translate/mapping.py +13 -0
  34. jitx-4.0.0/src/jitx/_translate/routing.py +297 -0
  35. jitx-4.0.0/src/jitx/_translate/rules.py +153 -0
  36. jitx-4.0.0/src/jitx/_translate/schematic.py +102 -0
  37. jitx-4.0.0/src/jitx/_translate/shape.py +154 -0
  38. jitx-4.0.0/src/jitx/_translate/signal_models.py +16 -0
  39. jitx-4.0.0/src/jitx/_translate/symbol.py +204 -0
  40. jitx-4.0.0/src/jitx/_translate/via.py +236 -0
  41. jitx-4.0.0/src/jitx/_websocket.py +207 -0
  42. jitx-4.0.0/src/jitx/anchor.py +128 -0
  43. jitx-4.0.0/src/jitx/board.py +26 -0
  44. jitx-4.0.0/src/jitx/circuit.py +444 -0
  45. jitx-4.0.0/src/jitx/common.py +116 -0
  46. jitx-4.0.0/src/jitx/compat/__init__.py +0 -0
  47. jitx-4.0.0/src/jitx/compat/altium.py +41 -0
  48. jitx-4.0.0/src/jitx/component.py +175 -0
  49. jitx-4.0.0/src/jitx/constraints.py +828 -0
  50. jitx-4.0.0/src/jitx/container.py +168 -0
  51. jitx-4.0.0/src/jitx/context.py +107 -0
  52. jitx-4.0.0/src/jitx/copper.py +83 -0
  53. jitx-4.0.0/src/jitx/decorators.py +21 -0
  54. jitx-4.0.0/src/jitx/design.py +135 -0
  55. jitx-4.0.0/src/jitx/error.py +69 -0
  56. jitx-4.0.0/src/jitx/events.py +100 -0
  57. jitx-4.0.0/src/jitx/feature.py +156 -0
  58. jitx-4.0.0/src/jitx/fileinfo.py +23 -0
  59. jitx-4.0.0/src/jitx/inspect.py +277 -0
  60. jitx-4.0.0/src/jitx/interval.py +82 -0
  61. jitx-4.0.0/src/jitx/landpattern.py +214 -0
  62. jitx-4.0.0/src/jitx/layerindex.py +195 -0
  63. jitx-4.0.0/src/jitx/logo.py +125 -0
  64. jitx-4.0.0/src/jitx/memo.py +31 -0
  65. jitx-4.0.0/src/jitx/model3d.py +99 -0
  66. jitx-4.0.0/src/jitx/net.py +852 -0
  67. jitx-4.0.0/src/jitx/paper.py +24 -0
  68. jitx-4.0.0/src/jitx/placement.py +145 -0
  69. jitx-4.0.0/src/jitx/property.py +65 -0
  70. jitx-4.0.0/src/jitx/refpath.py +143 -0
  71. jitx-4.0.0/src/jitx/run/__init__.py +469 -0
  72. jitx-4.0.0/src/jitx/run/dependencies.py +267 -0
  73. jitx-4.0.0/src/jitx/run/pyproject.py +75 -0
  74. jitx-4.0.0/src/jitx/sample/__init__.py +193 -0
  75. jitx-4.0.0/src/jitx/schematic.py +159 -0
  76. jitx-4.0.0/src/jitx/shapes/__init__.py +171 -0
  77. jitx-4.0.0/src/jitx/shapes/composites.py +649 -0
  78. jitx-4.0.0/src/jitx/shapes/primitive.py +374 -0
  79. jitx-4.0.0/src/jitx/shapes/shapely.py +678 -0
  80. jitx-4.0.0/src/jitx/si.py +1024 -0
  81. jitx-4.0.0/src/jitx/stackup.py +167 -0
  82. jitx-4.0.0/src/jitx/substrate.py +207 -0
  83. jitx-4.0.0/src/jitx/symbol.py +212 -0
  84. jitx-4.0.0/src/jitx/test.py +46 -0
  85. jitx-4.0.0/src/jitx/toleranced.py +323 -0
  86. jitx-4.0.0/src/jitx/transform.py +510 -0
  87. jitx-4.0.0/src/jitx/units.py +63 -0
  88. jitx-4.0.0/src/jitx/via.py +115 -0
  89. jitx-4.0.0/src/jitx/vscode/__init__.py +8 -0
  90. jitx-4.0.0/src/jitx/vscode/config.py +166 -0
  91. jitx-4.0.0/test.err +4 -0
  92. jitx-4.0.0/test.log +53 -0
  93. jitx-4.0.0/tests/__init__.py +0 -0
  94. jitx-4.0.0/tests/test_anchor.py +42 -0
  95. jitx-4.0.0/tests/test_arc.py +9 -0
  96. jitx-4.0.0/tests/test_composite_shapes.py +145 -0
  97. jitx-4.0.0/tests/test_constraint.py +108 -0
  98. jitx-4.0.0/tests/test_instantiation.py +133 -0
  99. jitx-4.0.0/tests/test_nets.py +137 -0
  100. jitx-4.0.0/tests/test_pin_headers.py +185 -0
  101. jitx-4.0.0/tests/test_resistors.py +273 -0
  102. jitx-4.0.0/tests/test_smoke.py +1025 -0
  103. jitx-4.0.0/tests/test_stackup.py +24 -0
  104. jitx-4.0.0/tests/test_tic_tac_toe.py +442 -0
  105. jitx-4.0.0/tests/test_toleranced.py +65 -0
  106. jitx-4.0.0/tests/test_transform.py +50 -0
  107. jitx-4.0.0/tests/test_translation.py +37 -0
  108. jitx-4.0.0/typecheck.err +0 -0
  109. jitx-4.0.0/typecheck.log +1 -0
@@ -0,0 +1,44 @@
1
+
2
+ name: Build
3
+
4
+ on:
5
+ push:
6
+ tags:
7
+ - "v*.*.*"
8
+ branches:
9
+ - main
10
+ - dev
11
+ pull_request:
12
+ branches:
13
+ - main
14
+ - dev
15
+ workflow_dispatch:
16
+
17
+ jobs:
18
+ build:
19
+ name: Build
20
+ runs-on: ubuntu-24.04
21
+
22
+ permissions:
23
+ contents: write # to be able to check out repos and generate app tokens
24
+ actions: write # to be able to trigger other workflows
25
+
26
+ strategy:
27
+ matrix:
28
+ python-version: ["3.12", "3.13", "3.14"]
29
+ fail-fast: false
30
+
31
+ steps:
32
+
33
+ - name: Build, Test, and Deploy
34
+ uses: jitx-inc/pybuild-action@v1
35
+ with:
36
+ python-version: "${{ matrix.python-version }}"
37
+ run-publish: true
38
+ hatch-index-user: ${{ vars.HATCH_INDEX_USER }}
39
+ hatch-index-auth: ${{ secrets.HATCH_INDEX_AUTH }}
40
+ notify-slack: true
41
+ slack-token: ${{ secrets.SLACK_TOKEN }}
42
+ github-user: ${{ github.actor }}
43
+ githubapp-id: ${{ vars.GITHUBAPP_ID }}
44
+ githubapp-private-key: ${{ secrets.GITHUBAPP_PRIVATE_KEY }}
@@ -0,0 +1,49 @@
1
+
2
+ name: Publish to PyPI
3
+
4
+ on:
5
+ workflow_dispatch:
6
+
7
+ jobs:
8
+ publish:
9
+ name: Publish ${{ github.ref_name }} to PyPI
10
+ runs-on: ubuntu-24.04
11
+
12
+ environment:
13
+ name: pypi
14
+ url: https://pypi.org/p/jitxcore
15
+
16
+ permissions:
17
+ contents: read # for reading content from a repo
18
+ id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
19
+
20
+ steps:
21
+
22
+ - name: Ensure valid tag
23
+ if: (! github.ref_type == 'tag') || (! startsWith(github.ref_name, 'v')) || contains(github.ref_name, '.dev')
24
+ shell: bash
25
+ run: |
26
+ echo "Invalid tag for publishing: ${{ github.ref_name }}"
27
+ exit -1
28
+
29
+ - name: Fetch Release
30
+ uses: robinraju/release-downloader@v1
31
+ with:
32
+ repository: ${{ github.repository }}
33
+ tag: ${{ github.ref_name }}
34
+ fileName: '*'
35
+ out-file-path: dist/
36
+ extract: false
37
+
38
+ - name: List artifact files
39
+ shell: bash
40
+ run: |
41
+ ls -la dist/ || true
42
+ rm -f dist/requirements.txt
43
+
44
+ - name: Publish to PyPI
45
+ uses: pypa/gh-action-pypi-publish@release/v1
46
+ with:
47
+ repository-url: "https://upload.pypi.org/legacy/"
48
+ packages-dir: dist/
49
+
jitx-4.0.0/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ .*
2
+ !.github
3
+ __pycache__
4
+ dist
5
+ jitx_*
jitx-4.0.0/PKG-INFO ADDED
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.4
2
+ Name: jitx
3
+ Version: 4.0.0
4
+ Summary: Design complex circuit boards by writing simple code and streamline your existing design process
5
+ Project-URL: Homepage, https://jitx.com
6
+ Project-URL: Documentation, https://docs.jitx.com
7
+ Author: JITX
8
+ Maintainer: JITX
9
+ Keywords: circuit board,jitx,pcb
10
+ Classifier: Development Status :: 1 - Planning
11
+ Classifier: Framework :: Hatch
12
+ Classifier: Framework :: Pytest
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: Other/Proprietary License
15
+ Classifier: Operating System :: MacOS :: MacOS X
16
+ Classifier: Operating System :: Microsoft :: Windows :: Windows 10
17
+ Classifier: Operating System :: Microsoft :: Windows :: Windows 11
18
+ Classifier: Operating System :: POSIX :: Linux
19
+ Classifier: Programming Language :: Python
20
+ Classifier: Programming Language :: Python :: 3 :: Only
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.12
27
+ Requires-Dist: jitxcore==4.0.0
28
+ Requires-Dist: packaging<26.0,>=25.0
29
+ Requires-Dist: pint==0.24.4
30
+ Requires-Dist: shapely<3.0,>=2.1.0
31
+ Requires-Dist: websockets==15.0.1
jitx-4.0.0/build.err ADDED
File without changes
jitx-4.0.0/build.log ADDED
@@ -0,0 +1 @@
1
+ ──────────────────────────────────── sdist ─────────────────────────────────────
@@ -0,0 +1,55 @@
1
+ # JITX makefile for jitx Sphinx documentation
2
+ #
3
+
4
+ SHELL := /bin/bash
5
+
6
+ # You can set these variables from the command line, and also
7
+ # from the environment for the first three.
8
+ PIPOPTS ?= --extra-index-url "https://pypi.jitx.com/jitx/main/+simple"
9
+ SPHINXOPTS ?= --jobs 1 --write-all --fresh-env --warning-file build.out
10
+ SPHINXAPIDOC ?= sphinx-apidoc
11
+ SPHINXBUILD ?= sphinx-build
12
+ PROJNAME := api
13
+ SOURCEDIR := source
14
+ BUILDDIR := build
15
+ PYSRCDIR := ../src/jitx
16
+ VER := $(shell hatch version)
17
+ ARCHIVENAME := docs-jitx-$(PROJNAME)-$(VER).tar.bz2
18
+
19
+ .PHONY: all
20
+ all: html archive
21
+
22
+ # create python venv
23
+ .venv: requirements.txt
24
+ python -m venv .venv \
25
+ && source .venv/bin/activate \
26
+ && pip install $(PIPOPTS) -r requirements.txt \
27
+ && touch .venv
28
+
29
+ # generate docs from python source
30
+ .PHONY: apidoc
31
+ apidoc: .venv
32
+ source .venv/bin/activate \
33
+ && $(SPHINXAPIDOC) \
34
+ -o "source/$(PROJNAME)" \
35
+ "../src/$(PYSRCDIR)" \
36
+ --maxdepth 4 \
37
+ --separate \
38
+ --implicit-namespaces \
39
+ --doc-project "JITX $(PROJNAME) Documentation"
40
+
41
+ # convert to html
42
+ .PHONY: html
43
+ html: .venv apidoc
44
+ source .venv/bin/activate \
45
+ && $(SPHINXBUILD) --builder html $(SPHINXOPTS) "$(SOURCEDIR)" "$(BUILDDIR)"
46
+
47
+ # create archive
48
+ .PHONY: archive
49
+ archive:
50
+ tar jcf "$(ARCHIVENAME)" "$(SOURCEDIR)" "$(BUILDDIR)"
51
+
52
+ # clean up
53
+ .PHONY: clean
54
+ clean:
55
+ rm -rf .venv "source/api" "$(BUILDDIR)" build.out "$(ARCHIVENAME)"
@@ -0,0 +1,35 @@
1
+ @ECHO OFF
2
+
3
+ pushd %~dp0
4
+
5
+ REM Command file for Sphinx documentation
6
+
7
+ if "%SPHINXBUILD%" == "" (
8
+ set SPHINXBUILD=sphinx-build
9
+ )
10
+ set SOURCEDIR=source
11
+ set BUILDDIR=build
12
+
13
+ %SPHINXBUILD% >NUL 2>NUL
14
+ if errorlevel 9009 (
15
+ echo.
16
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17
+ echo.installed, then set the SPHINXBUILD environment variable to point
18
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
19
+ echo.may add the Sphinx directory to PATH.
20
+ echo.
21
+ echo.If you don't have Sphinx installed, grab it from
22
+ echo.https://www.sphinx-doc.org/
23
+ exit /b 1
24
+ )
25
+
26
+ if "%1" == "" goto help
27
+
28
+ %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29
+ goto end
30
+
31
+ :help
32
+ %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33
+
34
+ :end
35
+ popd
@@ -0,0 +1,3 @@
1
+ sphinx
2
+ sphinx_autodoc_typehints
3
+ pint
@@ -0,0 +1,61 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # For the full list of built-in configuration values, see the documentation:
4
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
5
+
6
+ # Add jitx source to import path
7
+ import os
8
+ import sys
9
+ from pathlib import Path
10
+ from sphinx.ext import autodoc
11
+
12
+ os.environ["JITX_PASSIVE_INSTANTIATION"] = "1"
13
+ sys.path.insert(0, str(Path("..", "..", "src").resolve()))
14
+
15
+ # -- Project information -----------------------------------------------------
16
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
17
+
18
+ project = "jitx"
19
+ copyright = "2025, JITX Inc" # noqa: A001
20
+ author = "JITX Inc"
21
+ version = "0.1"
22
+ release = "0.1.0dev1"
23
+
24
+ # -- General configuration ---------------------------------------------------
25
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
26
+
27
+ needs_sphinx = "8.1"
28
+ extensions = [
29
+ "sphinx.ext.autodoc",
30
+ "sphinx.ext.coverage",
31
+ "sphinx.ext.doctest",
32
+ "sphinx.ext.githubpages",
33
+ "sphinx.ext.napoleon",
34
+ "sphinx_autodoc_typehints",
35
+ ]
36
+ templates_path = ["_templates"]
37
+ exclude_patterns = []
38
+
39
+ # -- Options for HTML output -------------------------------------------------
40
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
41
+
42
+ html_theme = "alabaster"
43
+ html_static_path = ["_static"]
44
+
45
+ # -- Don't show "Bases: object" in api docs ----------------------------------
46
+ # https://stackoverflow.com/questions/46279030/how-can-i-prevent-sphinx-from-listing-object-as-a-base-class
47
+
48
+
49
+ class MockedClassDocumenter(autodoc.ClassDocumenter):
50
+ def add_line(self, line: str, source: str, *lineno: int) -> None:
51
+ if line == " Bases: :py:class:`object`":
52
+ return
53
+ super().add_line(line, source, *lineno)
54
+
55
+
56
+ autodoc.ClassDocumenter = MockedClassDocumenter
57
+
58
+ autodoc_mock_imports = ["websockets", "shapely"]
59
+ autodoc_default_options = {
60
+ "member-order": "bysource", # 'alphabetical', 'groupwise', or 'bysource'
61
+ }
@@ -0,0 +1,14 @@
1
+ .. py-jitx documentation master file, created by
2
+ sphinx-quickstart on Thu Mar 20 18:52:41 2025.
3
+ You can adapt this file completely to your liking, but it should at least
4
+ contain the root `toctree` directive.
5
+
6
+ py-jitx documentation
7
+ =====================
8
+
9
+ .. toctree::
10
+ :maxdepth: 3
11
+ :caption: Contents:
12
+
13
+ api/modules
14
+
@@ -0,0 +1,20 @@
1
+ #!/bin/bash -e
2
+
3
+ # Redirect output to stderr.
4
+ exec 1>&2
5
+
6
+ root=$(git rev-parse --show-toplevel)
7
+ pyfiles=$(git diff --cached --name-only --diff-filter=AM | awk '/\.py$/')
8
+
9
+ if [ -n "$pyfiles" ]; then
10
+ ruff check --quiet $pyfiles
11
+ ruff format --silent --diff $pyfiles
12
+ fi
13
+
14
+ (
15
+ cd $root
16
+ python -m unittest discover
17
+ )
18
+
19
+ # If there are whitespace errors, print the offending file names and fail.
20
+ exec git diff-index --check --cached HEAD --
jitx-4.0.0/lint.log ADDED
@@ -0,0 +1,4 @@
1
+ cmd [1] | ruff check .
2
+ All checks passed!
3
+ cmd [2] | ruff format --check --diff .
4
+ 91 files already formatted
@@ -0,0 +1,121 @@
1
+ [build-system]
2
+ requires = [
3
+ "hatchling>=1.27.0,<2.0",
4
+ "hatch-vcs>=0.4.0,<0.5.0",
5
+ "ruff==0.11.2",
6
+ "pyright>=1.1.398,<1.2.0",
7
+ ]
8
+ build-backend = "hatchling.build"
9
+
10
+ [tool.hatch.envs.default]
11
+ path = ".hatch/envs/default"
12
+
13
+ [project]
14
+ name = "jitx"
15
+ dynamic = ["version"]
16
+ dependencies = [
17
+ "jitxcore==4.0.0",
18
+ "websockets==15.0.1",
19
+ "shapely>=2.1.0,<3.0",
20
+ "Pint==0.24.4",
21
+ "packaging>=25.0,<26.0",
22
+ ]
23
+ requires-python = ">=3.12"
24
+ authors = [
25
+ {name = "JITX"}
26
+ ]
27
+ maintainers = [
28
+ {name = "JITX"}
29
+ ]
30
+ description = "Design complex circuit boards by writing simple code and streamline your existing design process"
31
+ keywords = ["jitx", "pcb", "circuit board"]
32
+ classifiers = [
33
+ "Development Status :: 1 - Planning",
34
+ "Framework :: Hatch",
35
+ "Framework :: Pytest",
36
+ "Intended Audience :: Developers",
37
+ "License :: Other/Proprietary License",
38
+ "Operating System :: MacOS :: MacOS X",
39
+ "Operating System :: Microsoft :: Windows :: Windows 10",
40
+ "Operating System :: Microsoft :: Windows :: Windows 11",
41
+ "Operating System :: POSIX :: Linux",
42
+ "Programming Language :: Python :: 3 :: Only",
43
+ "Programming Language :: Python :: 3.12",
44
+ "Programming Language :: Python :: 3.13",
45
+ "Programming Language :: Python",
46
+ "Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)",
47
+ "Topic :: Software Development :: Libraries :: Python Modules",
48
+ "Typing :: Typed",
49
+ ]
50
+
51
+ [project.urls]
52
+ Homepage = "https://jitx.com"
53
+ Documentation = "https://docs.jitx.com"
54
+
55
+
56
+ [tool]
57
+
58
+ [tool.hatch.envs.default.env-vars]
59
+ PIP_INDEX_URL = "https://pypi.jitx.com/jitx/main/+simple"
60
+
61
+ [tool.hatch.envs.hatch-test.env-vars]
62
+ PIP_INDEX_URL = "https://pypi.jitx.com/jitx/main/+simple"
63
+
64
+ # tests: run "hatch test --cover"
65
+ [tool.hatch.envs.test]
66
+ dependencies = [
67
+ "coverage[toml]",
68
+ "pytest",
69
+ "pytest-cov",
70
+ ]
71
+
72
+ [tool.hatch.envs.hatch-test]
73
+ randomize = true
74
+ parallel = false
75
+ installer = "pip"
76
+ extra-args = ["-vv"]
77
+
78
+ [[tool.hatch.envs.test.matrix]]
79
+ python = ["3.12", "3.13", "3.14"]
80
+
81
+ [tool.hatch.metadata]
82
+ allow-direct-references = true
83
+
84
+ [tool.hatch.version]
85
+ source = "vcs"
86
+ fallback-version = "0.0.0+undefined"
87
+
88
+ # formatting: run "hatch fmt --check"
89
+ [tool.hatch.envs.hatch-static-analysis]
90
+ dependencies = ["ruff==0.11.2"]
91
+ config-path = "none" # don't use hatch defaults
92
+
93
+ [tool.ruff]
94
+ line-length = 88
95
+ indent-width = 4
96
+ target-version = "py312"
97
+
98
+ [tool.ruff.lint]
99
+ # To enable:
100
+ # UP, TC
101
+ select = ["E", "F", "W", "A", "B", "C", "UP"]
102
+ # E501 line too long - let ruff format handle that
103
+ # A002 variable shadowing built-in (id, min, max)
104
+ # A005 builtin module shadowing (false positive)
105
+ # C901 mccabe complexity check, limits to 10
106
+ ignore = ["E501", "A005", "C901", "A002"]
107
+
108
+ [tool.ruff.format]
109
+ quote-style = "double"
110
+ indent-style = "space"
111
+
112
+ # pyright: run "hatch run types:check"
113
+ [tool.hatch.envs.types]
114
+ extra-dependencies = [
115
+ "pyright>=1.1.0",
116
+ "sphinx>=8.1.0,<9.0",
117
+ ]
118
+
119
+ [tool.hatch.envs.types.scripts]
120
+ check = "pyright ."
121
+ stats = "pyright --stats ."
@@ -0,0 +1,11 @@
1
+ {
2
+ "include": [
3
+ "src"
4
+ ],
5
+
6
+ "exclude": [
7
+ "**/__pycache__"
8
+ ],
9
+
10
+ "pythonVersion": "3.12"
11
+ }
@@ -0,0 +1,212 @@
1
+ """
2
+ JITX Python API
3
+ ===============
4
+
5
+ The JITX Python API is a set of classes that can be used to build a design in
6
+ Python. The core principle of the API is that, when run, your code constructs
7
+ an object tree that is then inspected. This means that creating an object and
8
+ attaching them to other objects is what drives the construction of the design,
9
+ and not function calls. The root of the tree is an instance of a
10
+ :py:class:`~jitx.design.Design` subclass. The JITX runtime will inspect your
11
+ project looking for Design subclasses which are then instantiated on request.
12
+
13
+ The inspection mechanism will traverse lists, tuples, and dictionaries, as
14
+ well, thus objects can be added to arrays and dictionaries as needed when
15
+ building the object tree.
16
+
17
+ The API is designed to be as simple as possible, and to be as close to Python
18
+ as possible. The API is designed to be used with a Python language server, such
19
+ as PyLance/pyright, to provide autocompletion and type checking.
20
+
21
+ .. note::
22
+
23
+ There are a few mechanisms designed to make API usage cleaner by allowing
24
+ instantiated objects as class attributes, but there are caveats to be aware
25
+ of when doing more involved logic, and when in doubt, all logic can also be
26
+ placed in the initializer of the class. Runtime errors involving an
27
+ unexpected "Instantiable" object is indicative of this type of error.
28
+ """
29
+
30
+ from .anchor import Anchor as Anchor
31
+ from .board import Board as Board
32
+ from .circuit import Circuit as Circuit, CurrentCircuit
33
+ from .component import Component as Component, CurrentComponent
34
+ from .constraints import (
35
+ IsBoardEdge as IsBoardEdge,
36
+ IsCopper as IsCopper,
37
+ IsHole as IsHole,
38
+ IsNeckdown as IsNeckdown,
39
+ IsPad as IsPad,
40
+ IsPour as IsPour,
41
+ IsThroughHole as IsThroughHole,
42
+ IsTrace as IsTrace,
43
+ IsVia as IsVia,
44
+ SquareViaStitchGrid as SquareViaStitchGrid,
45
+ Tag as Tag,
46
+ Tags as Tags,
47
+ TriangularViaStitchGrid as TriangularViaStitchGrid,
48
+ ViaFencePattern as ViaFencePattern,
49
+ design_constraint as design_constraint,
50
+ )
51
+ from .container import Composite as Composite, Container as Container
52
+ from .context import ContextProperty
53
+ from .copper import Copper as Copper, Pour as Pour
54
+ from .design import Design as Design, DesignContext
55
+ from .error import UserCodeException as UserCodeException
56
+ from .feature import (
57
+ Courtyard as Courtyard,
58
+ Custom as Custom,
59
+ Cutout as Cutout,
60
+ Finish as Finish,
61
+ Glue as Glue,
62
+ KeepOut as KeepOut,
63
+ Paste as Paste,
64
+ Silkscreen as Silkscreen,
65
+ Soldermask as Soldermask,
66
+ )
67
+ from .inspect import decompose as decompose, extract as extract, visit as visit
68
+ from .landpattern import (
69
+ Landpattern as Landpattern,
70
+ Pad as Pad,
71
+ PadMapping as PadMapping,
72
+ )
73
+ from .layerindex import LayerSet as LayerSet, Side as Side
74
+ from .net import (
75
+ DiffPair as DiffPair,
76
+ Net as Net,
77
+ Port as Port,
78
+ provide as provide,
79
+ Provide as Provide,
80
+ )
81
+ from .placement import Placement as Placement, Positionable as Positionable
82
+ from .shapes.composites import capsule as capsule, rectangle as rectangle
83
+ from .shapes.primitive import (
84
+ Arc as Arc,
85
+ ArcPolygon as ArcPolygon,
86
+ ArcPolyline as ArcPolyline,
87
+ Circle as Circle,
88
+ Polygon as Polygon,
89
+ Polyline as Polyline,
90
+ )
91
+ from .substrate import Substrate as Substrate, SubstrateContext
92
+ from .symbol import Pin as Pin, Symbol as Symbol, SymbolMapping as SymbolMapping
93
+ from .toleranced import Toleranced as Toleranced
94
+ from .transform import Point as Point, Transform as Transform
95
+ from .via import Via as Via
96
+
97
+ # the pattern used above
98
+ #
99
+ # from X import Class as Class
100
+ #
101
+ # is a convention to indicate to language servers that the name should be
102
+ # reexported from the module and offered during autocompletion, as well as not
103
+ # flagged as an unused import.
104
+
105
+
106
+ class Current:
107
+ """
108
+ Context registry object, where each field is a property that will get
109
+ the currently registered context value. If no such context is currently
110
+ active, it will raise an exception. This is purely for convenience, the
111
+ contexts can be accessed directly.
112
+
113
+ The main purpose of this is to allow introspection of the environment. Note
114
+ that any accessed context value will be part of the memoization key, and
115
+ thus if the environment changes a memoized element will be reevaluated, and
116
+ thus use of current circuit or component should be used with care.
117
+
118
+ There is already an instance of this class, :py:data:`current`, which can
119
+ be used directly.
120
+ """
121
+
122
+ design = ContextProperty(DesignContext, lambda x: x.design)
123
+ "The current design being built"
124
+ substrate = ContextProperty(SubstrateContext, lambda x: x.substrate)
125
+ "The substrate of the current design"
126
+ circuit = ContextProperty(CurrentCircuit, lambda x: x.circuit)
127
+ "The current circuit being constructed"
128
+ component = ContextProperty(CurrentComponent, lambda x: x.component)
129
+ "The current component being constructed"
130
+
131
+ def __repr__(self):
132
+ return "Current"
133
+
134
+
135
+ current = Current()
136
+ """Singleton, the "current" context registry."""
137
+
138
+ # this can't be autogenerated at runtime, since the typechecker won't know what is
139
+ # actually imported if someone does from jitx import *, thus they need to be
140
+ # listed in the source file; please remember to update this if you add new
141
+ # imports that should be reexported
142
+
143
+ # grep '^\(from\| \)' __init__.py | grep -o 'as [^, ]*\(,\|$\)' | sed -e 's/^as \([^,]*\).*$/ "\1",/'
144
+ __all__ = [
145
+ "current",
146
+ # list below is generated with the grep command
147
+ "Anchor",
148
+ "Board",
149
+ "Circuit",
150
+ "Component",
151
+ "IsBoardEdge",
152
+ "IsCopper",
153
+ "IsHole",
154
+ "IsNeckdown",
155
+ "IsPad",
156
+ "IsPour",
157
+ "IsThroughHole",
158
+ "IsTrace",
159
+ "IsVia",
160
+ "SquareViaStitchGrid",
161
+ "Tag",
162
+ "Tags",
163
+ "TriangularViaStitchGrid",
164
+ "ViaFencePattern",
165
+ "design_constraint",
166
+ "Composite",
167
+ "Container",
168
+ "Copper",
169
+ "Pour",
170
+ "Design",
171
+ "UserCodeException",
172
+ "Courtyard",
173
+ "Custom",
174
+ "Cutout",
175
+ "Finish",
176
+ "Glue",
177
+ "KeepOut",
178
+ "Paste",
179
+ "Silkscreen",
180
+ "Soldermask",
181
+ "decompose",
182
+ "extract",
183
+ "visit",
184
+ "Landpattern",
185
+ "Pad",
186
+ "PadMapping",
187
+ "LayerSet",
188
+ "Side",
189
+ "DiffPair",
190
+ "Net",
191
+ "Port",
192
+ "provide",
193
+ "Provide",
194
+ "Placement",
195
+ "Positionable",
196
+ "capsule",
197
+ "rectangle",
198
+ "Arc",
199
+ "ArcPolygon",
200
+ "ArcPolyline",
201
+ "Circle",
202
+ "Polygon",
203
+ "Polyline",
204
+ "Substrate",
205
+ "Pin",
206
+ "Symbol",
207
+ "SymbolMapping",
208
+ "Toleranced",
209
+ "Point",
210
+ "Transform",
211
+ "Via",
212
+ ]