Configuration
Dataclasses and loading logic for the INI configuration file.
SyncConfig.load() is the main entry point — it reads a config file from disk,
validates permissions, and returns a fully populated SyncConfig instance.
devpi_gitea_sync.config
ConfigError
GiteaConfig
dataclass
Configuration for talking to a Gitea instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL of the Gitea instance. |
required |
verify_ssl
|
bool | str
|
SSL verification: True to verify with default CAs, False to disable, or a path string to a custom CA bundle file. |
True
|
timeout
|
float
|
The timeout for requests to Gitea. |
10.0
|
default_token
|
str | None
|
The default Gitea API token. |
None
|
default_token_env
|
str | None
|
The name of the environment variable containing the default Gitea API token. |
None
|
per_org_tokens
|
dict[str, str]
|
A dictionary of Gitea API tokens per organization. |
dict()
|
per_org_token_env
|
dict[str, str]
|
A dictionary of environment variable names for Gitea API tokens per organization. |
dict()
|
Source code in devpi_gitea_sync/config.py
token_for(organization)
Return the token configured for a given organisation, if any.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
organization
|
str
|
The name of the organization. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The Gitea API token for the organization, or the default token if not found. |
Source code in devpi_gitea_sync/config.py
token_env_for(organization)
Return the environment variable backing the organisation token, if known.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
organization
|
str
|
The name of the organization. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The name of the environment variable for the organization's token, or the default if not found. |
Source code in devpi_gitea_sync/config.py
DevpiServerConfig
dataclass
Configuration for talking to a Devpi server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the Devpi server. |
required |
url
|
str
|
The URL of the Devpi server. |
required |
username
|
str
|
The username for authentication with the Devpi server. |
required |
password
|
str | None
|
The password for authentication with the Devpi server. |
None
|
password_env
|
str | None
|
The name of the environment variable containing the password. |
None
|
token
|
str | None
|
The authentication token for the Devpi server. |
None
|
token_env
|
str | None
|
The name of the environment variable containing the authentication token. |
None
|
verify_ssl
|
bool | str
|
SSL verification: True to verify with default CAs, False to disable, or a path string to a custom CA bundle file. |
True
|
timeout
|
float
|
The timeout for requests to the Devpi server. |
30.0
|
Source code in devpi_gitea_sync/config.py
MappingConfig
dataclass
Represents how a single Gitea org should sync into a Devpi index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the mapping. |
required |
organization
|
str
|
The name of the Gitea organization. |
required |
index
|
str
|
The name of the Devpi index. |
required |
devpi_server
|
str
|
The name of the Devpi server to use. |
'default'
|
repositories
|
list[str] | None
|
A list of repositories to include in the sync. |
None
|
include_archived
|
bool
|
Whether to include archived repositories. |
False
|
gitea_token
|
str | None
|
The Gitea API token for this mapping. |
None
|
gitea_token_env
|
str | None
|
The name of the environment variable containing the Gitea API token. |
None
|
Source code in devpi_gitea_sync/config.py
normalized_repositories()
Return a sorted, de-duplicated repository allowlist.
Returns:
| Type | Description |
|---|---|
list[str] | None
|
A sorted list of repository names, or None if no repositories are specified. |
Source code in devpi_gitea_sync/config.py
SyncConfig
dataclass
Top-level configuration for a sync run.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gitea
|
GiteaConfig
|
The Gitea configuration. |
required |
devpi_servers
|
dict[str, DevpiServerConfig]
|
A dictionary of Devpi server configurations. |
required |
mappings
|
list[MappingConfig]
|
A list of mapping configurations. |
list()
|
poll_interval_seconds
|
int
|
The interval in seconds to poll for changes in server mode. |
300
|
download_dir
|
Path
|
The directory to download release assets to. |
(lambda: Path(gettempdir()) / 'devpi-gitea-sync')()
|
server_host
|
str
|
The host address the web server binds to. |
'0.0.0.0'
|
server_port
|
int
|
The port the web server listens on. |
8080
|
Source code in devpi_gitea_sync/config.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
load(path)
classmethod
Read configuration from an INI/CONF file and instantiate a SyncConfig.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
The path to the configuration file. |
required |
Returns:
| Type | Description |
|---|---|
'SyncConfig'
|
A SyncConfig instance. |
Source code in devpi_gitea_sync/config.py
from_config_parser(parser)
classmethod
Build configuration objects from a ConfigParser instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parser
|
ConfigParser
|
A ConfigParser instance. |
required |
Returns:
| Type | Description |
|---|---|
'SyncConfig'
|
A SyncConfig instance. |
Raises:
| Type | Description |
|---|---|
ConfigError
|
If the configuration is invalid. |
Source code in devpi_gitea_sync/config.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
locate_config_file(explicit_path, search_from=None)
Locate the configuration file using an explicit path or default filenames.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
explicit_path
|
Path | None
|
An explicit path to the configuration file. |
required |
search_from
|
Path | None
|
The directory to search from. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The path to the configuration file. |
Raises:
| Type | Description |
|---|---|
ConfigError
|
If the configuration file cannot be found. |