Developing¶
Backend¶
Setting up a development environment¶
To work on shapeflow, you should set up a virtual environment in .venv
python -m venv .venv
(.venv) pip install -r requirements.txt
With this environment in place, the entrypoint shapeflow.py can be run
either from (.venv) or with your the global Python interpreter.
In the latter case, .venv will be used implicitly.
Writing plugins¶
Features, transforms and filters are handled by a plugin system. You can use existing plugins as examples.
A plugin should be a subclass of its respective interface (
Featurefor features,TransformInterfacefor transforms andFilterInterfacefor filters)If you define configuration for the plugin, it should derive from its respective configuration class as well (
FeatureConfigfor features,TransformConfigfor transforms andFilterConfigfor filters), and should be linked to the plugin class itself as the class variable_config_class. Configuration parameters should be defined aspydantic.Fieldinstances, and should include a default and a description.Plugins should have a descriptive docstring
Featuresubclasses should also define a_labeland_unitas class variables. These values will be used to label the y-axis on the result page of the frontend.
All plugin files are automatically loaded when shapeflow.plugins is imported.
Frontend¶
Setup¶
Install Install NodeJS & npm
Navigate to this directory and install the dependencies
cd ui/ && npm install
Compiling the frontend¶
(Set up)
Compile
cd ui/ && npm run generate
The compiled files are stored in
ui/dist/.
Running the frontend in development mode¶
(Set up)
Run the backend server (default address http://localhost:7951)
(.venv) $ python .server.py
Run the frontend development server (default address http://localhost:3000)
cd ui/ && npm run dev
The development server hot-reloads content from the source code in
ui/and proxies API calls to the backend server.
Generating deployment scripts¶
Deployment scripts are generated with gitploy.
Tag the release in
gitCreate a release on Github
Compile
ui/dist/, compress it withtar czf dist-<tag>.tar.gz dist/and attach it to that release as a binaryCreate or update your .ploy file in
shapeflow‘s root directory:Start from shapeflow/setup/ploy
Add the tag of your release
Double check that the check / setup script paths are still correct
Run
python -m gitployinshapeflow‘s root directory.
TODO¶
Some known problems and minor feature ideas. Not everything in this list is worth spending time on, and some ideas are serious feature creep. Open issues for important stuff.
Check performance on slower hardware
Sidebar nav icon&text should aligned vertically
Frame & state image can get desynchronized sometimes
Dragging the seek control doesn’t update streams, but clicking/arows do (sometimes, sometimes it’s ok)
Alt scrolls through sidebar navs for some reason
Select previous results of the same analyzer in the results page
Masks misbehave when increasing DPI, work fine when decreasing DPI (????)
Skipped masks should be grayed out in the state image
Set a max width/height for graph (depending on number of features?)
Add
AnalyzerStateassertions to test_main.pySometimes roi resize gets applied to current & opposite side, jumpy
Highlight masks on hover in frontend
Set default filter/transform configuration when adding a new analysis
Optimize
SchemaFormrendering speedAdd an option to export
.metafilesAdd an option to import analyses from
.metafiles and.xlsxfilesConfigure sidebar should have a fade on the bottom
Don’t catch events outside of frame boundary (
v-bindstyletodiv?)Really fix oscillating parameter override categories
Two of the same feature should yield two separate graphs
On Windows,
tkinterfile dialogs don’t open when debuggingSupport Anaconda environments
When current analyzer page becomes disabled, route away or gray out page
Already fixed?¶
get_overlay&get_overlay_pngtake 5 seconds to run sometimesAlign/Filter page: seek event on page load doesn’t always come through, or the streamed image doesn’t get updated
Frontend can freeze when adding a second/third/… analyzer
Adding new analyzers with large Nf is slow
Fix ROI rotation (probably need to initialize moveable with the aspect ratio of the design)
ConfigModelis made in doublesCtrlZ / CtrlShiftZ requests
undo_config/redo_configtwiceWhen switching between analyzers, ROI sometimes gets stuck; modifying
moveabledoesn’t cause actual ROI to jump to the wrong oneConfig events are sometimes missed on
set_filter_clickIssues with page rebuild after switching analyzers multiple (3+ times)
Shouldn’t continue on to
/api/va/<id>/launchif/api/va/<id>/set_configraises HTTP500Reset filters state update should disable ‘Analyze’ button