Skip to content

Commit a8af203

Browse files
committed
linting
1 parent 4923b20 commit a8af203

File tree

6 files changed

+118
-83
lines changed

6 files changed

+118
-83
lines changed

.pre-commit-config.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
repos:
2+
- repo: https://github.com/asottile/blacken-docs
3+
rev: v1.12.0
4+
hooks:
5+
- id: blacken-docs
6+
additional_dependencies: [black==21.12b0]
7+
args: ["-l 79"]
8+
exclude: index.umd.js
9+
- repo: https://github.com/ambv/black
10+
rev: 22.3.0
11+
hooks:
12+
- id: black
13+
language_version: python3
14+
args: ["-l 79"]
15+
exclude: index.umd.js
16+
- repo: local
17+
hooks:
18+
- id: pylint
19+
name: pylint
20+
language: system
21+
files: \.py$
22+
entry: pylint
23+
args: ["--errors-only"]
24+
exclude: index.umd.js
25+
- repo: local
26+
hooks:
27+
- id: ipynb-strip
28+
name: ipynb-strip
29+
language: system
30+
files: \.ipynb$
31+
entry: jupyter nbconvert --clear-output --ClearOutputPreprocessor.enabled=True
32+
args: ["--log-level=ERROR"]
33+
- repo: https://github.com/pre-commit/mirrors-prettier
34+
rev: v2.6.2
35+
hooks:
36+
- id: prettier
37+
exclude: index.umd.js
38+
language_version: system

__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def get_candidate_experiments(dataset):
1919
for exp in all_experiments:
2020
if "dataset" not in exp.tags:
2121
continue
22-
if exp.tags['dataset'] == name:
22+
if exp.tags["dataset"] == name:
2323
experiment_names_and_ids.append((exp.experiment_id, exp.name))
2424
return experiment_names_and_ids
2525

@@ -54,7 +54,5 @@ def execute(self, ctx):
5454
)
5555

5656

57-
58-
5957
def register(p):
6058
p.register(OpenMLFlowPanel)

fiftyone.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ fiftyone:
66
license: Apache 2.0
77
url: "https://github.com/jacobmarks/fiftyone_mlflow_plugin"
88
operators:
9-
- open_mlflow_panel
9+
- open_mlflow_panel

package.json

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
{
2-
"name": "@jacobmarks/mlflow",
3-
"version": "1.0.0",
4-
"main": "src/MLFlow.tsx",
5-
"license": "MIT",
6-
"fiftyone": {
7-
"script": "dist/index.umd.js"
8-
},
9-
"scripts": {
10-
"dev": "IS_DEV=true && nodemon --watch ./src --ext js,jsx,ts,tsx --exec 'yarn build'",
11-
"build": "vite build",
12-
"archive": "./scripts/archive.sh",
13-
"bump": "python ./scripts/update_version.py bump",
14-
"release": "./scripts/release.sh"
15-
},
16-
"dependencies": {
17-
"@emotion/react": "^11.11.0",
18-
"@emotion/styled": "^11.11.0",
19-
"@mui/icons-material": "^5.11.16",
20-
"@mui/material": "^5.13.0",
21-
"@mui/styled-engine": "^5.12.3",
22-
"@rollup/plugin-node-resolve": "^15.0.2",
23-
"@vitejs/plugin-react": "^4.0.0",
24-
"lodash": "^4.17.21",
25-
"nodemon": "^2.0.19",
26-
"react": "^18.2.0",
27-
"react-is": "^18.2.0",
28-
"react-markdown": "^8.0.7",
29-
"styled-components": "^5.3.10",
30-
"vite-plugin-externals": "^0.6.2"
31-
},
32-
"devDependencies": {
33-
"vite": "^3.2.4"
34-
},
35-
"packageManager": "[email protected]"
36-
}
2+
"name": "@jacobmarks/mlflow",
3+
"version": "1.0.0",
4+
"main": "src/MLFlow.tsx",
5+
"license": "MIT",
6+
"fiftyone": {
7+
"script": "dist/index.umd.js"
8+
},
9+
"scripts": {
10+
"dev": "IS_DEV=true && nodemon --watch ./src --ext js,jsx,ts,tsx --exec 'yarn build'",
11+
"build": "vite build",
12+
"archive": "./scripts/archive.sh",
13+
"bump": "python ./scripts/update_version.py bump",
14+
"release": "./scripts/release.sh"
15+
},
16+
"dependencies": {
17+
"@emotion/react": "^11.11.0",
18+
"@emotion/styled": "^11.11.0",
19+
"@mui/icons-material": "^5.11.16",
20+
"@mui/material": "^5.13.0",
21+
"@mui/styled-engine": "^5.12.3",
22+
"@rollup/plugin-node-resolve": "^15.0.2",
23+
"@vitejs/plugin-react": "^4.0.0",
24+
"lodash": "^4.17.21",
25+
"nodemon": "^2.0.19",
26+
"react": "^18.2.0",
27+
"react-is": "^18.2.0",
28+
"react-markdown": "^8.0.7",
29+
"styled-components": "^5.3.10",
30+
"vite-plugin-externals": "^0.6.2"
31+
},
32+
"devDependencies": {
33+
"vite": "^3.2.4"
34+
},
35+
"packageManager": "[email protected]"
36+
}

src/MLFlow.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { registerComponent, PluginComponentType } from "@fiftyone/plugins";
2-
import React, { useState, useEffect } from 'react';
2+
import React, { useState, useEffect } from "react";
33
import { useRecoilValue } from "recoil";
44
import * as fos from "@fiftyone/state";
5-
import { Box, TextField, Button } from '@mui/material';
5+
import { Box, TextField, Button } from "@mui/material";
66

