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

conda_mirror.py: set additional parameters from config-file... #74

Merged
merged 19 commits into from
Feb 2, 2019

Conversation

magnuhho
Copy link
Contributor

… while keeping ability to override from command line.

With this change config.yaml can contain most command line parameters and you can have a config file like

target_directory: "/conda-mirror/conda-forge"
temp_directory: "/tmp"
platform: linux-64
upstream_channel: conda-forge
dry_run: True
blacklist:
  - name: "*"
whitelist:
  - name: ca-certificates

If parameters are both found in the config file and in the given command line arguments, the latter will take precedence.

Now you can simply call conda-mirror with --config

@codecov-io
Copy link

codecov-io commented Oct 15, 2018

Codecov Report

Merging #74 into master will decrease coverage by 1.77%.
The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #74      +/-   ##
==========================================
- Coverage   93.89%   92.11%   -1.78%     
==========================================
  Files           2        2              
  Lines         262      279      +17     
==========================================
+ Hits          246      257      +11     
- Misses         16       22       +6
Impacted Files Coverage Δ
conda_mirror/conda_mirror.py 92.02% <80%> (-1.8%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 96bad91...1b6e1b6. Read the comment docs.

@magnuhho
Copy link
Contributor Author

Seems like the PR was a bit premature - the arguments that have default values set to something that does not evaluate to False are not overridden by values in the config file. Like temp_directory.
I'll look into it

@magnuhho
Copy link
Contributor Author

magnuhho commented Oct 25, 2018

After some interesting merges and some fixup, the change/pr should be good to go now.

Copy link
Contributor

@parente parente left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay in reviewing. There's been a request to cut a 0.8.0 release. We can get this included with a couple minor modifications.

# ignore values that can only be given on command line
(a.dest not in {'config', 'verbose', 'version'}) and
# only use config file value if the value was not explicitly given on command line
(not given_args.__contains__(a.dest))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(not given_args.__contains__(a.dest))
(a.dist not in given_args)

@@ -220,6 +220,8 @@ def _parse_and_format_args():
"""
parser = _make_arg_parser()
args = parser.parse_args()
# parse arguments without setting defaults
given_args, foo = parser._parse_known_args(sys.argv[1:], argparse.Namespace())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
given_args, foo = parser._parse_known_args(sys.argv[1:], argparse.Namespace())
given_args, _ = parser._parse_known_args(sys.argv[1:], argparse.Namespace())

@parente parente mentioned this pull request Jan 30, 2019
5 tasks
@parente parente self-assigned this Feb 2, 2019
@parente
Copy link
Contributor

parente commented Feb 2, 2019

Change of plans: I'll merge this and fix the two style nits in the release PR.

@parente parente merged commit b19e584 into vericast:master Feb 2, 2019
parente added a commit to parente/conda-mirror that referenced this pull request Feb 2, 2019
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.

3 participants