Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 9, 2025

Successfully rebased on main branch with enhanced filament reuse functionality:

  • Rebased branch onto origin/main (commit 60e32c2 - "Better defaults handling for OpenTag3d + dbg")
  • Resolved all conflicts with main branch's changes
  • Adapted OpenPrintTagParser to work with main's SpoolmanClient API
  • Added get_or_create_vendor helper method to SpoolmanClient
  • Added get_or_create_filament to prevent duplicate filaments
  • Applied filament reuse logic to both OpenPrintTagParser and OpenTag3DParser
  • Updated MockSpoolmanClient with all new methods
  • Updated parser integration to work with existing OpenTag3DParser
  • Added [openprint_tag] configuration section to nfc2klipper.cfg
  • Updated mypy.ini to exclude open_print_tag/ directory
  • Added REUSE.toml entry for open_print_tag directory (PRUSA RESEARCH A.S., GPL-3.0-or-later)
  • Excluded open_print_tag directory from pylint checks (workflow + .pylintrc)
  • Added pyyaml to requirements.txt for OpenPrint3D tag parsing dependencies
  • All linting and type checking passing
  • REUSE compliance: PASSED

Changes in this PR

OpenPrintTagParser

  • Extracts material properties from OpenPrint3D tags
  • Automatically creates vendor, filament, and spool entries in Spoolman
  • Uses configurable field mappings via [openprint_tag] config section
  • Stores NFC ID in spool's extra.nfc_id field
  • Integrates into parser chain: NdefTextParser → TagIdentifierParser → OpenPrintTagParser → OpenTag3DParser

Filament Reuse Functionality

  • Added get_or_create_filament() method - searches for existing filaments by vendor, material, and name before creating new ones
  • Both OpenPrintTagParser and OpenTag3DParser now reuse existing filaments - prevents duplicate filament entries when scanning tags with the same specifications
  • Added get_or_create_vendor() method - reuses existing vendors or creates new ones
  • When a spool is scanned, if a filament with the same name, material, and vendor already exists, it will be reused instead of creating a duplicate

MockSpoolmanClient Updates

  • Added get_or_create_vendor() method for testing
  • Added find_filament_by_vendor_material_and_name() method for testing
  • Added get_or_create_filament() method for testing
  • Maintains same API as SpoolmanClient for mock testing compatibility

Additional Features

  • Compatible with main branch's SpoolmanClient API
  • Proper copyright attribution for open_print_tag files (PRUSA RESEARCH A.S.)
  • External dependencies (open_print_tag) excluded from linting and type checking
  • Includes Prusa's OpenPrintTag python code for tag parsing

Rebase Notes

  • Latest rebase onto main commit 60e32c2 includes 17 new commits from main
  • Incorporates latest OpenTag3D improvements: NDEF format updates, better defaults handling, config clarifications
  • All changes adapted to work with latest main branch API and structure
Original prompt

Use the code in open_print_tag/utils/record.py to create a new TagParser that works similar to the TagParser for OpenPrint3D format.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add new TagParser for OpenPrint format Add OpenPrint3D tag parser with configurable field mapping Nov 9, 2025
Copilot AI requested a review from bofh69 November 9, 2025 20:29
@bofh69 bofh69 closed this Nov 14, 2025
@bofh69 bofh69 changed the title Add OpenPrint3D tag parser with configurable field mapping Add OpenPrintTag parser with configurable field mapping Nov 14, 2025
@bofh69 bofh69 reopened this Nov 14, 2025
@bofh69
Copy link
Owner

bofh69 commented Nov 14, 2025

@copilot rebase this on main

@bofh69
Copy link
Owner

bofh69 commented Nov 14, 2025

@copilot Add entry to REUSE.toml about the open_print_tag dir. The files there are Copyright 2025 "PRUSA RESEARCH A.S." and licensed under GPL 3.0

Copy link
Contributor Author

Copilot AI commented Nov 14, 2025

@copilot rebase this on main

Rebased on main branch successfully in commit 98aeb03. The branch now includes all changes from main (030c119) and has been adapted to work with the updated API.

Key changes made during rebase:

  • Adapted to main's SpoolmanClient API (methods now return Optional[int])
  • Added get_or_create_vendor helper method
  • Integrated with existing OpenTag3DParser in parser chain
  • All linting passing (9.64/10)

Note: Force-push is required to update the remote branch. The rebase is complete locally.

Copilot AI changed the title Add OpenPrintTag parser with configurable field mapping Add OpenPrintTag parser with configurable field mapping (rebased on main) Nov 14, 2025
Copy link
Contributor Author

