brainy-solstice-27042
04/27/2022, 9:31 PM21:15:57 [INFO] initializing pantsd...
21:15:57 [INFO] pantsd initialized.
21:15:58 [ERROR] 1 Exception encountered:
UnrecognizedTargetTypeException: Target type 'compile_cython' is not registeredfor address submodules/obscura-plugins/plugins:compile-plugins.
All valid target types: ['_python_requirements_file', 'alias', 'annotation_processor', 'benchmark', 'credentials', 'ctypes_compatible_c_library', 'ctypes_compatible_cpp_library', 'external_native_library', 'files', 'jar_library', 'java_agent', 'java_library', 'java_protobuf_library', 'java_thrift_library', 'javac_plugin', 'junit_tests', 'jvm_app', 'jvm_binary', 'jvm_prep_command', 'managed_jar_dependencies', 'netrc_credentials', 'node_bundle', 'node_module', 'node_preinstalled_module', 'node_remote_module', 'node_test', 'packaged_native_library', 'page', 'prep_command', 'python_app', 'python_binary', 'python_dist', 'python_grpcio_library', 'python_library', 'python_requirement_library', 'python_tests', 'python_thrift_library', 'remote_sources', 'resources', 'scala_library', 'scalac_plugin', 'target', 'unpacked_jars', 'unpacked_whls']
(If 'compile_cython' is a custom target type, refer to <https://groups.google.com/forum/#!topic/pants-devel/WsRFODRLVZI> for instructions on writing a light-weight Target API binding.)
(Use --print-exception-stacktrace to see more error details.)
I've looked at the link and docs for adding a new custom target type as well as the solution posted in the thread to the previous slack conversation, however being new to pants, I'm not exactly sure how to go about adding the existing compile_cython
code that we have as a valid target type so we can build the c++ code.hundreds-father-404
04/27/2022, 9:40 PMcompile_cython
?brainy-solstice-27042
04/27/2022, 9:42 PMhundreds-father-404
04/27/2022, 9:43 PMfrom cython.compile_cython
brainy-solstice-27042
04/27/2022, 9:44 PMbrainy-solstice-27042
04/27/2022, 9:47 PMhundreds-father-404
04/27/2022, 9:52 PMpython_library
other than rhe new output
field. What is the type of that? Like are people typing strings, a list of stringsbrainy-solstice-27042
04/27/2022, 9:58 PMbrainy-solstice-27042
04/27/2022, 9:59 PMbrainy-solstice-27042
04/27/2022, 9:59 PMcompile_cython
target has this for the output: output='obscura_wrappers.cpython-36m-x86_64-linux-gnu.so',hundreds-father-404
04/27/2022, 11:02 PMclass CythonOutputV2Field(StringField):
alias = "output"
help = "fill this in"
class CompileCythonV2Target(Target):
alias = "compile_cython"
help = "fill me in"
core_fields = (CythonOutputV2Field, *PythonLibrary.core_fields)
then in `register.py`:
def target_types():
return [CompileCythonV2Target]
brainy-solstice-27042
04/27/2022, 11:04 PMhundreds-father-404
04/27/2022, 11:05 PMbrainy-solstice-27042
04/27/2022, 11:06 PMhundreds-father-404
04/27/2022, 11:07 PMTarget
and StringField
come from pants.engine.target
. Note that there is a v1 version of Target
and v2. You may want to do
from pants.engine.target import Target as TargetV2
hundreds-father-404
04/27/2022, 11:07 PMPythonLibrary
comes from pants.backend.python.target_types
brainy-solstice-27042
04/27/2022, 11:15 PMhundreds-father-404
04/27/2022, 11:23 PMbuild_file_aliases
in register.py
. There should only be a new code. You are writing
"bindings"brainy-solstice-27042
04/27/2022, 11:24 PMhundreds-father-404
04/27/2022, 11:26 PMfrom pants.backend.python.targets.python_library import PythonLibrary
. You are using the V2 class. You will need to do the from as
import thingbrainy-solstice-27042
04/27/2022, 11:29 PMcompile_cython
to show up in the target types after I fixed that. I'll try running my tests now to see if pants does what I need it to dobrainy-solstice-27042
04/28/2022, 12:21 AM/usr/local/bin/python3.6
. Is there any way to tell pants to use a specific interpreter to build things with?brainy-solstice-27042
04/28/2022, 12:25 AM