diff --git a/pkgs/development/python-modules/easyeda2ato/default.nix b/pkgs/development/python-modules/atopile-easyeda2kicad/default.nix similarity index 50% rename from pkgs/development/python-modules/easyeda2ato/default.nix rename to pkgs/development/python-modules/atopile-easyeda2kicad/default.nix index 362b07e2ce67..1b91aa1437fe 100644 --- a/pkgs/development/python-modules/easyeda2ato/default.nix +++ b/pkgs/development/python-modules/atopile-easyeda2kicad/default.nix @@ -1,25 +1,29 @@ { lib, buildPythonPackage, - fetchPypi, - setuptools, + fetchFromGitHub, + hatchling, + hatch-vcs, pydantic, requests, }: buildPythonPackage rec { - pname = "easyeda2ato"; - version = "0.2.7"; + pname = "atopile-easyeda2kicad"; + version = "0.9.5"; pyproject = true; - # repo version does not match - src = fetchPypi { - inherit pname version; - - hash = "sha256-bHhBN+h9Vx9Q4wZVKxMzkEEXzV7hKoQz8i+JpkSFsYA="; + src = fetchFromGitHub { + owner = "atopile"; + repo = "easyeda2kicad.py"; + tag = "v${version}"; + hash = "sha256-TLGLNe/Lk2WpYMzmX2iK3S27/QRqTOdHqO8XIMZSda4="; }; - build-system = [ setuptools ]; + build-system = [ + hatchling + hatch-vcs + ]; dependencies = [ pydantic @@ -32,8 +36,8 @@ buildPythonPackage rec { meta = { description = "Convert any LCSC components (including EasyEDA) to KiCad library"; - homepage = "https://github.com/uPesy/easyeda2kicad.py"; - changelog = "https://github.com/uPesy/easyeda2kicad.py/releases/tag/v${version}"; + homepage = "https://github.com/atopile/easyeda2kicad.py"; + changelog = "https://github.com/atopile/easyeda2kicad.py/releases/tag/v${version}"; license = lib.licenses.agpl3Only; maintainers = with lib.maintainers; [ sigmanificient ]; mainProgram = "easyeda2kicad"; diff --git a/pkgs/development/python-modules/atopile/default.nix b/pkgs/development/python-modules/atopile/default.nix index 8f43b9091078..87a79f26dbd4 100644 --- a/pkgs/development/python-modules/atopile/default.nix +++ b/pkgs/development/python-modules/atopile/default.nix @@ -2,6 +2,9 @@ lib, buildPythonPackage, fetchFromGitHub, + + cmake, + ninja, # build-system hatchling, scikit-build-core, @@ -9,52 +12,65 @@ nanobind, # deps antlr4-python3-runtime, - attrs, + atopile-easyeda2kicad, + black, case-converter, - cattrs, - click, - deepdiff, - easyeda2ato, - eseries, - fake-useragent, - fastapi, + cookiecutter, + dataclasses-json, + deprecated, + fastapi-github-oidc, + freetype-py, gitpython, - igraph, - jinja2, + kicad-python, + kicadcliwrapper, + matplotlib, + mcp, + more-itertools, natsort, - networkx, - pandas, + numpy, + ordered-set, + pathvalidate, pint, + posthog, + psutil, + pydantic-settings, pygls, - quart-cors, - quart-schema, - quart, + questionary, + requests, rich, ruamel-yaml, - schema, - scipy, + ruff, semver, - toolz, + sexpdata, + shapely, + typer, urllib3, - uvicorn, - watchfiles, - pyyaml, + zstd, + pythonOlder, + # tests pytestCheckHook, - pytest-xdist, + + pytest-benchmark, pytest-timeout, + pytest-datafiles, + pytest-xdist, + hypothesis, + writableTmpDirAsHomeHook, }: buildPythonPackage rec { pname = "atopile"; - version = "0.2.69"; + version = "0.11.2"; pyproject = true; + disabled = pythonOlder "3.13"; + src = fetchFromGitHub { owner = "atopile"; repo = "atopile"; tag = "v${version}"; - hash = "sha256-mQYnaWch0lVzz1hV6WboYxBGe3ruw+mK2AwMx13DQJM="; + hash = "sha256-JczlQulHlViV9pg0uPXd9Boagp74VBdZ1UMDXh2c3DA="; }; build-system = [ @@ -64,59 +80,142 @@ buildPythonPackage rec { nanobind ]; - dependencies = [ - antlr4-python3-runtime - attrs - case-converter - cattrs - click - deepdiff - easyeda2ato - eseries - fake-useragent - fastapi - gitpython - igraph - jinja2 - natsort - networkx - pandas - pint - pygls - quart-cors - quart-schema - quart - rich - ruamel-yaml - schema - scipy - semver - toolz - urllib3 - uvicorn - watchfiles - pyyaml # required for ato + dontUseCmakeConfigure = true; # skip cmake configure invocation + + nativeBuildInputs = [ + cmake + ninja ]; - pythonRelaxDeps = [ "antlr4-python3-runtime" ]; + dependencies = [ + antlr4-python3-runtime + atopile-easyeda2kicad + black # used as a dependency + case-converter + cookiecutter + dataclasses-json + deprecated + fastapi-github-oidc + freetype-py + gitpython + kicad-python + kicadcliwrapper + matplotlib + mcp + more-itertools + natsort + numpy + ordered-set + pathvalidate + pint + posthog + psutil + pydantic-settings + pygls + questionary + requests + rich + ruamel-yaml + ruff + semver + sexpdata + shapely + typer + urllib3 + zstd + ]; + + pythonRelaxDeps = [ + "posthog" + "zstd" + ]; pythonImportsCheck = [ "atopile" ]; - preCheck = '' - substituteInPlace pyproject.toml \ - --replace-fail "--html=artifacts/test-report.html" "" \ - --replace-fail "--self-contained-html" "" - ''; - nativeCheckInputs = [ + writableTmpDirAsHomeHook pytestCheckHook pytest-xdist + pytest-benchmark + pytest-datafiles pytest-timeout + hypothesis ]; + preCheck = '' + # do not report worker logs to filee + substituteInPlace test/conftest.py \ + --replace-fail "worker_id =" "worker_id = None #" + + # unrecognized flags + substituteInPlace pyproject.toml \ + --replace-fail "--html=artifacts/test-report.html" "" \ + --replace-fail "--self-contained-html" "" \ + --replace-fail "--numprocesses=auto" "" \ + + # Replace this function call that cause test to hang + substituteInPlace \ + test/cli/test_packages.py \ + test/library/test_names.py \ + test/test_examples.py \ + test/test_parse_utils.py \ + --replace-fail "_repo_root()" "Path('$(pwd)')" + + # Fix crash due to empty list in fixture tests + substituteInPlace \ + test/test_examples.py \ + test/test_parse_utils.py \ + --replace-fail "p.stem" "p.stem if isinstance(p, Path) else p" + ''; + + disabledTestPaths = [ + # timouts + "test/test_cli.py" + "test/cli/test_packages.py" + "test/end_to_end/test_net_naming.py" + "test/end_to_end/test_pcb_export.py" + "test/exporters/bom/test_bom.py" + "test/front_end/test_front_end_pick.py" + "test/libs/picker/test_pickers.py" + ]; + + disabledTests = [ + # timeout + "test_build_error_logging" + "test_performance_mifs_bus_params" + "test_resistor" + "test_reserved_attrs" + # requires internet + "test_simple_pick" + "test_simple_negative_pick" + "test_jlcpcb_pick_resistor" + "test_jlcpcb_pick_capacitor" + "test_regression_rp2040_usb_diffpair_full" + "test_model_translations" + # type error + "test_alternate_trait_constructor_with_params" + "test_parameterised_trait_with_params" + "test_trait_alternate_constructor_precedence" + "test_trait_template_enum" + "test_trait_template_enum_invalid" + # failure + "test_solve_voltage_divider_complex" + ]; + + # in order to use pytest marker, we need to use ppytestFlagsArray + # using pytestFlags causes `ERROR: file or directory not found: slow` + pytestFlagsArray = [ + "-m='not slow and not not_in_ci and not regression'" + "--timeout=10" # any test taking long, timouts with more than 60s + "--benchmark-disable" + "--tb=line" + ]; + + doCheck = true; + meta = { description = "Design circuit boards with code"; - homepage = "https://aiopg.readthedocs.io/"; + homepage = "https://atopile.io"; downloadPage = "https://github.com/atopile/atopile"; changelog = "https://github.com/atopile/atopile/releases/tag/${src.rev}"; license = with lib.licenses; [ mit ]; diff --git a/pkgs/development/python-modules/fastapi-github-oidc/default.nix b/pkgs/development/python-modules/fastapi-github-oidc/default.nix new file mode 100644 index 000000000000..75614652e872 --- /dev/null +++ b/pkgs/development/python-modules/fastapi-github-oidc/default.nix @@ -0,0 +1,55 @@ +{ + buildPythonPackage, + fetchFromGitHub, + hatchling, + hatch-vcs, + fastapi, + pyjwt, + httpx, + requests, + pytestCheckHook, + lib, +}: +buildPythonPackage rec { + pname = "fastapi-github-oidc"; + version = "0.3.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "atopile"; + repo = "fastapi-github-oidc"; + tag = version; + hash = "sha256-FS50++Hy9h0RFrSnc4PbXFPh/1OO0JOaFdIZwoXa86A="; + }; + + build-system = [ + hatchling + hatch-vcs + ]; + + dependencies = [ + fastapi + pyjwt + httpx + requests + ]; + + pythonImportsCheck = [ + "github_oidc.client" + "github_oidc.server" + ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + disabledTests = [ + "test_with_auth" # calls github api + ]; + + meta = { + description = "FastAPI compatible middleware to authenticate Github OIDC Tokens"; + homepage = "https://github.com/atopile/fastapi-github-oidc"; + changelog = "https://github.com/atopile/fastapi-github-oidc/releases/tag/${src.tag}"; + license = with lib.licenses; [ mit ]; + maintainers = with lib.maintainers; [ sigmanificient ]; + }; +} diff --git a/pkgs/development/python-modules/kicad-python/default.nix b/pkgs/development/python-modules/kicad-python/default.nix new file mode 100644 index 000000000000..3344a073b448 --- /dev/null +++ b/pkgs/development/python-modules/kicad-python/default.nix @@ -0,0 +1,70 @@ +{ + lib, + buildPythonPackage, + fetchFromGitLab, + poetry-core, + protoletariat, + mypy-protobuf, + pkgs, + protobuf, + pynng, + pytestCheckHook, + gitMinimal, + pythonOlder, + typing-extensions, +}: +buildPythonPackage rec { + pname = "kicad-python"; + version = "0.4.0"; + pyproject = true; + + src = fetchFromGitLab { + owner = "kicad/code"; + repo = "kicad-python"; + tag = version; + hash = "sha256-M2vJ/lSwc1XjrG661ayNIOZKJitmy/UPM2SesQI1xYE="; + fetchSubmodules = true; + }; + + build-system = [ + poetry-core + protoletariat + ]; + + dependencies = [ + protobuf + pynng + mypy-protobuf + ] + ++ (lib.optional (pythonOlder "3.13") typing-extensions); + + nativeBuildInputs = [ + pkgs.protobuf + mypy-protobuf + gitMinimal + ]; + + pythonRelaxDeps = [ "protobuf" ]; + + # fixes: FileExistsError: File already exists .../kipy/__init__.py + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail 'script =' "#" + ''; + + preBuild = '' + python build.py + ''; + + pythonImportsCheck = [ "kipy" ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + meta = { + description = "KiCad API Python Bindings"; + homepage = "https://kicad.org/"; + downloadPage = "https://gitlab.com/kicad/code/kicad-python"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ sigmanificient ]; + }; +} diff --git a/pkgs/development/python-modules/kicadcliwrapper/default.nix b/pkgs/development/python-modules/kicadcliwrapper/default.nix new file mode 100644 index 000000000000..c7f6d5b341e8 --- /dev/null +++ b/pkgs/development/python-modules/kicadcliwrapper/default.nix @@ -0,0 +1,55 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + hatchling, + hatch-vcs, + typing-extensions, + pytestCheckHook, + kicad, +}: + +buildPythonPackage rec { + pname = "kicadcliwrapper"; + version = "1.1.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "atopile"; + repo = "kicadcliwrapper"; + tag = "v${version}"; + hash = "sha256-s1j0k6SvZiIHu8PKGTR+GaYUZIlFq5TKYuxoCsvsvUY="; + }; + + build-system = [ + hatchling + hatch-vcs + ]; + + dependencies = [ typing-extensions ]; + + pythonRemoveDeps = [ "black" ]; + + pythonImportsCheck = [ + "kicadcliwrapper" + "kicadcliwrapper.lib" + ]; + + # this script is used to generate the bindings + # and is intended for development. + preCheck = '' + rm src/kicadcliwrapper/main.py + ''; + + nativeCheckInputs = [ + pytestCheckHook + kicad + ]; + + meta = { + description = "Strongly typed, auto-generated bindings for KiCAD's CLI"; + homepage = "https://github.com/atopile/kicadcliwrapper"; + license = with lib.licenses; [ mit ]; + maintainers = with lib.maintainers; [ sigmanificient ]; + }; +} diff --git a/pkgs/development/python-modules/protoletariat/default.nix b/pkgs/development/python-modules/protoletariat/default.nix new file mode 100644 index 000000000000..721f90d3c927 --- /dev/null +++ b/pkgs/development/python-modules/protoletariat/default.nix @@ -0,0 +1,59 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + poetry-core, + astunparse, + grpcio-tools, + click, + pkgs, + protobuf, + mypy-protobuf, + pytestCheckHook, + writableTmpDirAsHomeHook, +}: +buildPythonPackage rec { + pname = "protoletariat"; + version = "3.3.10"; + pyproject = true; + + src = fetchFromGitHub { + owner = "cpcloud"; + repo = "protoletariat"; + tag = version; + hash = "sha256-oaZmgen/7WkX+nNuphrcyniL7Z/OaeqlcnbCnqR5h0w="; + }; + + build-system = [ poetry-core ]; + + dependencies = [ + astunparse + click + grpcio-tools + protobuf + ]; + + pythonRelaxDeps = [ + "protobuf" + ]; + + postPatch = '' + substituteInPlace protoletariat/__main__.py \ + --replace-fail 'default="protoc",' 'default="${lib.getExe' pkgs.protobuf "protoc"}",' + ''; + + pythonImportsCheck = [ "protoletariat" ]; + + nativeCheckInputs = [ + pytestCheckHook + writableTmpDirAsHomeHook + mypy-protobuf + ]; + + meta = { + description = "Python protocol buffers for the rest of us"; + changelog = "https://github.com/cpcloud/protoletariat/blob/${version}/CHANGELOG.md"; + license = with lib.licenses; [ asl20 ]; + maintainers = with lib.maintainers; [ sigmanificient ]; + }; +} diff --git a/pkgs/top-level/python-aliases.nix b/pkgs/top-level/python-aliases.nix index f0c7bbb6b415..f3e3777a27c2 100644 --- a/pkgs/top-level/python-aliases.nix +++ b/pkgs/top-level/python-aliases.nix @@ -231,6 +231,7 @@ mapAliases ({ dogpile-core = throw "dogpile-core is no longer maintained, use dogpile-cache instead"; # added 2021-11-20 dugong = throw "dugong is unmaintained since 2022 and has therefore been removed"; # added 2024-12-12 editdistance-s = throw "editdistance-s has been removed since it was added solely for the identity package, which has moved on to ukkonen"; # added 2025-08-04 + easyeda2ato = throw "easyeda2ato as been removed in favor of atopile-easyda2kicad"; # added 2025-06-08 eebrightbox = throw "eebrightbox is unmaintained upstream and has therefore been removed"; # added 2022-02-03 EasyProcess = easyprocess; # added 2023-02-19 email_validator = email-validator; # added 2022-06-22 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c9d09e5110ef..075037751fe6 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1095,6 +1095,8 @@ self: super: with self; { atopile = callPackage ../development/python-modules/atopile { }; + atopile-easyeda2kicad = callPackage ../development/python-modules/atopile-easyeda2kicad { }; + atproto = callPackage ../development/python-modules/atproto { }; atpublic = callPackage ../development/python-modules/atpublic { }; @@ -4490,8 +4492,6 @@ self: super: with self; { easydict = callPackage ../development/python-modules/easydict { }; - easyeda2ato = callPackage ../development/python-modules/easyeda2ato { }; - easyenergy = callPackage ../development/python-modules/easyenergy { }; easygui = callPackage ../development/python-modules/easygui { }; @@ -4971,6 +4971,8 @@ self: super: with self; { fastapi-cli = callPackage ../development/python-modules/fastapi-cli { }; + fastapi-github-oidc = callPackage ../development/python-modules/fastapi-github-oidc { }; + fastapi-mail = callPackage ../development/python-modules/fastapi-mail { }; fastapi-mcp = callPackage ../development/python-modules/fastapi-mcp { }; @@ -7745,6 +7747,10 @@ self: super: with self; { kicad = toPythonModule (pkgs.kicad.override { python3 = python; }).src; + kicad-python = callPackage ../development/python-modules/kicad-python { }; + + kicadcliwrapper = callPackage ../development/python-modules/kicadcliwrapper { }; + kinparse = callPackage ../development/python-modules/kinparse { }; kiss-headers = callPackage ../development/python-modules/kiss-headers { }; @@ -12058,6 +12064,8 @@ self: super: with self; { inherit (pkgs.__splicedPackages) protobuf; }; + protoletariat = callPackage ../development/python-modules/protoletariat { }; + proton-client = callPackage ../development/python-modules/proton-client { }; proton-core = callPackage ../development/python-modules/proton-core { };