I'm a bit confused on how to write dependencies ma...
# general
l
I'm a bit confused on how to write dependencies manually. Maybe I don't fully understand the concept of a target (I have read the docs for it though) I have a setup where:
Copy code
$ cat BUILD
python_sources(name='source', sources=['my_api/**/*.py'])
And I am dynamically importing a file:
my_api/config/development_settings.py
I tried:
Copy code
python_sources(
    name='source',
    sources=['my_api/**/*.py'],
    overried={'my_api/config/__init__.py': {'dependencies': ['my_api/config/development_settings.py']}},
)
And it did not work. Then I tried
my_api/config/development_settings.py:../../source
and it seemed to work Question: Why did the "shortcut" not work for me ? Do I need to explicitly add
../../
everywhere ? In another case, I want configs for my pytest to be specified. So, I have something like:
Copy code
python_tests(
    name='tests',
    sources=['my_api_test/**/test_*.py'],
    dependencies=['my_api_test/config/*.py']},
    # Also tried: dependencies=['my_api_test/config/*.py:*']},
    # And also: dependencies=['//my_api_test/config/*.py:*']},
)
This does not work with the error:
Directory 'corridor_api_test/instance' does not contain any BUILD files
c
Until you get a more fullfilling answer, I will just say that for dependencies there is no glob support, you need to spell each target out explicitly. And regarding your
:../../
question, it is because the target name, if left off will use a default name that is the name of the directory for the file, so in your case, leaving of the target name from the file, yields the same as
my_api/config/development_settings.py:config
Hope that makes it a little clearer.
(the default name part works well if you would have had a BUILD file with a
python_sources()
target in your
config
dir)
b
Also dependencies start from the build root. Is my_api a directory under the build root?
l
yes - its at the root of my git repo
b
I suspect it's because this is coming from the same target? So it might be a chicken-and-egg problem.
But that's just a hunch