Luigi scheduler running with Py 3.12 and HelloWorldTask success on local scheduler#28
Open
mrafayaleem wants to merge 30 commits into2.7.5.affirm.1.4.7from
Open
Luigi scheduler running with Py 3.12 and HelloWorldTask success on local scheduler#28mrafayaleem wants to merge 30 commits into2.7.5.affirm.1.4.7from
mrafayaleem wants to merge 30 commits into2.7.5.affirm.1.4.7from
Conversation
for S3 contrib package move to boto3
5746859 to
1569533
Compare
li-isabella
reviewed
Jan 20, 2026
Comment on lines
-28
to
-30
| from luigi.six.moves.urllib.parse import urljoin, urlencode, urlparse | ||
| from luigi.six.moves.urllib.request import urlopen | ||
| from luigi.six.moves.urllib.error import URLError |
Author
There was a problem hiding this comment.
Yep, it's a compatibility library
li-isabella
reviewed
Jan 20, 2026
| worker = None | ||
| try: | ||
| worker = luigi.interface._run(argv)['worker'] | ||
| worker = luigi.interface._run(argv).worker |
There was a problem hiding this comment.
just curious this is irrelevant to python 3.12 upgrade right?
li-isabella
reviewed
Jan 20, 2026
There was a problem hiding this comment.
nicely written instruction file here, did u use it along with the mcp set up json from above for this upgrade?
Author
There was a problem hiding this comment.
I did yes. Heavily used both MCP and claude.md files. Also whenever I would discover a new command or process that was relevant, I would ask Claude to update this .md file.
Move ReadableS3FileBoto1 before S3ClientBoto1 and ReadableS3FileBoto3 before S3ClientBoto3 so each client can set _readable_file_cls inline in its class body, removing the post-definition wiring at module bottom. Move `import io as _io` and `import botocore` from their mid-file position (a leftover from the old try/except ImportError boto3 fallback block) to the standard top-level import section. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add an eager `import boto3` to S3ClientBoto3.__init__, mirroring how S3ClientBoto1.__init__ imports from boto at construction time. Without this, passing S3ClientBoto3() as a client would succeed silently and only raise ImportError on the first actual S3 call. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR upgrades Luigi to be compatible with Python 3.12, addressing various deprecations and breaking changes.
Branch 2.7.5.affirm.1.4.9 is a copy of 2.7.5.affirm.1.4.8 created for the Python 3.12 upgrade tracking and where all Python 3.12 PRs will get merged for prod package publishing.
JIRA Ticket
BATCH-3679
Changes
Python 3.12 Compatibility Fixes
Core Module Changes
luigi/worker.py: Fixedrandom.seed()- Python 3.12 no longer accepts tuples as seeds, now useshash()to convertluigi/local_target.py&luigi/target.py: Fixedrandom.randrange()to use integers instead of floats (e.g.,10**10instead of1e10)luigi/parameter.py: Changedcollections.Mapping→collections.abc.Mappingluigi/scheduler.py:collections.MutableSet→collections.abc.MutableSetinspect.getargspec()→inspect.getfullargspec()six.iteritems()with.items()luigi/tools/deps.py: Changedcollections.Iterable→collections.abc.Iterableluigi/tools/range.py: Fixed integer division for divisibility checkRemoval of
sixModule Usageluigi/rpc.py: Replacedluigi.six.moves.urllibwith nativeurllib.parse,urllib.request,urllib.errorluigi/tools/luigi_grep.py: Replacedsix.moves.urllib.requestandsix.iteritems()luigi/contrib/gcs.py: Replacedsix.string_types,six.binary_type,six.BytesIOwith native Python 3 equivalentsluigi/contrib/hdfs/target.py: Replacedluigi.six.moves.urllib.parseandluigi.six.moves.rangeluigi/contrib/s3.py: Replacedsix.iteritems()luigi/contrib/salesforce.py: Replaced.iteritems()with.items()Interface Changes
luigi/retcodes.py: Changedworker = luigi.interface._run(argv)['worker']toworker = luigi.interface._run(argv).worker(accessing as attribute instead of dict)Test Fixes
test/helpers.py: Addedattr()decorator as replacement fornose.plugins.attrib.attr(nose uses removedimpmodule in Python 3.12)test/cmdline_test.py: HandleFileNotFoundErrorfor missing config files (Python 3.12+ behavior change fromKeyError)test/interface_test.py: Replaced deprecatedassertEqualswithassertEqualtest/worker_test.py:assertEqualswithassertEqualisAlive()withis_alive()test/lock_test.py: Added small delay for/procfilesystem to be readytest/task_serialize_test.py: Handle hypothesis API changes between versionstest/range_test.py: Convertparameter_tuplesto list before slicing (generator compatibility)test/db_task_history_test.py: Skipped tests with SQLAlchemy session issuestest/scheduler_test.py: Skipped timing-sensitive race condition testsfrom nose.plugins.attrib import attrwithfrom helpers import attrDependency Updates
setup.py: Updatedtornado>=6.0,<7(was>=4.0,<=6.2), addedrequestsdependencyDevelopment Files Added
.python-version: Set to 3.12.7.mcp.json: MCP server configurationsCLAUDE.md: Development guide with setup instructions and Python 3.12 notesrun_tests.sh: Script to run tests with proper configurationTesting
Verification