GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Allow setting target python version independently from the currently running python version · Issue #148 · dflook/python-minifier

Allow setting target python version independently from the currently running python version #148

New issue
Copy link
New issue
Copy link
Open
Open
Allow setting target python version independently from the currently running python version#148
Copy link

Description

@dfangl
dfangl
opened on Feb 4, 2026
Issue body actions

In this project, several minification decisions are based on the python version the minifier is currently running on:

Example:

python-minifier/src/python_minifier/expression_printer.py

Lines 739 to 742 in 3f4c582

if sys.version_info < (3, 12):
pep701 = False
else:
pep701 = True

This can lead to backwards incompatibility of the minified code, even if the original code might run on older python versions.
I'd like to propose a change to make this configurable - at least to target an older version than the one currently running.

Proposal

Add a target_version configuration option, which allows specification of a different target python version. The default could reasonably be the currently running one, for backwards compatibility.

I am not too familiar with the internal workings of this project, if a higher python version would be doable in all cases, but it could be limited to the currently running one and below.

I'm happy to give it a try, however I would like to start a discussion first if this is a sensible change / if it would be accepted, before opening up a PR.

Activity

  1. dflook commented on Feb 4, 2026

    @dflook
    dflook
    on Feb 4, 2026
    Owner
    More actions

    This is something i'd like to add and have taken a stab at a couple of times (see the old back-compat and target-version branches..)

    One problem is that we lean on the running interpreter a lot for parsing and evaluating things, so we can quite easily generate output for the current python version. Language features in newer Python versions would not be possible to parse, so it doesn't make sense to be able to target them.

    Just explicitly specifying a single target version also doesn't seem entirely useful to me, as that is easily achieved by running python-minifier installed for the target python version.

    Ideally there would be something like min-target-version (and possibly max) such that you could minify a module in a way to maximise compatibility with a range of Python versions.

    I'm not sure i'm going to revisit the idea any time soon, so you are quite welcome to give it a go 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.