Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lakectl config support #45

Merged
merged 8 commits into from
Aug 30, 2023
Merged

Add lakectl config support #45

merged 8 commits into from
Aug 30, 2023

Conversation

nicholasjng
Copy link
Collaborator

Assumes the default location (~/.lakectl.yaml), and loads the config file if it exists and YAML is installed.

If YAML is not installed (this is not a hard requirement), it is possible to install it via python -m pip install lakefs-spec[yaml]. This extra is added specifically for lakectl configuration file support.

Also ignores missing imports from pyyaml under mypy.

Closes #43.

Assumes the default location (~/.lakectl.yaml), and loads the config
file if it exists and YAML is installed.

If YAML is not installed (this is not a hard requirement), it is possible
to install it via `python -m pip install lakefs-spec[yaml]`.
For reading in `lakectl` configuration files.

Also ignores missing imports from `pyyaml` under mypy.
@codecov-commenter
Copy link

codecov-commenter commented Aug 30, 2023

Codecov Report

Patch coverage: 38.09% and project coverage change: -2.58% ⚠️

Comparison is base (e56e0d3) 71.37% compared to head (e2da0c4) 68.79%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #45      +/-   ##
==========================================
- Coverage   71.37%   68.79%   -2.58%     
==========================================
  Files           3        3              
  Lines         262      282      +20     
  Branches       45       47       +2     
==========================================
+ Hits          187      194       +7     
- Misses         59       71      +12     
- Partials       16       17       +1     
Files Changed Coverage Δ
src/lakefs_spec/spec.py 67.84% <38.09%> (-2.80%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Saves a `Path.expanduser` in the `LakectlConfig.read()`.
Since we now have three rivaling modes of initialization for the file
system, it is time to test the priority order is correct.

This brought up a quirk related to instance caching: Since both the
`lakectl` config file and environment variables are read implicitly,
they do not require arguments, and thus the first method used between
config file and envvar initialization will cause cache hits, and
suffocate the other method unless the cache is cleared.
Explains the caveat of implicit initializations from envvars and lakectl
config files together with the instance cache.

Also changes the install instructions to bare `pip install` commands.
src/lakefs_spec/spec.py Show resolved Hide resolved
src/lakefs_spec/spec.py Outdated Show resolved Hide resolved
If the file exists, we enter the `LakectlConfig.read()` method. There,
we conditionally abort if `pyyaml` is not installed.

If `pyyaml` is not installed, emit a warning that it cannot be found,
and a solution (i.e. a pip install).
README.md Show resolved Hide resolved
@nicholasjng nicholasjng merged commit c89e459 into main Aug 30, 2023
1 check passed
@nicholasjng nicholasjng deleted the add-lakectl-config-support branch August 31, 2023 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Read LakeFS Client Config from .lakectl.yaml (if Exists)
3 participants