Skip to content

Commit

Permalink
Merge branch 'develop' into tim/FormProto
Browse files Browse the repository at this point in the history
* develop:
  Extract st.container, columns, container out of delta_generator.py (streamlit#2487)
  Remove the unused variables inside protos (streamlit#2486)
  Stop running cypress-flaky-approval for each PR (streamlit#2490)
  Dynamically import git, and fail gracefully if missing (streamlit#2482)
  Bump React to 17.0.1 (streamlit#2453)
  Fix emojis (streamlit#2480)
  Add missing copyright headers (streamlit#2478)
  Stop requiring watchdog when installing Streamlit on Macs (streamlit#2470)
  Minor tweak to PyArrow warning message (streamlit#2472)
  Use a set literal (streamlit#2476)
  Add type annotations to DeltaGenerator mixins (streamlit#2475)
  Update change log
  Up version to 0.73.0
  Don't require pyarrow on 3.9, and show a warning on custom components (streamlit#2452)
  • Loading branch information
tconkling committed Dec 21, 2020
2 parents 51e10d7 + a03d3b9 commit 7704f36
Show file tree
Hide file tree
Showing 57 changed files with 1,344 additions and 474 deletions.
19 changes: 10 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,16 @@ workflows:
only: /^([0-9]+\.){3}dev[0-9]+/
branches:
ignore: /.*/
- cypress-flaky-approval:
type: approval
requires:
- python-3-8
- cypress: # Flaky Cypress tests
name: cypress-flaky
flaky: true
requires:
- cypress-flaky-approval
# Uncomment to get a button that runs flaky tests on CircleCI:
# - cypress-flaky-approval:
# type: approval
# requires:
# - python-3-8
# - cypress: # Flaky Cypress tests
# name: cypress-flaky
# flaky: true
# requires:
# - cypress-flaky-approval

create-nightly-tag:
triggers:
Expand Down
160 changes: 158 additions & 2 deletions NOTICES

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ This page lists highlights, bug fixes, and known issues for official Streamlit r
$ pip install --upgrade streamlit
```

## Version 0.73.0

_Release date: December 17, 2020_

**Notable Changes**

- 🐍 Streamlit can now be installed on Python 3.9. Streamlit components are not
yet compatible with Python 3.9 and must use version 3.8 or earlier.
- 🧱 Streamlit Components now allows same origin, enabling features provided by
the browser such as a webcam component.
- 🐙 Fix Streamlit Share deploy experience for users running on Git versions
2.7.0 or earlier.
- 🧰 Handle unexpected closing of uploaded files for [`st.file_uploader`](https://docs.streamlit.io/en/0.72.0/api.html#streamlit.file_uploader).

## Version 0.72.0

_Release date: December 2, 2020_
Expand Down
2 changes: 1 addition & 1 deletion docs/troubleshooting/sanity-checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pip install --upgrade streamlit
streamlit version
```

...and then verify that the version number printed is `0.72.0`.
...and then verify that the version number printed is `0.73.0`.

**Try reproducing the issue now.** If not fixed, keep reading on.

Expand Down
12 changes: 6 additions & 6 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "streamlit-browser",
"version": "0.72.0",
"version": "0.73.0",
"private": true,
"homepage": "./",
"scripts": {
Expand Down Expand Up @@ -72,10 +72,10 @@
"prismjs": "^1.21.0",
"protobufjs": "^6.10.1",
"query-string": "^6.13.1",
"react": "^16.13.1",
"react": "^17.0.1",
"react-color": "^2.18.1",
"react-debounce-render": "^7.0.0",
"react-dom": "^16.13.1",
"react-dom": "^17.0.1",
"react-dropzone": "^11.2.0",
"react-feather": "^2.0.8",
"react-google-login": "^5.1.21",
Expand Down Expand Up @@ -110,7 +110,7 @@
"@types/d3-graphviz": "^2.6.3",
"@types/dom-mediacapture-record": "^1.0.7",
"@types/dompurify": "^2.0.3",
"@types/enzyme": "^3.10.5",
"@types/enzyme": "^3.10.8",
"@types/fetch-mock": "^7.3.2",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/jest": "^24.0.11",
Expand Down Expand Up @@ -139,14 +139,14 @@
"@types/xxhashjs": "^0.2.2",
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"@wojtekmaj/enzyme-adapter-react-17": "^0.3.2",
"axios-mock-adapter": "^1.18.2",
"babel-plugin-emotion": "^10.0.33",
"cypress": "^5.5.0",
"cypress-file-upload": "^4.1.1",
"cypress-image-snapshot": "^3.1.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.3",
"enzyme-to-json": "^3.5.0",
"enzyme-to-json": "^3.6.1",
"eslint-config-airbnb-typescript": "^9.0.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ exports[`App renders without crashing 1`] = `
content={
Object {
"$$typeof": Symbol(react.forward_ref),
"displayName": "Menu",
"render": [Function],
}
}
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/components/elements/Favicon/Favicon.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ function getFaviconHref(): string {
document.head.innerHTML = `<link rel="shortcut icon" href="default.png">`

const PIZZA_TWEMOJI_URL = "https://twemoji.maxcdn.com/2/72x72/1f355.png"
const SATELLITE_TWEMOJI_URL = "https://twemoji.maxcdn.com/2/72x72/1f6f0.png"
const CRESCENT_MOON_TWEMOJI_URL =
"https://twemoji.maxcdn.com/2/72x72/1f319.png"

test("is set up with the default favicon", () => {
expect(getFaviconHref()).toBe("http://localhost/default.png")
Expand All @@ -48,6 +51,16 @@ describe("Favicon element", () => {
expect(getFaviconHref()).toBe(PIZZA_TWEMOJI_URL)
})

it("should handle emoji variants correctly", () => {
handleFavicon("🛰")
expect(getFaviconHref()).toBe(SATELLITE_TWEMOJI_URL)
})

it("should handle emoji shortcodes containing a dash correctly", () => {
handleFavicon(":crescent-moon:")
expect(getFaviconHref()).toBe(CRESCENT_MOON_TWEMOJI_URL)
})

it("should accept emoji shortcodes", () => {
handleFavicon(":pizza:")
expect(getFaviconHref()).toBe(PIZZA_TWEMOJI_URL)
Expand Down
9 changes: 5 additions & 4 deletions frontend/src/components/elements/Favicon/Favicon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import nodeEmoji from "node-emoji"
import { buildMediaUri } from "lib/UriUtil"
import { toCodePoint } from "vendor/twemoji"
import { grabTheRightIcon } from "vendor/twemoji"
import { sendS4AMessage } from "hocs/withS4ACommunication/withS4ACommunication"

/**
Expand All @@ -32,7 +32,7 @@ export function handleFavicon(favicon: string): void {

if (emoji) {
// Find the corresponding Twitter emoji on the CDN.
const codepoint = toCodePoint(emoji)
const codepoint = grabTheRightIcon(emoji)
const emojiUrl = `https://twemoji.maxcdn.com/2/72x72/${codepoint}.png`

imageUrl = emojiUrl
Expand Down Expand Up @@ -61,10 +61,11 @@ function overwriteFavicon(imageUrl: string): void {

// Return the emoji if it exists, or empty string otherwise
function extractEmoji(maybeEmoji: string): string {
if (nodeEmoji.hasEmoji(nodeEmoji.get(maybeEmoji))) {
const shortcode = maybeEmoji.replace("-", "_")
if (nodeEmoji.hasEmoji(nodeEmoji.get(shortcode))) {
// Format: pizza or :pizza:
// Since hasEmoji(':pizza:') == true, we must do this check first
return nodeEmoji.get(maybeEmoji)
return nodeEmoji.get(shortcode)
}
if (nodeEmoji.hasEmoji(maybeEmoji)) {
// Format: 🍕
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/setupTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
// This file is only used in tests, so these imports can be in devDependencies
/* eslint-disable import/no-extraneous-dependencies */
import { configure } from "enzyme"
import Adapter from "enzyme-adapter-react-16"
import Adapter from "@wojtekmaj/enzyme-adapter-react-17"

configure({ adapter: new Adapter() })
17 changes: 15 additions & 2 deletions frontend/src/vendor/twemoji.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* eslint-disable */
// We only need this one function of Twemoji to locate the CDN emoji image,
// so we copy it instead of importing the whole library.

// We only need a few functions of Twemoji to locate the CDN emoji image,
// so we copy them instead of importing the whole library.

// https://github.com/twitter/twemoji/blob/42f8843cb3aa1f9403d5479d7e3f7e01176ad08e/scripts/build.js#L571
export function toCodePoint(unicodeSurrogates: string, sep?: string): string {
const r = []
Expand All @@ -20,3 +22,14 @@ export function toCodePoint(unicodeSurrogates: string, sep?: string): string {
}
return r.join(sep || "-")
}

// https://github.com/twitter/twemoji/blob/42f8843cb3aa1f9403d5479d7e3f7e01176ad08e/scripts/build.js#L255
const UFE0Fg = /\uFE0F/g
const U200D = String.fromCharCode(0x200d)

// https://github.com/twitter/twemoji/blob/42f8843cb3aa1f9403d5479d7e3f7e01176ad08e/scripts/build.js#L344
export function grabTheRightIcon(rawText: string) {
return toCodePoint(
rawText.indexOf(U200D) < 0 ? rawText.replace(UFE0Fg, "") : rawText
)
}
Loading

0 comments on commit 7704f36

Please sign in to comment.