alonisser
alonisser

Reputation: 12078

Installing a library from codeartifact with poetry without moving all libraries to be installed from there

My situation I have a specific library in codeartifact.

I have a project (not a library) managing dependencies with poetry consuming this library.

Now I need to install this library in the project but can't find instructions which

  1. Don't change the actual pypi index url for all projects in my computer
  2. Being able to install the specific library from codeartifact without it being proxy for pypi for ALL libraries

Any ideas or clues on how to achieve this?

Upvotes: 4

Views: 1578

Answers (1)

Teivaz
Teivaz

Reputation: 5675

In order to do that you need to add a source to your pyproject.toml and mark it as secondary:

[[tool.poetry.source]]
name = "my-repo"
url = "your-pypi-url"
secondary = true

And then point your library to this source.

With CLI:

poetry add my-library --source my-repo

Or directly in pyproject.toml

[tool.poetry.dependencies]
…
my-library = {version = "1.0.0", source = "my-repo"}

Upvotes: 4

Related Questions