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

Adjust no-smart-version option to enable offline builds #225

Merged
merged 1 commit into from
Sep 7, 2023

Conversation

mbalatsko
Copy link
Contributor

@mbalatsko mbalatsko commented Sep 5, 2023

Notes

There are use cases, in which some might benefit from building stub packages from source, without making PyPI requests. Currently, any cli options combination allows you to achieve it.

This PR introduces a adjustment of no-smart-version option to serve these purpose

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

All of these are optional:

  • I have performed a self-review of my own code
  • I have run ./scripts/before_commit.sh to follow the style guidelines of this project
  • I have tested my code changes

@vemel
Copy link
Collaborator

vemel commented Sep 5, 2023

Thank you for your pull request.

Definitely, there should be a way to run builder in offline mode. I think --offline flag can be combined with --no-smart-version. Also, --skip-published flag can be ignored if --no-smart-version is provided.

So, we can use something like this:

    def _get_package_version(self, pypi_name: str, version: str) -> str | None:
        if self.disable_smart_version:
            return version

        pypi_manager = PyPIManager(pypi_name)
        if not pypi_manager.has_version(version):
            return version

        if self.skip_published:
            self.logger.info(f"Skipping {pypi_name} {version}, already on PyPI")
            return None

        return pypi_manager.get_next_version(version)

And CLI args help in cli_parser.py

What do you think?

@vemel vemel added the 👋 response needed Awaiting response from a reporter label Sep 5, 2023
@vemel
Copy link
Collaborator

vemel commented Sep 5, 2023

GitHub reviews are down, unfortunately. I will leave a review ASAP.

@mbalatsko
Copy link
Contributor Author

I like this idea, it makes great sense and does not complicate api. Let me make changes!

@vemel
Copy link
Collaborator

vemel commented Sep 5, 2023

Awesome! Please update your PR once you have time.

mypy_boto3_builder/cli_parser.py Outdated Show resolved Hide resolved
@mbalatsko mbalatsko changed the title Add option to allow perform packages build offline Adjust no-smart-version option to enable offline builds Sep 6, 2023
@mbalatsko mbalatsko requested a review from vemel September 6, 2023 08:09
@vemel
Copy link
Collaborator

vemel commented Sep 7, 2023

LGTM! Thank you for your contribution

@vemel vemel merged commit 172fd5b into youtype:main Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👋 response needed Awaiting response from a reporter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants