Skip to content

Add incremental import/export, library support, UTF-8 encoding, and per-file logging#3

Open
Roden69 wants to merge 4 commits into
nineyards-robotics:mainfrom
Roden69:my-changes
Open

Add incremental import/export, library support, UTF-8 encoding, and per-file logging#3
Roden69 wants to merge 4 commits into
nineyards-robotics:mainfrom
Roden69:my-changes

Conversation

@Roden69

@Roden69 Roden69 commented May 29, 2026

Copy link
Copy Markdown

Changes

Incremental Export

Instead of wiping and rewriting the entire source folder on every export,
the export now uses a file-hash manifest to only write files that actually
changed, add new files, and remove deleted ones. This results in much
cleaner git diffs — unchanged files no longer show up as modified.

Incremental Import

Import now uses the same manifest to only re-import files that changed
since the last export/import. New files are created, deleted files are
removed, unchanged files are skipped. Falls back to a full import when
no manifest exists yet.

Subfolder Import/Export

For library projects, import and export can be scoped to a single
subfolder (e.g. POUs/Math) instead of the whole project. Useful for
large libraries where only one area was touched.

Full Library Project Support

Projects with a .library extension (or projects containing no devices)
are now correctly treated as library projects and imported/exported from
the project root.

UTF-8 Encoding

All file reads and writes now use encoding="utf-8" to correctly handle
special characters (e.g. German umlauts) in variable names and comments.

Per-file Logging

Import and export now log each individual file as + new, ~ changed,
or - deleted/removed in the CODESYS output window, not just the total
counts.

Testing

Tested on CODESYS V3.5 SP21 Patch 2 with IFM CR711s project structure.

Reviewed and developed with the assistance of Claude Code (Anthropic).

@Roden69 Roden69 changed the title Add UTF-8 support, library project support, subfolder import/export, and per-file logging Add incremental import/export, library support, UTF-8 encoding, and per-file logging May 29, 2026
Roden69 added 4 commits May 29, 2026 16:01
- Replace open() with io.open(encoding="utf-8") to support Unicode
  characters (e.g. ≠, °, µ) in import_export.py and import_from_files.py
- Remove str(f.read()) in import_st and import_st_decl_only to avoid
  Unicode data loss on Python 2.7
- Add library project fallback in script_export_to_files.py,
  import_from_files.py and script_save_as_template.py for projects
  without a Device/Application node
- Fix PROJECT_EXT in project_template.py to support .library extension
- Add safety check in script_update_from_template.py when no template
  file is found
- Remove unused get_library_entrypoint() from entrypoint.py

Signed-off-by: dmatthes <daniel.matthes@megmeet.com>
Signed-off-by: dmatthes <daniel.matthes@megmeet.com>
- export: sync_folder now returns lists of changed/new/removed relative paths and prints each file under the summary line
- import: incremental_import splits new vs. changed files and logs each one (new/changed/deleted)

Signed-off-by: dmatthes <daniel.matthes@megmeet.com>
Signed-off-by: dmatthes <daniel.matthes@megmeet.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant