-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show 'What's New' popup on first start after upgrade to a new version (…
…#895) ## Changes * Show "What's New" popup on the first start after upgrade to a new version of the extension. * The popup is only shown on upgrades. * Custom markdown file is used when * There is a major/minor version bump. **Not for patch version bumps** * A custom markdown files exists in `resources/whats-new/<major>.<minor>.md` format. * CHANGELOG.md is shown if custom markdown file can't be shown. This is shown even for patch releases. ## Tests * manual https://github.com/databricks/databricks-vscode/assets/88345179/21b9dc9a-a9c2-498d-a96e-2c22427763b7 --------- Co-authored-by: PaulCornellDB <[email protected]>
- Loading branch information
1 parent
ab06f56
commit c89658f
Showing
12 changed files
with
221 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<img src="../../images/databricks-logo.png" alt="databricks-logo" width="100"/> | ||
|
||
# Databricks Extension v1.2.0 | ||
|
||
## What's new? | ||
|
||
- [📗 Advanced notebook support with Databricks Connect](#dbconnect-notebook) | ||
|
||
## <a id="dbconnect-notebook"></a> Advanced notebook support with Databricks Connect | ||
|
||
Before this update, you could already run notebooks locally with Databricks Connect. This update introduces advanced notebook support. This advanced support enables you to run notebooks locally with a similar experience as you have by running them on a Databricks cluster. The goal of this update is to bring much of the convenience of running notebooks on a Databricks cluster to your local development environment. | ||
|
||
This update includes: | ||
|
||
- [Magic commands such as `%run` and `%sql`](#magic-commands) | ||
- [Preconfigured globals such as `spark` and `dbutils`](#preconf-globals) | ||
- [Interactive widgets through `dbutils.widgets`](#widgets) | ||
- [Support for Databricks notebooks](#dbnb) | ||
|
||
### <a id="magic-command"></a>Magic commands | ||
|
||
You can now use Databricks magic commands locally from your notebooks. | ||
|
||
<img src="./1.2/magic_sql.gif" alt="magic_sql" width="600"/> | ||
|
||
### <a id="preconf-globals"></a>Preconfigured globals | ||
|
||
Just like on a Databricks cluster, this update configures and provides you with some globals such as `spark` and `dbutils` when you run notebooks locally. | ||
|
||
<img src="./1.2/preconf_globals.gif" alt="preconf_globals" width="600"/> | ||
|
||
### <a id="widgets"></a>Interactive `dbutils.widgets` | ||
|
||
You can now use `dbutils.widgets` to create interactive widgets in your local notebooks. | ||
|
||
<img src="./1.2/widgets.gif" alt="widgets" width="600"/> | ||
|
||
### <a id="dbnb"></a>Support for Databricks notebooks | ||
|
||
You can use Databricks notebooks locally with [VS Code Interactive Windows](https://code.visualstudio.com/docs/python/jupyter-support-py). | ||
|
||
<img src="./1.2/dbnb.gif" alt="dbnb" width="600"/> | ||
|
||
### Further details | ||
|
||
For a detailed documentation of this feature, see [Use notebooks with Databricks Connect](https://docs.databricks.com/en/dev-tools/vscode-ext/dev-tasks/notebooks.html). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+527 KB
packages/databricks-vscode/resources/whats-new/1.2/preconf_globals.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import {expect} from "chai"; | ||
import {findFileFowWhatsNew} from "./whatsNewPopup"; | ||
import {SemVer} from "semver"; | ||
import * as tmp from "tmp"; | ||
import path from "path"; | ||
import {mkdir, writeFile} from "fs/promises"; | ||
|
||
describe(__filename, () => { | ||
let context: any; | ||
let removeCallback: () => void; | ||
let dirname: string; | ||
|
||
before(async () => { | ||
({name: dirname, removeCallback} = tmp.dirSync({unsafeCleanup: true})); | ||
context = { | ||
asAbsolutePath: (ip: string) => path.join(dirname, ip), | ||
} as any; | ||
|
||
await mkdir(path.join(dirname, "resources", "whats-new"), { | ||
recursive: true, | ||
}); | ||
await writeFile( | ||
path.join(dirname, "resources", "whats-new", "1.2.md"), | ||
"" | ||
); | ||
}); | ||
|
||
after(() => { | ||
removeCallback(); | ||
}); | ||
|
||
it("should use CHANGELOG.md for patch version upgrade", async () => { | ||
const previousVersion = new SemVer("1.2.1"); | ||
const currentVersion = new SemVer("1.2.2"); | ||
expect( | ||
await findFileFowWhatsNew(context, previousVersion, currentVersion) | ||
).to.equal(path.join(dirname, "CHANGELOG.md")); | ||
}); | ||
|
||
it("should use custom markdown file for minor version upgrade", async () => { | ||
const previousVersion = new SemVer("1.1.2"); | ||
const currentVersion = new SemVer("1.2.3"); | ||
expect( | ||
await findFileFowWhatsNew(context, previousVersion, currentVersion) | ||
).to.equal(path.join(dirname, "resources", "whats-new", "1.2.md")); | ||
}); | ||
|
||
it("should use custom markdown file for major version upgrade", async () => { | ||
const previousVersion = new SemVer("0.1.2"); | ||
const currentVersion = new SemVer("1.2.3"); | ||
expect( | ||
await findFileFowWhatsNew(context, previousVersion, currentVersion) | ||
).to.equal(path.join(dirname, "resources", "whats-new", "1.2.md")); | ||
}); | ||
|
||
it("should use CHANGELOG.md if custom markdown file does not exist", async () => { | ||
const previousVersion = new SemVer("1.1.2"); | ||
const currentVersion = new SemVer("1.3.3"); | ||
expect( | ||
await findFileFowWhatsNew(context, previousVersion, currentVersion) | ||
).to.equal(path.join(dirname, "CHANGELOG.md")); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import {ExtensionContext, Uri, commands, window} from "vscode"; | ||
import {PackageJsonUtils} from "./utils"; | ||
import {StateStorage} from "./vscode-objs/StateStorage"; | ||
import path from "path"; | ||
import {exists} from "fs-extra"; | ||
import * as semver from "semver"; | ||
|
||
export async function findFileFowWhatsNew( | ||
context: ExtensionContext, | ||
previousVersion: semver.SemVer, | ||
currentVersion: semver.SemVer | ||
) { | ||
const markdownFile = context.asAbsolutePath( | ||
path.join( | ||
"resources", | ||
"whats-new", | ||
`${currentVersion.major}.${currentVersion.minor}.md` | ||
) | ||
); | ||
|
||
// To maintain release discipline (prevent too big changes from being released in a patch version) | ||
// we explicitly do not show the custom message popup for patch versions upgrades. | ||
currentVersion.patch = 0; | ||
previousVersion.patch = 0; | ||
|
||
if ( | ||
semver.compare(currentVersion, previousVersion) > 0 && | ||
(await exists(markdownFile)) | ||
) { | ||
return markdownFile; | ||
} | ||
|
||
return context.asAbsolutePath("CHANGELOG.md"); | ||
} | ||
|
||
export async function showWhatsNewPopup( | ||
context: ExtensionContext, | ||
storage: StateStorage | ||
) { | ||
const packageJsonMetadata = await PackageJsonUtils.getMetadata(context); | ||
const currentVersion = semver.parse(packageJsonMetadata.version); | ||
if (currentVersion === null) { | ||
return; | ||
} | ||
|
||
const previousVersion = | ||
semver.parse(storage.lastInstalledExtensionVersion) ?? | ||
new semver.SemVer("0.0.0"); | ||
|
||
// if the extension is downgraded, we do not want to show the popup | ||
if (semver.compare(currentVersion, previousVersion) <= 0) { | ||
return; | ||
} | ||
|
||
// We try to find a custom markdown file for the current version, | ||
// if not found, we use the changelog.md in its entirety. | ||
const markdownFile = await findFileFowWhatsNew( | ||
context, | ||
previousVersion, | ||
currentVersion | ||
); | ||
|
||
if (window.state.focused) { | ||
commands.executeCommand("markdown.showPreview", Uri.file(markdownFile)); | ||
return; | ||
} | ||
|
||
const listener = window.onDidChangeWindowState((e) => { | ||
if (!e.focused) { | ||
return; | ||
} | ||
commands.executeCommand("markdown.showPreview", Uri.file(markdownFile)); | ||
listener.dispose(); | ||
}); | ||
context.subscriptions.push(listener); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters