[Bug 294779] devel/py-pytokens: build failure because mypy requires sqlite3 module

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 25 Apr 2026 12:01:51 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294779

            Bug ID: 294779
           Summary: devel/py-pytokens: build failure because mypy requires
                    sqlite3 module
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: sunpoet@FreeBSD.org
          Reporter: freebsd-bug-report-yf@yf.bsdclub.org
          Assignee: sunpoet@FreeBSD.org
             Flags: maintainer-feedback?(sunpoet@FreeBSD.org)

On ports tree (git hash 0e37b0ddf3f844d0cba3ff2f15e3c31fcc1ce74b), poudriere
bulk deve/py-tokens build fails with error log below:
[[[
   ...
===== env: NO_DEPENDS=yes USER=nobody UID=65534 GID=65534
===>  Building for py311-pytokens-0.4.1
* Getting build dependencies for wheel...
Traceback (most recent call last):
  File
"/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_
process.py", line 389, in <module>
    main()
  File
"/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_
process.py", line 373, in main
    json_out["return_val"] = hook(**hook_input["kwargs"])
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File
"/usr/local/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py",
line 143, in get_requires_for_build_wheel
    return hook(config_settings)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/setuptools/build_meta.py", line
177, in get_requires_for_build_wheel
    return self._get_build_requires(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/setuptools/build_meta.py", line
159, in _get_build_requires
    self.run_setup()
  File "/usr/local/lib/python3.11/site-packages/setuptools/build_meta.py", line
174, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 29, in <module>
    setup(ext_modules=get_ext_modules())
                      ^^^^^^^^^^^^^^^^^
  File "setup.py", line 20, in get_ext_modules
    return mypycify(
           ^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mypyc/build.py", line 752, in
mypycify
    groups, group_cfilenames, source_deps = mypyc_build(
                                            ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mypyc/build.py", line 543, in
mypyc_build
    group_cfiles, ops_text, source_deps = generate_c(
                                          ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mypyc/build.py", line 316, in
generate_c
    result = emitmodule.parse_and_typecheck(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mypyc/codegen/emitmodule.py",
line 201, in parse_and_typecheck
    mypyc_plugin = MypycPlugin(options, compiler_options, groups)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mypyc/codegen/emitmodule.py",
line 136, in __init__
    self.metastore = create_metastore(options)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mypy/build.py", line 1622, in
create_metastore
    mds: MetadataStore = SqliteMetadataStore(_cache_dir_prefix(options),
sync_off=sync_off)
                        
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mypy/metastore.py", line 180,
in
 __init__
    self.db = connect_db(os_path_join(cache_dir_prefix, "cache.db"),
sync_off=sync_off)
             
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/mypy/metastore.py", line 158,
in connect_db
    import sqlite3.dbapi2
  File "/usr/local/lib/python3.11/sqlite3/__init__.py", line 57, in <module>
    from sqlite3.dbapi2 import *
  File "/usr/local/lib/python3.11/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ModuleNotFoundError: No module named '_sqlite3'
Exception ignored in: <function SqliteMetadataStore.__del__ at 0x2ccecc6e9da0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/mypy/metastore.py", line 242,
in __del__
    self.close()
  File "/usr/local/lib/python3.11/site-packages/mypy/metastore.py", line 236,
in close
    if self.db:
       ^^^^^^^
AttributeError: 'SqliteMetadataStore' object has no attribute 'db'

ERROR Backend subprocess exited when trying to invoke
get_requires_for_build_wheel
*** Error code 1

Stop.
make: stopped making "build" in /usr/ports/devel/py-pytokens
   ...
]]]

If I add 

    ${PYTHON_PKGNAMEPREFIX}sqlite3>=0:databases/py-sqlite3@${PY_FLAVOR} \

line in BULID_DEPENDS in port Makefile, I could build successfully. However I
cannot determine which of the case -- missing RUN_DEPENDS for devel/py-mypy or
missing BUILD_DEPENDS for devel/py-pytokens.

-- 
You are receiving this mail because:
You are the assignee for the bug.