Releases: ilius/pyglossary
5.0.3
What's Changed
- Fix in PyGlossary icon / logo, visible in light background
- Web UI: update
favicon.ico
- Mobipocket: refactor, run kindlegen with relative file path, #613
- Add back
pkg/pyglossary.desktop
for flathub build, #614 - Rename plugin
ABCMedicalNotes
toMakindoMedical
(#267) - Make plugins' documentation tidier
- Update
project.urls
inpyproject.toml
according to packaging.python.org - Add or update
__all__
in imported modules - Fewer uses of
sys.exit
- Refactor
pyglossary/ui/main.py
and addmainNoExit
function (c19ba56)
Full Changelog: 5.0.2...5.0.3
5.0.2
What's Changed
- New PyGlossary icon logo
- Zimfile: fix possible
NameError
- Web UI: add glossary preview buttons by @glowinthedark in #610
- Remove plugin: IUPAC goldbook (.xml)
- Replace all usages of
OrderedDict
withdict
which is ordered since python 3.6 - FreeDict: improve test coverage
- Refactor Yomichan and Web UI, and cleanup in BGL
- Remove
pyglossary.pyw
,pkg
directory andres/resize-16.png
Full Changelog: 5.0.1...5.0.2
5.0.1
What's Changed
- Glossary info: map "creationTime" metadata to/from "date" metadata (used by StarDict)
- Gettext
.po
: fix broken syntax due to missing quotations, unescape|
, and fix duplicate msgids - Wiktextract: improvements and better testing
- Disable categories by default with an option to enable it
- FreeDict: refactoring
- Web UI: add
setup.py
metadata by @glowinthedark in #609 - Allow disabling in-memory SQLite with an environment variable
- Better testing, fix/add type annotations and (as usual) some refactoring
Full Changelog: 5.0.0...5.0.1
5.0.0
Breaking changes for library users
-
38f8f91
glossary_v2.Glossary
class raisesError
exception if operation failed, instead oflog.critical
andreturn None
- Applies to these methods:
convert
,read
,write
glossary.Glossary
(andpyglossary.Glossary
) still behaves the same way (returnNone
if failed)
- Applies to these methods:
-
a5204bb Breaking changes in
Glossary.detectInputFormat
andGlossary.detectOutputFormat
methods:format
argument is renamed toformatName
quiet
argument is removed (must handleError
exception instead)
-
9cc2887
Glossary.wordTitleStr
: rename_class
argument toclass_
-
Remove
toBytes
andreplaceStringTable
functions fromtext_utils.py
andplugins/formats_common.py
Breaking change for plugins outside this repo
Deprecated API for library users
glossary.Glossary
is deprecated, useglossary_v2.Glossary
format
variable in plugins is deprecated, rename it toname
info
argument toGlossary()
is deprecated. Useglos.setInfo(key, value)
Glossary
:format
arguments toread
,directRead
andwrite
methods are deprecated, rename them toformatName
What's changed since last version?
We have a web-based user interface by @glowinthedark, a new plugin StardictMergeSyns, new options in various plugins/formats, lots of improvements, refactoring and cleanup.
Full Changelog: 4.7.1...5.0.0
New Contributors
4.7.1
Changes since 4.7.0
Breaking changes:
4c78aa4 replace CC-CEDICT
plugin with EDICT2
plugin
Bug fixes and improvements:
f5a420c Bugfix: Glossary: removeHtmlTagsAll was ineffective with --sort same for preventDuplicateWords
01b5606 Yomichan: merge entries with same headword, #574
5fe93f4 Yomichan: add beautifulsoup4 to dependencies, #577
2a23966 use python3
in scripts/view-glossary and scripts/diff-glossary to bypass pyenv
c878cbd zimfile: replace OSError on Windows with a warning, #580
1573d5c Wiktextract: rewrite writeSenseExample and fix #572 - Fix TypeError: got invalid input value of type <class 'list'> - Create a list of examples - Add the example type as prefix in bold
7f64af5 Wiktextract: keep warnings in a Counter, remove duplicate messages and show at end
New Features
aa6765b add new plugin xdxf_css (XdxfCss) based on PR #570 by @soshial
0e9d221 add read_options to .info file
fea2223 StarDict Textual writer: save resource files in res/ folder, #558
3800fac add Dyula language, #575
08c41da add glos.readOptions property
Refactoring, linting and testing
6786880 fix ruff preview error in appledict_bin/init.py
fd09e16 github actions: switch to ruff 0.5.2
019740e fix ruff error
69bcbf9 fix ruff preview error: B909 Mutation to loop iterable during iteration
5596b7f switch to ruff 0.6.4
03a509b fix ruff preview errors, use str.removesuffix
6ca9902 fix some mypy errors
eac286b github test: use lxml==5.2 to fix jmdict test
f2eb39d move info writer out of plugins
578c854 fix tests: test_save_info_json
0f4d885 update pyproject.toml
1e20a1a format pyglossary/glossary_v2.py
e231b64 update scripts/format-code
4aa4f09 github action test: remove test cache
acdbede github test: upload failed test files
1f095ad fix test action
9df1ed6 update jmdict test and switch to lxml==5.3
Full Changelog: 4.7.0...4.7.1
4.7.0
Changes since 4.6.1
- Update README.md by @ilius in #460
- Update pyicu docs for Debian by @master-bob in #461
- AppleDict-bin: support UTF16 4-byte symbols #473 by @soshial in #476
- AppleDict-bin: fix crash for multidirectional dicts by @soshial in #480
- DSL: support substitution of tilda ~ by @soshial in #485
- AppleDict-bin: fix crash for Korean glossary by @soshial in #484
- Update copyright name for ratijas by @ratijas in #488
- Improve Python typing in dsl plugin by @ratijas in #489
- New DSL plugin by @ilius in #492
- stardict xdxf: handle text within
by @Crissium in #511 - ruff by @ilius in #514
- format .github/workflows/*.yml by @ilius in #515
- Replace dictzip with idzip by @bergentroll in #512
- fix: unable to select files from within flatpak by @proletarius101 in #531
- slob: make audio work in AARD2 for android and aard2-web (breaks audio in goldendict desktop) by @glowinthedark in #534
New Contributors
- @master-bob made their first contribution in #461
- @Crissium made their first contribution in #511
- @bergentroll made their first contribution in #512
- @glowinthedark made their first contribution in #534
Full Changelog: 4.6.1...4.7.0
4.6.1
Changes since 4.6.0
Bug fixes
-
Fix a bug causing broken installation if
~/.local/lib
is a symbolic link- or
site-packages
or any of its parents are a symbolic link
- or
-
Fix incompatibilty with Python 3.9 (despite documentation)
-
Fix
scripts/entry-filters-doc.py
,scripts/plugin-doc.py
anddoc/entry-filters.md
-
AppleDict: Fix typos in Chinese language module
Features:
- Use environment variable
VERBOSITY
as default (a number from 0 to 5)
Improvements
-
AppleDict Binary: set
html_full=True
by default -
Update
wcwidth
to0.2.6
Refactoring
-
Add
glos.stripFullHtml(errorHandler)
and use it in 3 plugins- Add entry filter
StripFullHtml
and changeentry.stripFullHtml()
to return error
- Add entry filter
-
Refactor
entryFiltersRules
-
Remove empty plugin gettext_mo.py
-
Remove
glos.titleElement
fromglossary_v2.Glossary
- Add to
glossary.Glossary
for compatibility glossary.Glossary
is a wrapper (child class) on top onglossary_v2.Glossary
- Add to
Documentation
-
Update
doc/entry-filters.md
to list some entry filters that were enabled conditionally (besides config) -
Remove
sdict.md
andsdict_source.md
(removed plugins)
Type checking
- Add missing method in
GlossaryType
class - Fix
mypy
errors on most of code base and some of plugins - Use builtin types
list, dict, tuple, set
for type annotations - Replace
Optional[X]
withX or None
- will not effect runtime, but type checking now only works with Python 3.10+
4.6.0
Changes since 4.5.0
Dependency change
We now require Python 3.9 or a later version.
Bug fixes
-
Fix exception in
scripts/plugin-index.py
: 8a94b8c -
StarDict: Fix writing to
.zip
file produced empty zip, and fix bad test -
dictunformat: fix #367: add option
headword_separator
, default to;
-
AppleDict source: fix #407 missing quotes for title, and refactor duplicate codes
-
DictionaryForMIDs: remove
|
from word when normalizing, fix punctuation regex, use Unix newlines -
StarDict: use Unix newline when reading and writing .ifo file on Windows
-
Fix bug of
glos.addEntryObj(dataEntry)
adding empty file becausetmpDataDir
is not set untilglos.read()
- Set and create
tmpDataDir
onglos.tmpDataDir
access, and add test, #424
- Set and create
-
Fix
scripts/wiki-formats.py
, #428 -
Dictd / Dict.org: fix exception on Windows
Features
-
Support sorting by an ICU locale, see Sorting section of README
-
Add Gtk4 interface
--ui=gtk4
/--gtk4
- still buggy and not as functional as Gtk3 or Tkinter interfaces
-
Add flag
--optimize-memory
, config keyoptimize_memory
- To enable entry compression on
--indirect
- Not enabled by default (it was previously always compressed)
- To enable entry compression on
-
Allow plugin's
reader.open()
to return anIterator
for progress bar- Implement for Tabfile (reading info/metedata)
- Implement for AppleDict Binary (reading
KeyText.data
)
-
Add read and write support for StarDict Textual File (.xml), #348
-
Add support for writing Yomichan dictionary files, #395 by @tomtung
-
StarDict reader: support
.syn.dz
file, #410 -
JMDict: support examples, #383
-
Add read support for JMnedict, #386
-
Add flag
--skip-duplicate-headword
, configskip_duplicate_headword
, #365- Zim reader: remove option
skip_duplicate_words
, #365
- Zim reader: remove option
-
Add flag
--trim-arabic-diacritics
, configtrim_arabic_diacritics
, #366 -
Add read support for IUPAC goldbook (.xml), #355
-
Add write support for DIKT JSON
-
StarDict writer: limit memory usage by using SQLite for
idx
andsyn
data, #409 -
CSV: add newline option, defaulting to Unix-style
-
Aard2 Slob writer: add option
file_size_approx_check_num_entries
-
Add
scripts/diff-glossary
andscripts/view-glossary
Improvements
-
When remove HTML tags, also replace
<div>
with\n
, #394 by @tomtung- Treat
<div>
the same way<p>
is treated.
- Treat
-
Mobi: add
mobi7-forcing
switch tokindlegen
command, #374 by @holyspiritomb -
Octopus MDict: ignore directories with
same_dir_data_files
, #362 -
StarDict reader: handle definitions with mixed types/formats
-
Dictfile: strip whitespaces from word and defi before going through entry filters
-
BGL: strip whitespaces from word and defi before going through entry filters
-
Improvement in
glos.write
: avoid printing exception for invalid encoding -
Remove empty logs in
glos.convert
-
StarDict reader: fix validating
sametypesequence
, and add test -
glos.convert
: Allow an existing empty directory as output path -
TextGlossaryReader
: replacenextPair
method withnextBlock
which returns resource files as third item -
ui_cmd_interactive: allow converting several times before exiting
-
Change title tag for Greek from
<big>
to<b>
-
Update language data set (
langs.json
) -
ui/main.py
: print 1-line error instead of full exception onImportError
-
ui/main.py
: Windows: try Tkinter before Gtk -
ebook_base.py
: avoidshutil.move
on Windows, #368 -
TextGlossaryReader
: fix loading info and some refactoring, #370 36b9cd8 -
Entry
: Allowword
to betuple
inEntry(word=...)
-
glos.iterInfo()
returnIterator
rather thanIterable
-
Zim: change dependency to
libzim>=1.0
, and some comments -
Mobi: work with kindlegen executable in
PATH
directories, #401 -
ui: limit the length of option comments in Format Options dialog
-
ui_gtk: improvement: show (last) critical error on status bar
-
ui_gtk: set intial focus
-
ui_gtk: improvements in About tab
-
ui_tk: revert most
ttk
widgets totk
because the theme doesn't match -
Add SVG icon, #414 by @proletarius101
-
Prevent exception/traceback on Ctrl+C
-
Optimize progress bar
-
Aard2 slob: show info log before and after
slobWriter.finalize()
, #437
Removed features
-
Remove read support for Wiktiomary Dump, #48
-
Remove support for Sdictionary Binary and Source
Octopus MDict MDX: features and improvements
-
Support MDict V3 fomrat by updating
readmdict
, #385 by @xiaoqiangwang -
Fix files created without UUID in header, #387 by @xiaoqiangwang
- MdxBuilder 4.0 RC2 and before creates files without UUID header
-
Decode mdict title & description if they're bytes, #393 by @tomtung
-
readmdict
: Skip zlib decompress exceptions, #384 -
readmdict
: Use__name__
as logger name, and add 2 debug logs, #384 -
readmdict
: improve exception msg for xxhash, #385
XDXF: fixes / imrovements, issue #376
- Support
<categ>
- Support embedded tags in
<iref>
- Fix ignoring
<mrkd>
- Fix extra newlines
- Get rid of warning for
<etm>
- Fix/improve newline and space issues
- Fix and improve tests
- Update url for format description
- Support any tag/string in
<ex>
, #396 - Support reading compressed files directly (
.xdxf.gz
,.xdxf.bz2
,.xdxf.lzma
) - Allow using XSL using
--write-options=xsl=True
- Update XSL
- Other improvements in XDXF to HTML transformation
AppleDict Binary: features, bug fixes, improvements, refactoring
-
Fix css name on
html_full=True
-
Fix using
self._encoding
when should useutf-8
-
Fix internal links, #343
- Remove
x-dictionary:d:
prefix fromhref
- First fix for
x-dictionary:r:
: use title if present - Add
bword://
prefix tohref
(unless it points to http/https) - Read entry IDs on open and fix links with
x-dictionary:r:
- Remove
-
Add plistlib to dependencies
-
Add tests
-
Replace
<entry ...>
with<div>
-
Fix bad exception formatting
-
Fixes from PR #436
-
Extract AppleDict meta-info (langs, title, author), #418 by @soshial
-
Progress Bar on
open()
/ loadingKeyText.data
-
Improve memory usage of loading
KeyText.data
-
Replace
appledict_bin.py
withappledict_bin
directory and more refactoring
Glossary class (glossary.py
)
-
Lots of refactoring in
glossary.py
- Improve the design and readability
- Reduce complexity of methods
- Move some code into new classes that
Glossary
inherits from - Improve error messages
-
Introduce
glossary_v2.py
, and maintain API backward-compatibility forglossary.py
(as far as documented)- See README.md for sample code.
Refactoring
-
Fix style errors using
ruff
based on pyproject.toml configuration -
Remove all usages of pyglossary.plugins.formats_common
-
Use
str.startswith(tuple)
andstr.endswith(tuple)
-
Reduce complexity of
Glossary
methods -
Rename entry filter
strip
totrim_whitespaces
-
Some refactoring in StarDict reader
-
Use f-string equal syntax added in Python 3.8
-
Use
str.removeprefix
andstr.removesuffix
added in Python 3.9 -
langs/writing_system.py
:- Change
iso
field to list - Add new scripts
- Add
getAllWritingSystemsFromText
- More refactoring
- Change
-
Split up
TextGlossaryReader.loadInfo
method -
plugin_manager.py
: make some methods private
Documentation
-
Update plugins' documentation
-
Glossary: add comments about
entryFilters
-
Update
config.rst
-
Update
doc/entry-filters.md
-
Update
README.md
-
Update
doc/sort-key.md
-
Update
doc/pyicu.md
-
Update
plugins/testformat.py
-
Add types for arguments and result of all functions/methods
-
Add types for r/w options in reader/writer classes
-
Fix a few incorrect type annotations
-
README.md
: Add document for adding data entries, #412 -
Update bgl_info.md and move it from
pyglossary/plugins/babylon_bgl/
todoc/babylon/
Testing
-
Add test for DSL -> Tabfile conversion
-
dsl_test.py
: fix method names not starting withtest_
-
StarDict reader: better testing for handling definitions with mixed types
-
StarDict writer: much better testing, coverage of
stardict.py
: from %62 to %83 -
Refactoring and improvements in tests of Glossary, along with new tests
-
Add test for dictunformat -> Tabfile
-
AppleDict (source) tests: validate plist file contents
-
Allow forking and branching
pyglossary-test
repo -
Fix some failing tests on Windows
-
Slob: test
file_size_approx
-
Test Tabfile -> SQL conversion
-
Test StarDict error/warning for sortKeyName with and without locale
-
Print useful messages for unhandled warnings
-
Improve logs
-
Add
showDiff=False
arg tocompareTextFiles
andconvert
Packaging
-
Update and refactor
Dockerfile
andrun-with-docker.sh
Dockerfile
: chan...
4.5.0
Changes since 4.4.1
Bug fixes
-
Fix 2 log messages in
glos._resolveConvertSortParams
-
Fixes and improvements in Dictfile (.df) reader
- Fix exception: disable loading info (Dicfile does not support info)
- TextGlossaryReader: prevent producing duplicate data entries
- This fixes:
error in DataEntry.save: [Errno 2] No such file or directory: ...
becauseentry.save()
moves the temp file to output path - This bug only existed for Dictfile (.df) format.
- This fixes:
- Remove extra colon, #358
- Remove some extra newline
- And add test for Dictfile to/from Tabfile
-
Fix not cleaning up temp directory on return with error from
glos.convert
Features
-
ui_gtk: add a "General Options" button that opens a dialog for:
- Settings for
sort
andsortKey
- Checkbox for SQLite mode
- Check boxes for config params:
save_info_json
,lower
,skip_resources
,rtl
,enable_alts
,cleanup
,remove_html_all
- Settings for
-
Add support for
--sort-key random
to shuffle entries
Performance improvements
-
Performance improvement: remove
gc.collect()
calls inGlossary
and*EntryList
- Not needed since Python 3.8
- Change minimum python requirement to 3.8 in
README.md
-
Do not import all plugin modules (only import two plugins that are used)
- Load json file
plugins-meta/index.json
instead - In debug mode, all plugin modules are still imported and validated
- User plugins are still imported
- Load json file
Other improvements
- Improve detection of languages from glossary name, and add tests
- Update
langs.json
: add new 3-letter codes for 25 languages glos.preventDuplicateWords
andglos.removeHtmlTagsAll
: prevent adding filter twiceglos.cleanup
: reset path list to avoid (non-critical) error if called again- Minor improvements in
Glossary.init()
DataEntry.save
: onFileNotFoundError
show a 1-line error instead oflog.exception
- ui_gtk: create a new
Glossary
object every time Convert button is clicked - Add docstring for
Glossary.init
Unit testing
- Update
tests/glossary_errors_test.py
- Add missing cleanup for some temp file
- add test for LDF to/from Tabfile
Refactoring
-
Plugins: replace import of
formats_common
from currect directory withpyglossary.plugins.formats_common
-
Fix
logging.warn
method is deprecated, usewarning
instead, PR #360 by @BoboTiG -
Fix
DeprecationWarning: invalid escape sequence
, PR #361 by @BoboTiG -
Move some functions from
glossary_utils.py
tocompression.py
-
Move some methods from
Glossary
to new parent classesPluginManager
andGlossaryInfo
-
Some refactoring in
plugin_prop.py
andplugin_manager.py
- Rename
plugin.pluginModule
toplugin.module
- Minimize direct access to
plugin.module
,plugin.readerClass
orplugin.writerClass
- Add some new properties to
PluginProp
- Remove a log from
glossary.py
- Disable validation of plugins unless in debug mode
plugin_prop.py
: fix checking debug level
- Rename
-
sq_entry_list.py
: renamesortColumns
tosqliteSortKey
-
Some refactoring around
setSortKey
betweenGlossary
,EntryList
andSqEntryList
-
Remove
Entry.sqliteSortKeyFrom
and related classmethods -
Some more simplification in
glossary.py
-
Remove
Entry.defaultSortKey
-
Some style fixes
-
iter_utils.py
: remove unusedkey=
argument fromunique_everseen
-
Refactor ui_gtk and update config comments
-
extractInlineHtmlImages
: avoid writing file within sub func
4.4.1
Changes since 4.4.0
Bug fixes
- Automatically create
cacheDir
onGlossary.init()
- Fixes exception in SQLite mode
Features
ui_cmd_interactive
: support settingsortKey
Improvements and documentation
- Wiktionary Dump: remove detect-by-extension
glossary.py
: update docstrings forsortKeyName
sort_keys.py
: adddesc
toNamedSortKey
- Update
doc/sort-key.md