Footing Package
footing.setup
Creates and initializes a project from a template.
footing.setup.setup
Sets up a new project from a template
Note that the footing.constants.FOOTING_ENV_VAR
is set to 'setup' during the duration
of this function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
template |
str
|
The git path to a template |
required |
version |
str | None
|
The version of the template to use when updating. Defaults to the latest version |
None
|
Source code in footing/setup.py
footing.update
Updates a footing project with the latest template.
footing.update.up_to_date
Checks if a footing project is up to date with the repo
Note that the footing.constants.FOOTING_ENV_VAR
is set to 'update' for the duration of this
function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
version |
str | None
|
Update against this git SHA or branch of the template |
None
|
Returns:
Type | Description |
---|---|
bool
|
True if up to date with |
Raises:
Type | Description |
---|---|
`NotInGitRepoError`
|
When running outside of a git repo |
`InvalidFootingProjectError`
|
When not inside a valid footing repository |
Source code in footing/update.py
footing.update.update
update(
old_template: str | None = None,
old_version: str | None = None,
new_template: str | None = None,
new_version: str | None = None,
enter_parameters: bool = False,
) -> bool
Updates the footing project to the latest template
Proceeeds in the following steps:
- Ensure we are inside the project repository
- Obtain the latest version of the package template
- If the package is up to date with the latest template, return
- If not, create an empty template branch with a new copy of the old template
- Create an update branch from HEAD and merge in the new template copy
- Create a new copy of the new template and merge into the empty template branch
- Merge the updated empty template branch into the update branch
- Ensure footing.yaml reflects what is in the template branch
- Remove the empty template branch
Note that the footing.constants.FOOTING_ENV_VAR
is set to 'update' for the
duration of this function.
Two branches will be created during the update process, one named
_footing_update
and one named _footing_update_temp
. At the end of
the process, _footing_update_temp
will be removed automatically. The
work will be left in _footing_update
in an uncommitted state for
review. The update will fail early if either of these branches exist
before the process starts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
old_template |
str | None
|
The old template from which to update. Defaults to the template in footing.yaml. |
None
|
old_version |
str | None
|
The old version of the template. Defaults to the version in footing.yaml. |
None
|
new_template |
str | None
|
The new template for updating. Defaults to the template in footing.yaml |
None
|
new_version |
str | None
|
The new version of the new template to update. Defaults to the latest version of the new template. |
None
|
enter_parameters |
bool
|
Force entering template parameters for the project |
False
|
Raises:
Type | Description |
---|---|
`NotInGitRepoError`
|
When not inside of a git repository |
`InvalidFootingProjectError`
|
When not inside a valid footing repository |
`InDirtyRepoError`
|
When an update is triggered while the repo is in a dirty state |
`ExistingBranchError`
|
When an update is triggered and there is an existing update branch |
Returns:
Type | Description |
---|---|
bool
|
True if update was performed or False if template was already up to date |
Source code in footing/update.py
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 274 275 276 277 278 279 280 281 282 283 284 285 286 |
|
footing.ls
Lists all footing templates and projects spun up with those templates.
footing.ls.ls
Lists all templates under a root path or list all projects spun up under a root path and a template path.
The root
path must be either a Github organization/user (e.g. github.com/organization)
or a Gitlab group (e.g. gitlab.com/my/group).
Note that the footing.constants.FOOTING_ENV_VAR
is set to 'ls' for the duration of this
function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
forge |
str
|
A root git storage path. For example, a Github organization (github.com/Organization) or a gitlab group (gitlab.com/my/group). |
required |
template |
str | None
|
An optional template path. If provided, the
returned values are projects under |
None
|
Returns:
Type | Description |
---|---|
dict[str, str]
|
xA dictionary of repository information keyed on the url. |
Raises:
Type | Description |
---|---|
`InvalidForgeError`
|
When |
Source code in footing/ls.py
footing.constants
Constants for footing.
footing.exceptions
Footing exceptions.
footing.exceptions.CheckRunError
Bases: Error
When running footing update --check
errors
footing.exceptions.Error
Bases: Exception
The top-level error for footing
footing.exceptions.ExistingBranchError
Bases: Error
Thrown when a specifically named branch exists or doesn't exist as expected.
footing.exceptions.InDirtyRepoError
Bases: Error
Thrown when running in a dirty git repo
footing.exceptions.InGitRepoError
Bases: Error
Thrown when running inside of a git repository
footing.exceptions.InvalidCurrentBranchError
Bases: Error
Thrown when a command cannot run because of the current git branch
footing.exceptions.InvalidEnvironmentError
Bases: Error
Thrown when required environment variables are not set
footing.exceptions.InvalidFootingProjectError
Bases: Error
Thrown when the repository was not created with footing
footing.exceptions.InvalidForgeError
Bases: Error
An invalid forge was passed to ls.
footing.exceptions.InvalidGitlabGroupError
Bases: Error
Thrown when an invalid Gitlab group is provided
footing.exceptions.InvalidTemplatePathError
Bases: Error
Thrown when a template path is not a Github SSH path
footing.exceptions.NotInGitRepoError
Bases: Error
Thrown when not running inside of a git repo
footing.exceptions.NotUpToDateWithTemplateError
Bases: Error
Thrown when a footing project is not up to date with the template