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

fix: proper display for extra Pypi indexes config #1622

Merged
merged 13 commits into from
Jan 28, 2023

Conversation

GabDug
Copy link
Contributor

@GabDug GabDug commented Jan 15, 2023

Pull Request Check List

  • A news fragment is added in news/ describing what is new.
  • Test cases added for changed code.

Describe what you have changed in this PR.

About issue #1616

Display repository config and Pypi indexes config using pdm config.

pdm config -v will also add a simple comment for repositories/indexes.

pdm config pypi.<index>, pdm config pypi.<index>.<key> now work like pdm config repository.<name> and pdm config repository.<name>.key, and hide passwords.

Not super happy about the fix, as there is a lot of similar code for indexes and repositories, and it's very much custom and doesn't use a system like Config's _config_map, but I'm a little chilly about making more in-depth changes.

Samples

Using the following config.toml

[python]
use_venv = true
use_pyenv = true

[pypi.artifact]
url = "https://extra/pypi/private-python/simple"
username = "extra_user"
password = "XXXX"
verify_ssl = "True"

[repository.extra]
url = "https://extra/pypi/private-python/"
username = "extra_user"
password = "XXXX"

$ pdm config

...

Home configuration (/Users/user/Library/Preferences/pdm/config.toml):
pypi.extra.url = https://extra/pypi/private-python/simple
pypi.extra.username = extra_user
pypi.extra.password = <hidden>
pypi.extra.verify_ssl = True
python.use_pyenv = True
python.use_venv = True
repository.extra.url = https://extra/pypi/private-python/
repository.extra.username = extra_user
repository.extra.password = <hidden>

$ pdm config -v

...

Home configuration (/Users/user/Library/Preferences/pdm/config.toml):
# Configuration of non-default Pypi index `extra`
pypi.extra.url = https://extra/pypi/private-python/simple
pypi.extra.username = extra_user
pypi.extra.password = <hidden>
pypi.extra.verify_ssl = True
# Use the pyenv interpreter
python.use_pyenv = True
# Install packages into the activated venv site packages instead of PEP 582
python.use_venv = True
# Configuration of custom repository `extra`
repository.extra.url = https://extra/pypi/private-python/
repository.extra.username = extra_user
repository.extra.password = <hidden>
$ pdm config pypi.extra.url
https://extra/pypi/private-python/simple
$ pdm config pypi.extra.password
<hidden>

@GabDug GabDug force-pushed the fix/registry-config branch from 08c3029 to 47509d9 Compare January 18, 2023 09:10
@codecov-commenter
Copy link

codecov-commenter commented Jan 18, 2023

Codecov Report

Base: 85.26% // Head: 85.20% // Decreases project coverage by -0.07% ⚠️

Coverage data is based on head (21cf79d) compared to base (b3c2ad4).
Patch coverage: 72.46% of modified lines in pull request are covered.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1622      +/-   ##
==========================================
- Coverage   85.26%   85.20%   -0.07%     
==========================================
  Files          92       92              
  Lines        8490     8550      +60     
  Branches     1831     1846      +15     
==========================================
+ Hits         7239     7285      +46     
- Misses        843      850       +7     
- Partials      408      415       +7     
Flag Coverage Δ
unittests 85.02% <72.46%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/pdm/cli/commands/init.py 94.28% <ø> (ø)
src/pdm/models/backends.py 84.52% <ø> (ø)
src/pdm/models/candidates.py 86.82% <ø> (ø)
src/pdm/cli/commands/config.py 89.23% <45.45%> (-3.63%) ⬇️
src/pdm/_types.py 83.87% <66.66%> (-1.85%) ⬇️
src/pdm/project/config.py 84.10% <70.96%> (-0.88%) ⬇️
src/pdm/models/requirements.py 93.65% <85.71%> (-0.55%) ⬇️
src/pdm/termui.py 90.47% <100.00%> (ø)
src/pdm/utils.py 87.08% <100.00%> (+0.05%) ⬆️
src/pdm/cli/actions.py 78.14% <0.00%> (-0.14%) ⬇️
... and 2 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@GabDug GabDug changed the title Draft: fix: proper display for extra Pypi indexes config fix: proper display for extra Pypi indexes config Jan 22, 2023
src/pdm/cli/commands/config.py Outdated Show resolved Hide resolved
src/pdm/cli/commands/config.py Outdated Show resolved Hide resolved
@frostming frostming merged commit d39d5be into pdm-project:main Jan 28, 2023
frostming added a commit that referenced this pull request Jan 28, 2023
---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Frost Ming <mianghong@gmail.com>
@j178 j178 mentioned this pull request Apr 3, 2024
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