|
| 1 | +--- |
| 2 | +date: "2022-12-28T00:00:00+00:00" |
| 3 | +title: "Conda Packages Repository" |
| 4 | +slug: "packages/conda" |
| 5 | +draft: false |
| 6 | +toc: false |
| 7 | +menu: |
| 8 | + sidebar: |
| 9 | + parent: "packages" |
| 10 | + name: "Conda" |
| 11 | + weight: 25 |
| 12 | + identifier: "conda" |
| 13 | +--- |
| 14 | + |
| 15 | +# Conda Packages Repository |
| 16 | + |
| 17 | +Publish [Conda](https://docs.conda.io/en/latest/) packages for your user or organization. |
| 18 | + |
| 19 | +**Table of Contents** |
| 20 | + |
| 21 | +{{< toc >}} |
| 22 | + |
| 23 | +## Requirements |
| 24 | + |
| 25 | +To work with the Conda package registry, you need to use [conda](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html). |
| 26 | + |
| 27 | +## Configuring the package registry |
| 28 | + |
| 29 | +To register the package registry and provide credentials, edit your `.condarc` file: |
| 30 | + |
| 31 | +```yaml |
| 32 | +channel_alias: https://gitea.example.com/api/packages/{owner}/conda |
| 33 | +channels: |
| 34 | + - https://gitea.example.com/api/packages/{owner}/conda |
| 35 | +default_channels: |
| 36 | + - https://gitea.example.com/api/packages/{owner}/conda |
| 37 | +``` |
| 38 | +
|
| 39 | +| Placeholder | Description | |
| 40 | +| ------------ | ----------- | |
| 41 | +| `owner` | The owner of the package. | |
| 42 | + |
| 43 | +See the [official documentation](https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html) for explanations of the individual settings. |
| 44 | + |
| 45 | +If you need to provide credentials, you may embed them as part of the channel url (`https://user:password@gitea.example.com/...`). |
| 46 | + |
| 47 | +## Publish a package |
| 48 | + |
| 49 | +To publish a package, perform a HTTP PUT operation with the package content in the request body. |
| 50 | + |
| 51 | +``` |
| 52 | +PUT https://gitea.example.com/api/packages/{owner}/conda/{channel}/{filename} |
| 53 | +``` |
| 54 | +
|
| 55 | +| Placeholder | Description | |
| 56 | +| ------------ | ----------- | |
| 57 | +| `owner` | The owner of the package. | |
| 58 | +| `channel` | The [channel](https://conda.io/projects/conda/en/latest/user-guide/concepts/channels.html) of the package. (optional) | |
| 59 | +| `filename` | The name of the file. | |
| 60 | +
|
| 61 | +Example request using HTTP Basic authentication: |
| 62 | +
|
| 63 | +```shell |
| 64 | +curl --user your_username:your_password_or_token \ |
| 65 | + --upload-file path/to/package-1.0.conda \ |
| 66 | + https://gitea.example.com/api/packages/testuser/conda/package-1.0.conda |
| 67 | +``` |
| 68 | + |
| 69 | +You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. |
| 70 | + |
| 71 | +## Install a package |
| 72 | + |
| 73 | +To install a package from the package registry, execute one of the following commands: |
| 74 | + |
| 75 | +```shell |
| 76 | +conda install {package_name} |
| 77 | +conda install {package_name}={package_version} |
| 78 | +conda install -c {channel} {package_name} |
| 79 | +``` |
| 80 | + |
| 81 | +| Parameter | Description | |
| 82 | +| ----------------- | ----------- | |
| 83 | +| `package_name` | The package name. | |
| 84 | +| `package_version` | The package version. | |
| 85 | +| `channel` | The channel of the package. (optional) | |
0 commit comments