Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
- Commit the release notes
- Bump the version number
- Push a release to pypi and npm
'''
release_notes_lines = get_release_notes(version)
if release_notes_lines is None:
print('No release notes: exiting')
exit()
update_release_notes(version, release_notes_lines)
with open('changelog.tmp', 'w') as f:
f.writelines(release_notes_lines)
run('git add docs/source/release_notes.rst')
run('git commit -m "Add release notes for version {}"'.format(version))
set_pyversion(version)
set_jsversion(version)
release_python_sdist()
os.chdir(os.path.join(GMAPS_DIR, 'js'))
try:
run('npm publish')
finally:
os.chdir(GMAPS_DIR)
def unit(ctx):
"""Run unit tests."""
run('py.test --cov {0} {1}'.format(COV_TARGET, TEST_TARGETS))
def check_if_logged_in_to_heroku(c):
if not local('heroku auth:whoami', warn=True):
raise Exit(
'Log-in with the "heroku login -i" command before running this '
'command.'
def layer2_dev_env():
# Get unused v4/v6 range for services
network_subnet_list = run('docker network inspect -f "{{ '
'range .IPAM.Config}}{{.Subnet}} {{end}}" kind', echo=True).stdout.strip().split(' ')
used_ipv4_list = run('docker network inspect -f '
'"{{range .Containers}}{{.IPv4Address}} {{end}}" kind', echo=True).stdout.strip().split(' ')
used_ipv6_list = run('docker network inspect -f '
'"{{range .Containers}}{{.IPv6Address}} {{end}}" kind', echo=True).stdout.strip().split(' ')
service_range = {}
for i in network_subnet_list:
network = ipaddress.ip_network(i)
if network.version == 6:
used_list = sorted(used_ipv6_list)
else:
used_list = sorted(used_ipv4_list)
# try to get 10 IP addresses after the last assigned node address in the kind network subnet
# if failed, just quit (recreate kind cluster might solve the situation)
service_ip_range_start = ipaddress.ip_interface(used_list[-1]) + 1
service_ip_range_end = ipaddress.ip_interface(used_list[-1]) + 11
if service_ip_range_start not in network:
raise Exit(message='network range %s is not in %s' % (service_ip_range_start, network))
if service_ip_range_end not in network:
def coverage():
"""coverage - check code coverage quickly with the default Python."""
run('coverage run --source collections_extended setup.py test')
run('coverage report -m')
run('coverage html')
run('open htmlcov/index.html')
log.info('collected test coverage stats')
def clean():
run("rm -rf build")
run("rm -rf dist")
run("rm -rf marshmallow.egg-info")
clean_docs()
print("Cleaned up.")
def create_env(name, requirements=False, self=False, force=False):
"""Create a new virtual environment"""
path = os.path.join(BASE, "build", "envs", name)
# Don't re-create the environment if force is False
if os.path.exists(path):
if force:
shutil.rmtree(path)
else:
return path
invoke.run("virtualenv -p %s %s" % (PYTHON, path))
if requirements:
invoke.run("%s/bin/pip install -r requirements-%s.txt" % (path, name))
if self:
invoke.run("%s/bin/pip install -e ." % path)
return path
def clean():
run("rm -rf build")
run("rm -rf dist")
run("rm -rf choosealicense_cli.egg-info")
print("Cleaned up.")
def coverage(missing=False):
"""Run the gmusicapi_wrapper tests using pytest-cov for coverage."""
cov_run = 'coverage run --source gmusicapi_wrapper -m py.test'
cov_report = 'coverage report'
if missing:
cov_report += ' -m'
run(cov_run)
run(cov_report)
def checks(ctx):
"""Fait les différents checks du programme."""
run("pydocstyle source")
run("pycodestyle source")