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

magnuhho commented Oct 15, 2018

… 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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Contributor Author

magnuhho commented Oct 18, 2018

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 added 12 commits Oct 24, 2018
conda_mirror.py: added command line swith: --no-validate-target
Handle download errors
@magnuhho

This comment has been minimized.

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
Collaborator

parente left a comment

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))

This comment has been minimized.

Copy link
@parente

parente Jan 30, 2019

Collaborator
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())

This comment has been minimized.

Copy link
@parente

parente Jan 30, 2019

Collaborator
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
4 of 5 tasks complete
@parente parente self-assigned this Feb 2, 2019
@parente

This comment has been minimized.

Copy link
Collaborator

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 Valassis-Digital-Media:master Feb 2, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
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
Projects
None yet
3 participants
You can’t perform that action at this time.