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

Added support for repositories in global config and global default repository #2074

Conversation

Zyava
Copy link

@Zyava Zyava commented Feb 22, 2020

This PR adds two features:

  1. Support for defining repositories in global config which can be used by search, init and add commands. It also fixes repository order for all commands (which should fix Private repos don't actually take precedence #1677)

  2. Possibility to set a repository from global config as a default, making poetry to ignore all other repositories (behaviour similar to index-url from pip - explained in great details in Replacing the URL of a source (e.g. PyPI) at the global level #1632). In short - this feature is required in many enterprise environments where all packages should be fetched from private PyPI repo which hosts company's own packages and acts as a caching proxy/mirror to official PyPI repositories. In some companies does security scans, license checks, etc. and forbids some public packages form being installed. This feature was actually the main motivation for this PR but without proper support for repositories in global config it would look very hacky.

Pull Request Check List

  • Added tests for changed code.
  • Updated documentation for changed code.

…itory support similar to index-url from pip, multiple repositories support to search, init and add commands
@Zyava
Copy link
Author

Zyava commented Feb 23, 2020

@sdispater I can't reproduce test failures locally, can you please suggest what I should do now?

(python-3.5.9)➜  poetry git:(add-repositories-support-to-global-config-develop) ✗ poetry run pytest tests/
Test session starts (platform: darwin, Python 3.5.9, pytest 4.6.9, pytest-sugar 0.9.2)
rootdir: /Users/dzavalkin/work/source/poetry
plugins: sugar-0.9.2, mock-1.13.0, cov-2.8.1
collecting ...
 tests/test_factory.py ✓✓✓✓✓✓✓✓✓✓✓✓✓✓                                                                                                                                                          2% ▎
 tests/config/test_config.py ✓✓✓                                                                                                                                                               2% ▎
 ...
Results (142.52s):
     779 passed
       2 skipped

@BrandonLWhite
Copy link

I pulled your branch and ran the tests, and they are failing for me locally :(

I could really use this contribution where I work!

Test session starts (platform: linux, Python 3.6.9, pytest 4.6.9, pytest-sugar 0.9.2)

...

Results (75.29s):
     753 passed
      26 failed
         - tests/test_factory.py:167 test_poetry_with_global_default_source
         - tests/test_factory.py:179 test_poetry_with_global_and_local_default_source
         - tests/test_factory.py:193 test_poetry_with_two_local_sources_and_default
         - tests/test_factory.py:203 test_poetry_with_non_default_global_source_and_default_local_source
         - tests/test_factory.py:219 test_poetry_with_global_and_local_same_name_source
         - tests/console/commands/test_add.py:14 test_add_no_constraint
         - tests/console/commands/test_add.py:47 test_add_equal_constraint
         - tests/console/commands/test_add.py:74 test_add_greater_constraint
         - tests/console/commands/test_add.py:101 test_add_constraint_with_extras
         - tests/console/commands/test_add.py:135 test_add_constraint_dependencies
         - tests/console/commands/test_add.py:168 test_add_git_constraint
         - tests/console/commands/test_add.py:203 test_add_git_constraint_with_poetry
         - tests/console/commands/test_add.py:230 test_add_git_constraint_with_extras
         - tests/console/commands/test_add.py:269 test_add_git_ssh_constraint
         - tests/console/commands/test_add.py:305 test_add_directory_constraint
         - tests/console/commands/test_add.py:341 test_add_directory_with_poetry
         - tests/console/commands/test_add.py:371 test_add_file_constraint_wheel
         - tests/console/commands/test_add.py:408 test_add_file_constraint_sdist
         - tests/console/commands/test_add.py:445 test_add_constraint_with_extras_option
         - tests/console/commands/test_add.py:487 test_add_url_constraint_wheel
         - tests/console/commands/test_add.py:526 test_add_url_constraint_wheel_with_extras
         - tests/console/commands/test_add.py:705 test_add_to_section_that_does_no_exist_yet
         - tests/console/commands/test_add.py:738 test_add_should_not_select_prereleases
         - tests/console/commands/test_add.py:788 test_add_should_work_when_adding_existing_package_with_latest_constraint
         - tests/console/commands/test_add.py:823 test_add_chooses_prerelease_if_only_prereleases_are_available
         - tests/console/commands/test_add.py:849 test_add_preferes_stable_releases
       2 skipped

@mcouthon
Copy link
Contributor

mcouthon commented Apr 5, 2020

I need this as well. Would like to help if possible.

@Zyava
Copy link
Author

Zyava commented Apr 11, 2020

@BrandonLWhite @mcouthon feel free to take over this PR. I have no interest in driving it further - my freelance contract for this client was terminated due to corona situation. But even before that I migrated most apps of that team to pip-tools - because of this issue and a couple of other ones Poetry is not a way to go for them.

@Secrus
Copy link
Member

Secrus commented May 21, 2022

Closing, as author resigned from it.

@Secrus Secrus closed this May 21, 2022
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants