Skip to content

Commit 34fde0a

Browse files
mcioffistrangetom
andauthored
Patches for upcoming 2.3.0 (#38)
* Sphinx docs for upcoming 2.3.0 - [x] Docs: Favicon, logo, etc - [x] Docs: Web app section - [x] Docs: Reference internal links for all pages (for crosslinks) - [x] Docs: Sphinx lightbox for images - [x] Docs: General prep - [x] Docs: Add training to API reference section * Patches for upcoming 2.3.0 - [x] Labeller: Changed some zustrand state to better account for original and edited sentence workflow - [x] Labeller: Fixed drawer background and foreground colors to match app-wide color scheme - [x] Labeller: Better visual indicators for items edited or removed - [x] Labeller: Refactored editing to warn user in different scenarios where edits could be lost - [x] Parser: Missed the USDA anchor links on Foundation Foods - [x] Labeller: Upload bulk did not account for removed entries (if user chose any for removeal) - [x] General: Moved static data lists to collections - [x] General: Dropped MantineExtensions in favor of Shared directory - [x] General: Webtools README * Biome and sphinx cleanup * Make separate_name=true default in webtools parser. --------- Co-authored-by: Tom Strange <tpstrange@gmail.com>
1 parent e4d35ea commit 34fde0a

File tree

98 files changed

+7390
-4382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+7390
-4382
lines changed

README.md

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
The Ingredient Parser package is a Python package for parsing structured information out of recipe ingredient sentences.
44

5-
![](docs/source/_static/logo.png)
5+
![](docs/source/_static/logos/logo_wide.png)
66

77
## Documentation
88

@@ -61,41 +61,28 @@ Word-level results:
6161

6262
**Basic**
6363

64-
The development dependencies are in the `requirements-dev.txt` file. Details on the training process can be found in the [Model Guide](https://ingredient-parser.readthedocs.io/en/latest/guide/index.html) documentation.
64+
Train and fine-tune new ingredient datasets to expand beyond the existing trained model provided in the library. The development dependencies are in the `requirements-dev.txt` file. Details on the training process can be found in the [Model Guide](https://ingredient-parser.readthedocs.io/en/latest/guide/index.html) documentation.
6565

66-
Before committing anything, install [pre-commit](https://pre-commit.com/) and run
67-
```
68-
pre-commit install
69-
```
66+
**Web App**
7067

71-
to install the pre-commit hooks.
68+
The ingredient parser library provides a convenient web interface that you can run locally to access most of the library's functionality, including using the parser, browsing the database, labelling entries, and training the model(s). View the [specific README](webtools/README.md) in webtools for a detailed overview.
7269

73-
**Web app**
70+
| Parser | Labeller | Trainer |
71+
| :------- | :------- | :------- |
72+
| ![Screen shot of web parser](docs/source/_static/webtools/app.parser.screenshot.png) | ![Screen shot of web labeller](docs/source/_static/webtools/app.labeller.screenshot.png) | ![Screen shot of web trainer](docs/source/_static/webtools/app.trainer.screenshot.png) |
73+
74+
**Documentation**
7475

75-
There is a simple web app for testing the parser, browsing the database, labelling entries, and running the basic model.
76+
The dependencies for building the documentation are in the `requirements-doc.txt` file.
7677

77-
To run the web app, follow the prior steps on `requirements-dev.txt`, and separately install [Node](https://nodejs.org/en/download), the JS runtime. Once globally installed on your machine, download your packages in the webtools directory with:
78+
**Contribution**
7879

79-
```bash
80-
$ npm install
81-
```
80+
Please target the **develop** branch for pull requests. The **main** branch is used for stable releases and hotfixes only.
8281

83-
After package installs, run dev to start.
82+
Before committing anything, install [pre-commit](https://pre-commit.com/) and run the following to install the hooks:
8483

8584
```bash
86-
$ npm run dev
85+
$ pre-commit install
8786
```
8887

89-
*tl;dr — inside package.json, `flask` runs the base server, `sockets` runs the web sockets server, and `watch` runs vite build for the react/typescripe bundle — separate flask instances are required to accommodate better web socket behavior*
90-
91-
![Screen shot of web parser](docs/source/_static/app.parser.screenshot.png)
92-
![Screen shot of web labeller](docs/source/_static/app.labeller.screenshot.png)
93-
![Screen shot of web trainer](docs/source/_static/app.trainer.screenshot.png)
94-
95-
**Documentation**
96-
97-
The dependencies for building the documentation are in the `requirements-doc.txt` file.
98-
99-
**Contribution**
100-
101-
Please target the **develop** branch for pull requests. The main branch is used for stable releases and hotfixes only.
88+
Pre-commit hooks cover both the main python library code and the web app (webtools) code.
-101 KB
Binary file not shown.

docs/source/_static/custom.css

Lines changed: 120 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
/* Lightbox */
2+
.lightbox .lb-image {
3+
border: none;
4+
}
5+
.lightbox .lb-outerContainer {
6+
border-radius: 4px;
7+
background-color: var(--pst-color-background);
8+
}
9+
10+
.lightbox .lb-data .lb-close {
11+
filter: alpha(Opacity=50);
12+
opacity: .5;
13+
}
14+
15+
/* Left navbar logo iconography */
16+
.navbar-brand {
17+
justify-content: flex-start;
18+
align-items: flex-start;
19+
gap: 0.25rem;
20+
}
21+
.navbar-brand img {
22+
width: 4rem;
23+
}
24+
.navbar-brand .title {
25+
font-size: 1rem;
26+
}
27+
128
/* Tweak cards on homepage */
229
.sd-card {
330
background-color: var(--pst-color-on-background);
@@ -10,9 +37,44 @@
1037
border-top: none !important;
1138
}
1239

40+
/* Layout overrides */
41+
html[data-theme=dark] {
42+
.bd-sidebar-primary {
43+
border-right: 1px solid color-mix(in srgb,var(--fg),transparent 66%);
44+
}
45+
.bd-footer-content {
46+
border-top: 1px solid color-mix(in srgb,var(--fg),transparent 66%);
47+
}
48+
}
49+
html[data-theme=light] {
50+
.bd-sidebar-primary {
51+
border-right: 1px solid color-mix(in srgb,var(--bg-4),transparent 66%);
52+
}
53+
.bd-footer-content {
54+
border-top: 1px solid color-mix(in srgb,var(--bg-4),transparent 66%);
55+
}
56+
}
57+
58+
nav.bd-links {
59+
margin-right: 0 !important;
60+
}
61+
nav.page-toc {
62+
margin-bottom: 0 !important;
63+
}
64+
#pst-back-to-top {
65+
top: 95vh;
66+
}
67+
.bottom-right {
68+
right: 20px;
69+
bottom: 20px;
70+
}
71+
1372
/* Remove border radius from search box */
1473
.search-button-field {
15-
border-radius: revert;
74+
border-radius: 0.25rem;
75+
}
76+
.search-button-field:hover {
77+
box-shadow: 0 0 0 .1rem var(--pst-color-link-hover);
1678
}
1779

1880
/* Remove bullets from parameter lists in API docs */
@@ -21,23 +83,58 @@
2183
padding-left: 0;
2284
}
2385

24-
/* Give <strong> a a different colour */
25-
strong {
26-
color: var(--pst-color-secondary);
27-
}
28-
29-
/* Remove underline from abbreviations */
30-
abbr[title] {
31-
text-decoration: 1px dotted var(--pst-color-link);
32-
}
33-
3486
/* Add better separation between function and classes */
3587
.class, .function {
3688
margin-top: 1rem;
3789
padding-bottom: 1rem;
3890
border-bottom: 1px solid var(--pst-color-on-surface);
3991
}
4092

93+
/* Globals */
94+
:root {
95+
color-scheme: dark;
96+
--bg: #1d2021;
97+
--bg-s: #32302f;
98+
--bg-1: #3c3836;
99+
--bg-2: #504945;
100+
--bg-3: #665c54;
101+
--bg-4: #7c6f64;
102+
--fg: #fbf1c7;
103+
--fg-1: #ebdbb2;
104+
--fg-2: #d5c4a1;
105+
--fg-3: #bdae93;
106+
--fg-4: #a89984;
107+
--gray: #928374;
108+
--white: #ffffff;
109+
--black: #333333;
110+
--red: #cc241d;
111+
--red-blend: #982823;
112+
--red-alt: #fb4934;
113+
--green: #98971a;
114+
--green-blend: #98971a;
115+
--green-alt: #b8bb26;
116+
--yellow: #d79921;
117+
--yellow-blend: #9f7625;
118+
--yellow-alt: #fabd2f;
119+
--blue: #458588;
120+
--blue-blend: #3e686a;
121+
--blue-alt: #83a598;
122+
--purple: #b16286;
123+
--purple-blend: #865169;
124+
--purple-alt: #d3869b;
125+
--orange: #d65d0e;
126+
--orange-blend: #9f4e19;
127+
--orange-alt: #fe8019;
128+
--aqua: #689d6a;
129+
--aqua-blend: #567856;
130+
--aqua-alt: #8ec07c;
131+
}
132+
133+
134+
html {
135+
--pst-header-height: 2.5rem;
136+
}
137+
41138
/* Set theme using gruvbox colours */
42139
html[data-theme=dark] {
43140
--pst-color-primary: #b8bb26;
@@ -80,7 +177,7 @@ html[data-theme=dark] {
80177
--pst-color-inline-code: #fe8019;
81178
--pst-color-inline-code-links: var(--pst-color-inline-code);
82179
--pst-color-target: #3e686ab3;
83-
--pst-color-background: #1d2021;
180+
--pst-color-background: #32302f;
84181
--pst-color-on-background: #504945;
85182
--pst-color-surface: #3c3836;
86183
--pst-color-on-surface: #bdae93;
@@ -145,6 +242,16 @@ html[data-theme=light] {
145242
--pst-color-table-row-hover-bg: #b1628620;
146243
}
147244

245+
/* Give <strong> a a different colour */
246+
strong {
247+
color: var(--pst-color-secondary);
248+
}
249+
250+
/* Remove underline from abbreviations */
251+
abbr[title] {
252+
text-decoration: 1px dotted var(--pst-color-link);
253+
}
254+
148255
/* Fix text colour in search box on search result page */
149256
input.form-control {
150257
color: var(--pst-color-text-base)
@@ -153,4 +260,4 @@ input.form-control {
153260
/* Remove background from images in dark theme */
154261
html[data-theme=dark] .bd-content img:not(.only-dark):not(.dark-light) {
155262
background: revert;
156-
}
263+
}

0 commit comments

Comments
 (0)