def publish(autoclean, dry_run): """Publishes (uploads) all submodules to PyPI. Appropriate credentials must be available to twine, e.g. in a ~/.pypirc file, and users must be permissioned as maintainers on the PyPI projects. Publishing will fail if versions (git tags and Python versions) are not in lockstep, if the current commit is not tagged, or if there are untracked changes. """ assert os.getenv("SLACK_RELEASE_BOT_TOKEN"), "No SLACK_RELEASE_BOT_TOKEN env variable found." try: RCParser.from_file() except ConfigFileError: raise ConfigFileError(PYPIRC_EXCEPTION_MESSAGE) assert "\nwheel" in subprocess.check_output(["pip", "list"]).decode("utf-8"), ( "You must have wheel installed in order to build packages for release -- run " "`pip install wheel`." ) assert which_("twine"), ( "You must have twine installed in order to upload packages to PyPI -- run " "`pip install twine`." ) assert which_("yarn"), ( "You must have yarn installed in order to build dagit for release -- see " "https://yarnpkg.com/lang/en/docs/install/" ) dmp = DagsterModulePublisher() checked_version = dmp.check_version() click.echo("... and match git tag on most recent commit...") git_check_status() click.echo("... and that there is no cruft present...") dmp.check_for_cruft(autoclean) click.echo("... and that the directories look like we expect") dmp.check_directory_structure() click.echo("Publishing packages to PyPI...") dmp.publish_all(dry_run=dry_run) parsed_version = packaging.version.parse(checked_version) if not parsed_version.is_prerelease and not dry_run: release_notes_url = "https://github.com/dagster-io/dagster/releases/tag/{version}".format( version=checked_version ) slack_client = slack.WebClient(os.environ["SLACK_RELEASE_BOT_TOKEN"]) slack_client.chat_postMessage( channel="#general", text=( "{git_user} just published a new version: {version}. " "See {release_notes_url} for the release notes." ).format( git_user=git_user(), version=checked_version, release_notes_url=release_notes_url ), )
def publish(autoclean, dry_run): '''Publishes (uploads) all submodules to PyPI. Appropriate credentials must be available to twine, e.g. in a ~/.pypirc file, and users must be permissioned as maintainers on the PyPI projects. Publishing will fail if versions (git tags and Python versions) are not in lockstep, if the current commit is not tagged, or if there are untracked changes. ''' assert os.getenv('SLACK_RELEASE_BOT_TOKEN' ), 'No SLACK_RELEASE_BOT_TOKEN env variable found.' try: RCParser.from_file() except ConfigFileError: raise ConfigFileError(PYPIRC_EXCEPTION_MESSAGE) assert '\nwheel' in subprocess.check_output([ 'pip', 'list' ]).decode('utf-8'), ( 'You must have wheel installed in order to build packages for release -- run ' '`pip install wheel`.') assert which_('twine'), ( 'You must have twine installed in order to upload packages to PyPI -- run ' '`pip install twine`.') assert which_('yarn'), ( 'You must have yarn installed in order to build dagit for release -- see ' 'https://yarnpkg.com/lang/en/docs/install/') dmp = DagsterModulePublisher() checked_version = dmp.check_versions() click.echo('... and match git tag on most recent commit...') git_check_status() click.echo('... and that there is no cruft present...') dmp.check_for_cruft(autoclean) click.echo('... and that the directories look like we expect') dmp.check_directory_structure() click.echo('Publishing packages to PyPI...') dmp.publish_all(dry_run=dry_run) parsed_version = packaging.version.parse(checked_version['__version__']) if not parsed_version.is_prerelease and not dry_run: slack_client = slackclient.SlackClient( os.environ['SLACK_RELEASE_BOT_TOKEN']) slack_client.api_call( 'chat.postMessage', channel='#general', text=( '{git_user} just published a new version: {version}.').format( git_user=git_user(), version=checked_version['__version__']), )