Private repository
To use a private repository with Poetry, you can configure it to authenticate and install packages from the repository.
1. Add the Private Repository to Poetry
poetry config repositories.<repository-name> <repository-url>
- Replace
<repository-name>with a name for the repository (e.g.,my-private-repo). - Replace
<repository-url>with the URL of your private repository.
poetry config repositories.my-private-repo https://my-private-repo.example.com/simple
2. Authenticate with the Repository
If your private repository requires authentication, configure the credentials:
poetry config http-basic.<repository-name> <username> <password>
- Replace
<repository-name>with the same name as above. - Replace
<username>and<password>with your repository credentials.
poetry config http-basic.my-private-repo my-username my-password
3. Add Dependencies from the Private Repository
poetry add <package-name> --source <repository-name>
poetry add my-private-package --source my-private-repo
4. Check Configuration
You can confirm your repository and authentication settings with.
poetry config --list
5. Using the pyproject.toml File
[[tool.poetry.source]]
name = "my-private-repo"
url = "https://my-private-repo.example.com/simple"
default = false
When a dependency is added, it will reference the private repository:
[tool.poetry.dependencies]
my-private-package = { version = "^1.0.0", source = "my-private-repo" }
6. Testing Installation
Run the following to verify the setup:
poetry install
Metadata
Release files for poetry-private-repository 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| poetry_private_repository-0.1.0.tar.gz | 1.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| poetry_private_repository-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.5 kB
Release files / poetry_private_repository-0.1.0.tar.gz
| Download URL | poetry_private_repository-0.1.0.tar.gz |
|---|---|
| Size | 1.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b5257d9b1cf01ab204ce56063f27a2e52b90b602986b931399ed6abb1273fc9
|
|
BLAKE2b-256 checksum How to use checksums |
131e8aa6cd456b8be546592c25e92d33739ae808144eeca4d524864ca24d6bd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.11.9 Linux/6.8.0-1017-azure
|
Release files / poetry_private_repository-0.1.0-py3-none-any.whl
| Download URL | poetry_private_repository-0.1.0-py3-none-any.whl |
|---|---|
| Size | 1.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b867c9895e91840ae715fa290ab6fe0a67524a303a2beddaedb6f8a78ce09cda
|
|
BLAKE2b-256 checksum How to use checksums |
d6e4d8475c0e61ffe4fb27ff87c19a18689815aba1c9497a6864e5988e5cac82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.11.9 Linux/6.8.0-1017-azure
|