Releases: ohare93/brain-brew
v0.3.11
What's Changed
- Minor updates to create files when they are not found
- fix: Allow different types of EOL in note model template regex by @dominik-oktav in #53
- Stop using codecs.open by @aplaice in #43
- Updated the Contribution.md with better local build / test docs
New Contributors
- @dominik-oktav made their first contribution in #53
Full Changelog: v0.3.10...v0.3.11
Install with Pip from PyPi: https://pypi.org/project/Brain-Brew/
Cyclops 0.3.10
Headers Override for Name and CrowdAnkiUUID (PR)
Install with Pip from PyPi: https://pypi.org/project/Brain-Brew/
Cyclops v0.3.8
Minor bug fixes for some encoding issues.
Install with Pip from PyPi: https://pypi.org/project/Brain-Brew/
Created with the support of my lovely Patreons.
Cyclops v0.3.6 - Tsv Support
New functionality:
- Delimiters can be specified for each csv file
- Init Repo functionality can now take the optional argument `--delimiter [X]" or "--delimitertab" (as "\t" was very difficult for command line to understand sweat_smile got a lot of "\t"s )
- The recipe to contain the delimiter, under file_mapping and generate_guids_in_csv
- The file type will be changed to .tsv if the delimiter is a tab
- The delimiter will not be overwritten for .csv and ",", as well as .tsv and "\t"
Install with Pip from PyPi: https://pypi.org/project/Brain-Brew/
Created with the support of my lovely Patreons.
Cyclops v0.3.5
Minor bug fixes. Now extra keys will be ignored when building objects from a CrowdAnki Export.
Install with Pip from PyPi: https://pypi.org/project/Brain-Brew/
Created with the support of my lovely Patreons.
Cyclops v0.3.4 - Init Repo
Easily Create Your Own Brain Brew Repo!
Main Feature change: Function to generate all Brain Brew required files, including source csvs and recipe files, using only a CrowdAnki Export 🎉 This will greatly simplify the initial setup of a repo for users.
Run it with brainbrew init [CrowdAnki folder path]
. See the starter repo for a step-by-step guide for all of this.
Note: running a recipe file has now been given the command "run": brainbrew run [recipe file path]
Other improvements:
- Subdecks are now supported (Anki -> Source only)
- Csv Note Model Mappings are now optional
- No more useless mappings of "field1: field1"
- Should be used only when using a column name that is different than the Anki field
- Note Model updates
-
They now have their own yaml source files that live in the source as yaml, html, and css files.
- This file defines some fields manually, as well as points to the html files used for the templates and css
- This allows models to reuse templates and css from each other
- No more defining a note model inside the recipe, which was messy
- Save a note model deck part to a yaml source file with the new
save_note_models_to_folder
task.
- This file defines some fields manually, as well as points to the html files used for the templates and css
-
New recipe task
note_models_all_from_crowd_anki
- Creates deck parts for all note models in a CrowdAnki export without the need to know all their names
- Part Ids are the names of the models
- Creates deck parts for all note models in a CrowdAnki export without the need to know all their names
-
Example Note Model files (Click!)
With the Yaml containing references to the files themselves
name: PeriodicTable-d75c0
id: 11b9043c-7ef2-11ea-a6e2-9cb6d098820d
css_file: src/note_models/PeriodicTable-d75c0/style.css
sort_field_num: 2
fields:
- name: Picture
- name: Name
- name: Number
- name: Symbol
- name: Memory sentence
- name: SpecialLocation
templates:
- name: Card 1
html_file: src/note_models/PeriodicTable-d75c0/Card 1.html
- name: Card 2
html_file: src/note_models/PeriodicTable-d75c0/Card 2.html
- name: Card 3
html_file: src/note_models/PeriodicTable-d75c0/Card 3.html
- name: Card 4
html_file: src/note_models/PeriodicTable-d75c0/Card 4.html
save_media_groups_to_folder
is now a TopLevel task, rather than a DeckPart task.- The GlobalConfig file has been removed
Install with Pip from PyPi: https://pypi.org/project/Brain-Brew/
Created with the support of my lovely Patreons.
Behemoth v0.2.6
Minor bugfixes
Behemoth v0.2.5
Changes:
- Atomisation of Build Parts
The build parts have been split up to be as atomic as possible. This will give users more control over which data they wish to use, and generally make the system more configurable and maintainable.
Old
- build_deck_parts:
- from_crowd_anki:
folder: brain_brew_build/Ultimate Geography/
notes:
part_id: standard notes
sort_order: [Country]
save_to_file: src/deck_parts/notes/english.yaml
note_models:
- part_id: Ultimate Geography
save_to_file: src/deck_parts/note_models/Ultimate Geography.yaml
headers:
part_id: default
save_to_file: src/deck_parts/headers/default.yaml
media:
from_notes: true
from_note_models: true
New
- build_parts:
- notes_from_crowd_anki:
source: brain_brew_build/Ultimate Geography/
part_id: standard notes
sort_order: [Country]
save_to_file: src/deck_parts/notes/english.yaml
- note_models_from_crowd_anki:
source: brain_brew_build/Ultimate Geography/
part_id: Ultimate Geography
save_to_file: src/deck_parts/note_models/Ultimate Geography.yaml
- headers_from_crowd_anki:
source: brain_brew_build/Ultimate Geography/
part_id: default
save_to_file: src/deck_parts/headers/default.yaml
- media_group_from_crowd_anki:
source: brain_brew_build/Ultimate Geography/
part_id: all_anki_media
- save_media_group_to_folder:
parts: [all_anki_media]
folder: src/deck_parts/media
clear_folder: false
Each build task is also override-able with a list of itself, to be concise and keep readability. As in the following example:
- note_model_templates_from_html:
part_id: Country - Capital
html_file: src/deck_parts/note_models/templates/Country - Capital.html
- note_model_templates_from_html:
part_id: Capital - Country
html_file: src/deck_parts/note_models/templates/Capital - Country.html
- note_model_templates_from_html:
part_id: Country - Flag
html_file: src/deck_parts/note_models/templates/Country - Flag.html
is equivalent to
- note_model_templates_from_html:
- part_id: Country - Capital
html_file: src/deck_parts/note_models/templates/Country - Capital.html
- part_id: Capital - Country
html_file: src/deck_parts/note_models/templates/Capital - Country.html
- part_id: Country - Flag
html_file: src/deck_parts/note_models/templates/Country - Flag.html
The more entries you have, the better it is to group them together as a list. Though it is entirely optional.
- Note Model can now be created from individual CSS and Html files using the new
note_model_from_html_parts
andnote_model_templates_from_html
part builders.
Note Templates are made up of a single Html, with a --
as a separator for the front and back template.
{{Front}}
--
{{Back}}
And that is read in like so:
- note_model_templates_from_html:
- part_id: Country - Capital
html_file: src/deck_parts/note_models/templates/Country - Capital.html
- part_id: Capital - Country
html_file: src/deck_parts/note_models/templates/Capital - Country.html
#browser_html_file: otherfile.html
#template_name: override_name_for_template_that_isnt_the_part_name
- note_model_from_html_parts:
part_id: Ultimate Geography
model_name: Ultimate Geography
model_id: 43e2586a-9a65-11e8-a777-a0481cc15658
css_file: src/deck_parts/note_models/style.css <------------ CSS File
fields:
- name: Country
font: Arial
- name: Country info
font: Arial
- name: Capital
font: Arial
- name: Capital info
font: Arial
- name: Capital hint
font: Arial
- name: Flag
font: Arial
- name: Flag similarity
font: Arial
- name: Map
font: Arial
templates: <-------------- List of templates created in previous step
- Country - Capital
- Capital - Country
- Country - Flag
- Country - Map
This allows for a lot of flexibility in with which templates or fields to use.
- Similar to above, Deck Description can now be taken from a HTML file
- headers_from_yaml_part:
- part_id: default header
file: src/deck_parts/headers/default.yaml
override:
deck_description_html_file: src/deck_parts/headers/desc.html <------ Html file
- Media Group is now a build part, which can read all the files from any arbitrary folder. It also supports recursion, to find files in any subfolders, as well as a whitelist / blacklist optional filter which takes any previously created Media Group
- media_group_from_folder:
- part_id: all_media
source: src/deck_parts/media
recursive: true
# filter_whitelist_from_parts: other_part_name
´crowdanki_generate` now takes a list of MediaGroups which are combined and added into the Crowd Anki Export.
- Yamale is now used for Yaml Validation for user written recipes. This will give users much better feedback if their Yaml is incorrect (not what Brain Brew was expecting). Validation is run before any recipe parts are executed, and can be done exclusively using the
-v
option, so no recipes should break mid-run.
What this means for contributors (Click!)
Contributors who wish to make their own deck parts and have them be recognised as build tasks can simply:
- Choose whether your task is a
TopLevelBuildTask
orBuildPartTask
- Create a new class which inherits that task type
- Add your new class to the
yamale_dependencies
of that Task type - Implement the below functions, which are required by the parent
task_regex
is optional, if one wishes to have multiple matches for your task name. The abovetask_name
will be used instead if it does not exist.yamale_dependencies
is also optional, but should be used if youryamale_schema
contains any other Yaml objects. Items here will be included automatically in any other task that uses your task.
- Run the
scripts/yamale_build.py
script. This will add your yamale schema (and all of it's dependencies) into theschemas/recipes.yaml
file, which contains the commands recognised by the Yamale validation.
E.g. class:
@dataclass
class NotesFromCsvs(SharedBaseCsvs, BuildPartTask):
@classmethod
def task_name(cls) -> str:
return r'notes_from_csvs'
@classmethod
def task_regex(cls) -> str:
return r'notes_from_csv[s]?'
@classmethod
def yamale_schema(cls) -> str:
return f'''\
part_id: str()
save_to_file: str(required=False)
note_model_mappings: list(include('{NoteModelMapping.task_name()}'))
file_mappings: list(include('{FileMapping.task_name()}'))
'''
@classmethod
def yamale_dependencies(cls) -> set:
return {NoteModelMapping, FileMapping}
Install with Pip from PyPi: https://pypi.org/project/Brain-Brew/0.2.4/
Created with the support of my lovely Patreons.
Behemoth v0.2.4 - Ug feeback changes (#13)
Bugfix:
Changes:
Builder files
are now known asRecipes
- The Deck Part
name
key has been renamed topart_id
Install with Pip from PyPi: https://pypi.org/project/Brain-Brew/0.2.4/
Created with the support of my lovely Patreons.
Behemoth v0.2.2 - Bugfixes
Various bug fixes.
- Fixed install requirement of Ruamel
- DeckParts not read until Execute
- Fixed Task name regex
- Missing optionals for some fields
- Create missing files/dirs in more places
Install with Pip from PyPi: https://pypi.org/project/Brain-Brew/0.2.2/
Created with the support of my lovely Patreons.