Best Python code snippet using tox_python
setup.py
Source:setup.py
1#!/usr/bin/env python2"""3Setup script for release_changelog4=========================================5Call from command line as::6 python setup.py --help7to see the options available.8"""9from setuptools import setup10from setuptools import find_packages11try:12 import versioneer13 __version__ = versioneer.get_version()14 cmdclass = versioneer.get_cmdclass()15except AttributeError:16 __version__ = '0.0.0'17 cmdclass = None18__author__ = 'David Pugh'19__email__ = 'djpugh@gmail.com'20description = 'Create a Changelog section from (GitHub) Releases'21with open('README.rst') as f:22 readme = f.read()23 f.close()24# We are going to take the approach that the requirements.txt specifies25# exact (pinned versions) to use but install_requires should only26# specify package names27# see https://caremad.io/posts/2013/07/setup-vs-requirement/28# install_requires should specify abstract requirements e.g.::29#30# install_requires = ['requests']31#32# whereas the requirements.txt file should specify pinned versions to33# generate a repeatable environment34kwargs = dict(name='release_changelog',35 version=__version__,36 author=__author__,37 author_email=__email__,38 classifiers=[],39 packages=find_packages('src'),40 package_dir={'': 'src'},41 requires=[],42 install_requires=[],43 provides=['release_changelog'],44 test_suite='tests',45 description=description,46 long_description=readme,47 license="MIT",48 entry_points={'release_changelog.providers': ['github=release_changelog.providers.github:GitHubProvider']},49 package_data={'': ['*.rst',50 'requirements.txt',51 '*.ini',52 '*.cfg']}53 )54if cmdclass is not None:55 kwargs['cmdclass'] = cmdclass...
prepare_release.py
Source:prepare_release.py
1import os2import re3import sys4from datetime import datetime5from base import CHANGELOG_FILE, get_release_info, run_process6sys.path.append(os.path.dirname(__file__)) # noqa7if __name__ == "__main__":8 POETRY_DUMP_VERSION_OUTPUT = re.compile(9 r"Bumping version from \d+\.\d+\.\d+ to (?P<version>\d+\.\d+\.\d+)"10 )11 CHANGELOG_HEADER_SEPARATOR = "========="12 type_, release_changelog = get_release_info()13 output = run_process(["poetry", "version", type_])14 version_match = POETRY_DUMP_VERSION_OUTPUT.match(output)15 if not version_match:16 print("Unable to bump the project version using poetry")17 sys.exit(1)18 new_version = version_match.group("version")19 current_date = datetime.utcnow().strftime("%Y-%m-%d")20 old_changelog_data = []21 header = []22 with open(CHANGELOG_FILE, "r") as f:23 lines = f.readlines()24 for index, line in enumerate(lines):25 if CHANGELOG_HEADER_SEPARATOR != line.strip():26 continue27 old_changelog_data = lines[index + 1 :]28 header = lines[: index + 1]29 break30 with open(CHANGELOG_FILE, "w") as f:31 f.write("".join(header))32 new_version_header = f"{new_version} - {current_date}"33 f.write(f"\n{new_version_header}\n")34 f.write(f"{'-' * len(new_version_header)}\n\n")35 f.write(release_changelog)36 f.write("\n")...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!