Migrating from Foundry DevTools v1#
To migrate your config use the following command#
fdt config migrate
This will convert your current v1 config file to the new v2 config format and leave your v1 config file untouched. You can select where you want to save the new config file, as it is now possible to have the config files in different directories, and even system wide configuration.
Project specific configuration.#
fdt config migrate-project
This command is available if you are in a git repository with a project specific configuration.
It will convert it to the v2 format and save it in the .foundry_dev_tools.toml
.
Environment variables#
The env variables are prefixed with FDT_
. For example to set the config option located at credentials.oauth.client_id
, you’d use FDT_CREDENTIALS__OAUTH__CLIENT_ID
.
It will be parsed by first removing the prefix, and then splitting the rest of the string by “__”, this was necessary to allow the usage of nesting in toml and using config options which have underscores in their name.
Take a look at (TODO INSERT LINK HERE)
Configuration via Python#
There also have been some changes, if you configured Foundry DevTools through Python via the Configuration
Singleton. (Configuring the FoundryRestClient has been made backwards compatible)
Take a look at (TODO INSERT LINK HERE)
Config/Cache location#
The cache is located in a directory which depends on the Operating System (we use the platformdirs library for this) e.g. on MacOS ~/Library/Caches/foundry-dev-tools
, Windows: C:\\Users\\trentm\\AppData\\Local\\foundry-dev-tools\\Cache
, Linux: ~/.cache/foundry-dev-tools
The configuration file can be placed at multiple places in the ‘hierarchy’ and will be merged. Run fdt config
on your machine after installing foundry-dev-tools to see the configuration locations.
Locations that can always used, no matter the OS, are ~/.foundry-dev-tools/config.toml
or ~/.config/foundry-dev-tools/config.toml
Transforms#
In v1 the python package foundry-dev-tools
also contained the transforms
python module to run Foundry Transforms locally.
Now it is in a seperate package called foundry-dev-tools-transforms
, this makes it possible to also use Foundry DevTools on Foundry itself by only installing foundry-dev-tools
.
To change your configuration for transforms, you can pass a FoundryContext to the .compute
method of your transform, otherwise transforms will create its own FoundryContext for each invocation of .compute
.
For example:
...
if __name__ == "__main__":
ctx = FoundryContext()
ctx.config.transforms_freeze_cache = True
my_compute_function.compute(ctx)
Compatibility#
FoundryRestClient
and CachedFoundryClient
are still included, and are wrappers around the new v2 clients.
We tried to keep both compatible with the v1
implementation.
Though the v2 is only compatible with Python 3.10 upwards.
Recommendations for v2#
The fdt config
command lets you check your current configuration.
The fdt config edit
command lets you easily open your configuration in your default editor.
The fdt info
command checks if your environment is correctly set up.
We also provide a git-credential helper for foundry, this authenticates you to foundry when using git, which eliminates the need to have your token and username stored in every git repository you clone.
After installing Foundry DevTools, run git-credential-foundry
which will show you the needed steps to set it up.
As the FoundryContext
loads your configuration when creating a new Instance as the client instances are also cached per FoundryContext instance, it is recommend to only use one FoundryContext in your code.
The v2 is extensible, this way you can create your own Foundry clients and Token Providers easily as if they were integrated into Foundry DevTools.