feat: search current working directory for config file#1464
feat: search current working directory for config file#1464kevinjqliu merged 9 commits intoapache:mainfrom
Conversation
kevinjqliu
left a comment
There was a problem hiding this comment.
Thanks for the PR! Added a few nit comments
There was a problem hiding this comment.
there are a couple other places where pyiceberg.yaml is referenced in the docs
https://grep.app/search?q=pyiceberg.yaml&filter[repo][0]=apache/iceberg-python&filter[path][0]=mkdocs/docs/
There was a problem hiding this comment.
Nice finds! That grep tool is pretty neat. I just made some corrections to these in 3ebbb8c.
There was a problem hiding this comment.
There was a problem hiding this comment.
I tried adding a test here, but I wonder if there are opportunities to clean it up.
kevinjqliu
left a comment
There was a problem hiding this comment.
Thanks for the PR! I added some nit comments on testing
|
There's another test that looks to do something similar to this newer test. Are both needed? iceberg-python/tests/utils/test_config.py Lines 58 to 65 in 0e5086c |
Fokko
left a comment
There was a problem hiding this comment.
I've left one comment, but apart from that, it looks good to me 👍
Thank you! I applied that change! ✅ |
kevinjqliu
left a comment
There was a problem hiding this comment.
LGTM! I have a few nit comments about testings and adding a warning for storing in current dir
mkdocs/docs/configuration.md
Outdated
| There are three ways to pass in configuration: | ||
|
|
||
| - Using the `~/.pyiceberg.yaml` configuration file | ||
| - Using the `.pyiceberg.yaml` configuration file stored in either the directory specified by the `PYICEBERG_HOME` environment variable, the home directory, or current working directory. |
There was a problem hiding this comment.
nit: move the extra info about where the file is located down to L37.
also i think its valuable to include a warning about accidentally checking in secrets with git when using the current working directory
| and loaded in python by calling `load_catalog(name="hive")` and `load_catalog(name="rest")`. | ||
|
|
||
| This information must be placed inside a file called `.pyiceberg.yaml` located either in the `$HOME` or `%USERPROFILE%` directory (depending on whether the operating system is Unix-based or Windows-based, respectively) or in the `$PYICEBERG_HOME` directory (if the corresponding environment variable is set). | ||
| This information must be placed inside a file called `.pyiceberg.yaml` located either in the `$HOME` or `%USERPROFILE%` directory (depending on whether the operating system is Unix-based or Windows-based, respectively), in the current working directory, or in the `$PYICEBERG_HOME` directory (if the corresponding environment variable is set). |
There was a problem hiding this comment.
nit: include warning about accidentally checking in secrets with git when using the current working directory
|
hey @IndexSeek could you rebase this PR and run |
6d14ece to
51ab8e2
Compare
I just rebased and pre-commit is passing. Please let me know if you want me to make additional changes. I'm looking forward to getting this one in! |
|
@IndexSeek It looks like the CI is still a bit sad, do you have a minute to look at this? |
|
its an issue with dead url link, i think rebasing Also, do you think its important to include a warning about accidentally checking in secrets with git when using the current working directory? |
Co-authored-by: Fokko Driesprong <fokko@apache.org>
51ab8e2 to
e3d1a63
Compare
|
rebased off main and fixed the tests. Thanks @IndexSeek for the contribution and @Fokko for the review :) |
Resolves #1333
Adds the current working directory to the search path for the
.pyiceberg.yamlfile.As it is now, the file is searched in the following order:
PYICEBERG_HOMEenvironment variableI'm unsure if people would like to have 2 and 3 swapped. In either case, users can still override this with the environment variable.