Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #93 --requirements and --project flags ignored upgrade_type #94

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

max-nicholson
Copy link
Contributor

Fixes #93

Proposed Changes

  • If --requirements or --project flags are used, current_version for
    Packages was equal to the specifier in the requirements file
    eg. requests==2.24.0 showed current_version as ==2.24.0 rather than
    just 2.24.0
    This then caused the upgrade_type check later to fail (as the ==
    version prefix made the version difference calculation incorrect

    Requirements will now include the version only if an exact version is
    specified, otherwise the installed version is used.
    If not installed, the entire specifier is used (eg. ~=1.0)

If `--requirements` or `--project` flags are used, current_version for
Packages was equal to the specifier in the requirements file
eg. requests==2.24.0 showed current_version as `==2.24.0` rather than
just `2.24.0`
This then caused the `upgrade_type` check later to fail (as the `==`
version prefix made the version difference calculation incorrect

Requirements will now include the version only if an exact version is
specified, otherwise the installed version is used.
If not installed, the entire specifier is used (eg. `~=1.0`)
`test_command` hangs forever on Windows (see achillesrasquinha#78), so CI runs for
the full 6hrs for each Windows run
Until achillesrasquinha#78 is resolved, test should be skipped so the Windows CI can at
least test the rest of the codebase
@max-nicholson max-nicholson changed the title fix-93 fix: #93 --requirements and --project flags ignored upgrade_type Jan 30, 2021
@max-nicholson
Copy link
Contributor Author

Noticed while looking at this that https://github.com/achillesrasquinha/pipupgrade/blob/1ec3d5fd779fd8aff008be1fe2ec72888a8cd494/src/pipupgrade/commands/helper.py#L265, when we get the final list of packages to show the user in the interactive window, the packages list gets reassigned (so the first list is ignored).

Wasn't sure if it's safe to combine into one large or chain, so thought I'd mention it

InstallRequirement.__str__ method is called during Package.__init__ for
logging.
__str__ with no `req` on pip 9 returned None, causing an error
__str__ on pip >9 still returned a string, so worked fine
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.

Upgrade type ignored with --requirements or --project
1 participant