'Smart contract compile with empty bytecode when using Interface

Given Solidity ^0.8.13 file X.sol, contains an interface of contract Y and contract X

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

interface YI{
  // This is the interface of contract Y
  function hello() external payable;
}

contract X{
  YI public targetContract;
  constructor(address _target) {
    targetContract = YI(_target);
  }
}

and the compile code:

from web3 import Web3
import solcx  # type: ignore
from typing import Any


# run the line below to install the compiler ->  only once is needed.
# solcx.install_solc(version='latest')


def _compile(file_name: str) -> Any:
    # set the version
    solcx.set_solc_version('0.8.13')

    # compile
    compiled_sol = solcx.compile_files(
        [file_name], output_values=['abi', 'bin'])

    # retrieve the contract interface
    contract_id, contract_interface = compiled_sol.popitem()
    return contract_interface['bin'], contract_interface['abi']

bytecode, abi = _compile("X.sol")

the bytecode returns as empty string instead of bytes, any hint what am I missing? I use python py-solc-x



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source