77
export const MLFlowIcon = ({ size = "1rem", style = {} }) => {
88
return (
@@ -28,7 +28,7 @@ export const MLFlowIcon = ({ size = "1rem", style = {} }) => {
2828
cx="5"
2929
cy="5"
3030
r="4"
31-
style={{ stroke: 'none' }}
31+
style={{ stroke: "none" }}
3232
></circle>
3333
</pattern>
3434
</defs>
@@ -49,7 +49,7 @@ function useServerAvailability(defaultUrl) {
4949
const [url, setUrl] = useState(defaultUrl);
5050

5151
useEffect(() => {
52-
fetch(url, { mode: 'no-cors' })
52+
fetch(url, { mode: "no-cors" })
5353
.then(() => setServerAvailable(true))
5454
.catch(() => setServerAvailable(false));
5555
}, [url]);
@@ -94,10 +94,10 @@ const URLInputForm = ({ onSubmit }) => {
9494
);
9595
};
9696

97-
9897
export default function MLFlowPanel() {
9998
const defaultUrl = "http://127.0.0.1:8080";
100-
const { serverAvailable, setServerAvailable, url, setUrl } = useServerAvailability(defaultUrl);
99+
const { serverAvailable, setServerAvailable, url, setUrl } =
100+
useServerAvailability(defaultUrl);
101101

102102
const handleUpdateUrl = (newUrl) => {
103103
setUrl(newUrl);
@@ -107,7 +107,6 @@ export default function MLFlowPanel() {
107107
console.log(datasetName);
108108
// Use this dataset name to get candidate experiment urls...
109109

110-
111110
return (
112111
<Box
113112
sx={{
@@ -132,7 +131,6 @@ export default function MLFlowPanel() {
132131
);
133132
}
134133

135-
136134
registerComponent({
137135
name: "MLFlowPanel",
138136
label: "MLFlow Dashboard",

vite.config.js

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,67 @@
1-
const defineViteConfig = require('vite').defineConfig
2-
const react = require('@vitejs/plugin-react').default
3-
const nodeResolve = require('@rollup/plugin-node-resolve').default
4-
const path = require('path')
5-
const viteExternalsPlugin = require('vite-plugin-externals').viteExternalsPlugin
6-
const { FIFTYONE_DIR } = process.env
7-
const dir = __dirname
8-
const IS_DEV = process.env.IS_DEV === 'true'
1+
const defineViteConfig = require("vite").defineConfig;
2+
const react = require("@vitejs/plugin-react").default;
3+
const nodeResolve = require("@rollup/plugin-node-resolve").default;
4+
const path = require("path");
5+
const viteExternalsPlugin =
6+
require("vite-plugin-externals").viteExternalsPlugin;
7+
const { FIFTYONE_DIR } = process.env;
8+
const dir = __dirname;
9+
const IS_DEV = process.env.IS_DEV === "true";
910

1011
function fiftyonePlugin() {
1112
if (!FIFTYONE_DIR) {
1213
throw new Error(
1314
`FIFTYONE_DIR environment variable not set. This is required to resolve @fiftyone/* imports.`
14-
)
15+
);
1516
}
1617

1718
return {
18-
name: 'fiftyone-rollup',
19+
name: "fiftyone-rollup",
1920
resolveId: {
20-
order: 'pre',
21+
order: "pre",
2122
async handler(source) {
22-
if (source.startsWith('@fiftyone')) {
23-
const pkg = source.split('/')[1]
24-
const modulePath = `${FIFTYONE_DIR}/app/packages/${pkg}`
25-
return this.resolve(modulePath, source, { skipSelf: true })
23+
if (source.startsWith("@fiftyone")) {
24+
const pkg = source.split("/")[1];
25+
const modulePath = `${FIFTYONE_DIR}/app/packages/${pkg}`;
26+
return this.resolve(modulePath, source, { skipSelf: true });
2627
}
27-
return null
28-
}
29-
}
30-
}
28+
return null;
29+
},
30+
},
31+
};
3132
}
3233

33-
const package = require(`${dir}/package.json`)
34+
const package = require(`${dir}/package.json`);
3435
module.exports = defineViteConfig({
35-
mode: 'development',
36+
mode: "development",
3637
plugins: [
3738
fiftyonePlugin(),
3839
nodeResolve(),
3940
react(),
4041
viteExternalsPlugin({
41-
react: 'React',
42-
'react-dom': 'ReactDOM',
43-
recoil: 'recoil',
44-
'@fiftyone/state': '__fos__',
45-
'@fiftyone/operators': '__foo__',
46-
'@fiftyone/components': '__foc__',
47-
'@fiftyone/utilities': '__fou__',
48-
'@mui/material': '__mui__' // use mui from fiftyone
49-
})
42+
react: "React",
43+
"react-dom": "ReactDOM",
44+
recoil: "recoil",
45+
"@fiftyone/state": "__fos__",
46+
"@fiftyone/operators": "__foo__",
47+
"@fiftyone/components": "__foc__",
48+
"@fiftyone/utilities": "__fou__",
49+
"@mui/material": "__mui__", // use mui from fiftyone
50+
}),
5051
],
5152
build: {
5253
minify: IS_DEV ? false : true,
5354
lib: {
5455
entry: path.join(dir, package.main),
5556
name: package.name,
5657
fileName: (format) => `index.${format}.js`,
57-
formats: ['umd']
58-
}
58+
formats: ["umd"],
59+
},
5960
},
6061
define: {
61-
'process.env.NODE_ENV': '"development"'
62+
"process.env.NODE_ENV": '"development"',
6263
},
6364
optimizeDeps: {
64-
exclude: ['react', 'react-dom']
65-
}
66-
})
65+
exclude: ["react", "react-dom"],
66+
},
67+
});

0 commit comments

Comments
 (0)