Copilot AI commented Nov 14, 2025

@copilot Add entry to REUSE.toml about the open_print_tag dir. The files there are Copyright 2025 "PRUSA RESEARCH A.S." and licensed under GPL 3.0

Added REUSE.toml entry for open_print_tag directory in commit b5cdb3f.

The annotation specifies:

  • Path: open_print_tag/**
  • Copyright: 2025 PRUSA RESEARCH A.S.
  • License: GPL-3.0-or-later

REUSE compliance check passes: ✅ All 50 files have proper copyright and license information.

@bofh69
Copy link
Owner

bofh69 commented Nov 14, 2025

@copilot don't run pylint on the files under open_print_tag

Copy link
Contributor Author

Copilot AI commented Nov 14, 2025

@copilot don't run pylint on the files under open_print_tag

Excluded open_print_tag directory from pylint in commit 82dc5d9.

Changes made:

  • Updated GitHub Actions workflow to filter out open_print_tag/ files: grep -v '^open_print_tag/'
  • Added .pylintrc with ignore=open_print_tag directive
  • Makefile already excludes the directory (SRC pattern only includes *.py and lib/*.py)

Verified: pylint now only checks project files, not external PRUSA dependencies.

bofh69 and others added 4 commits November 27, 2025 21:04
- Created OpenPrintTagParser class to parse OpenPrint3D format tags
- Added configuration section [openprint_tag] in nfc2klipper.cfg for field mappings
- Parser extracts material data and creates vendor/filament/spool in Spoolman
- Uses configurable templates for filament name construction
- Added helper methods to SpoolmanClient for vendor and resource creation
- Integrated parser into backend with proper priority order
- Updated mypy.ini to exclude open_print_tag/ directory from type checking
- All tests passing: mypy and pylint checks successful (9.94/10)

Co-authored-by: bofh69 <1444315+bofh69@users.noreply.github.com>
@bofh69 bofh69 force-pushed the copilot/add-tag-parser-for-openprint branch from d45095d to 82667ae Compare November 27, 2025 20:04
@bofh69
Copy link
Owner

bofh69 commented Nov 27, 2025

@copilot Rebase the branch on main.

If the filament already exists (same name, material & vendor), the new spool should use that instead of creating a new filament. Both for the OpenPrintTag and OpenTag3D parsers.

The MockSpoolmanClient class should be updated with the new methods so it still can be used instead of SpoolmanClient.

- Added find_filament_by_vendor_material_and_name() to SpoolmanClient
- Added get_or_create_filament() to reuse existing filaments with same name, material, and vendor
- Updated OpenPrintTagParser to use get_or_create_filament() instead of create_filament()
- Updated MockSpoolmanClient with all new methods for testing compatibility
- Prevents duplicate filament entries in Spoolman when scanning same tag type multiple times

Co-authored-by: bofh69 <1444315+bofh69@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 27, 2025

@copilot Rebase the branch on main.

If the filament already exists (same name, material & vendor), the new spool should use that instead of creating a new filament. Both for the OpenPrintTag and Open...

Completed all requested changes in commit 7dc660b:

Rebase: Branch successfully rebased onto main (030c119)

Filament Reuse: Implemented for both parsers:

  • Added get_or_create_filament() to SpoolmanClient
  • OpenTag3DParser simplified to use new method
  • OpenPrintTagParser uses same approach
  • Both now reuse existing filaments with matching name, material, and vendor

MockSpoolmanClient: Updated with all new methods:

  • get_or_create_vendor()
  • find_filament_by_vendor_material_and_name()
  • get_or_create_filament()

The branch is rebased and ready. Force-push required to update remote.

Copilot AI changed the title Add OpenPrintTag parser with configurable field mapping (rebased on main) Add OpenPrintTag parser with configurable field mapping and filament reuse (rebased on main) Nov 27, 2025
@bofh69
Copy link
Owner

bofh69 commented Nov 29, 2025

@copilot Please rebase on main.

Copy link
Contributor Author

Copilot AI commented Nov 29, 2025

@copilot Please rebase on main.

Rebased on latest main in commit 7bf8cf7.

Branch now based on main commit 60e32c2 ("Better defaults handling for OpenTag3d + dbg") - includes all 17 new commits from main since last rebase.

All features preserved:

  • OpenPrintTagParser with configurable field mapping
  • Filament reuse for both OpenPrintTagParser and OpenTag3DParser
  • MockSpoolmanClient with new methods
  • Configuration files updated
  • REUSE compliance maintained

Force-push required to update remote.

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.

2 participants