Skip to content
Snippets Groups Projects
Commit 70652e9a authored by Corné Lukken's avatar Corné Lukken
Browse files

Fix actually populating cookiecutter vars

parent eb4db91f
No related branches found
No related tags found
1 merge request!34Fix actually populating cookiecutter vars
{ {
"project_name": "My Awesome App", "project_name": "My Awesome App",
"project_slug": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_')|replace('.', '_')|trim() }}", "project_slug": "{{ cookiecutter.project_name.lower()|replace(' ', '_')|replace('-', '_')|replace('.', '_')|trim() }}",
"project_url": "git.astron.nl/{{ cookiecutter.project_slug }}", "project_url": "https://git.astron.nl/{{ cookiecutter.project_slug }}",
"description": "An example package for CI/CD working group" "description": "An example package for CI/CD working group"
} }
default: default:
image: $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG image:
name: $CI_REGISTRY_IMAGE/ci-build-runner:$CI_COMMIT_REF_SLUG
pull_policy: always
before_script: before_script:
- python --version # For debugging - python --version # For debugging
cache: cache:
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
![Build status]({{cookiecutter.project_url}}/badges/main/pipeline.svg) ![Build status]({{cookiecutter.project_url}}/badges/main/pipeline.svg)
![Test coverage]({{cookiecutter.project_url}}/badges/main/coverage.svg) ![Test coverage]({{cookiecutter.project_url}}/badges/main/coverage.svg)
<!-- ![Latest release](https://git.astron.nl/templates/python-package/badges/main/release.svg) --> <!-- ![Latest release]({{cookiecutter.project_url}}/badges/main/release.svg) -->
An example repository of an CI/CD pipeline for building, testing and publishing a python package. {{cookiecutter.description}}
## Installation ## Installation
``` ```
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
import os import os
from {{cookiecutter.project_slug}} import __version__ from {{cookiecutter.project_slug}}._version import __version__
# -- General configuration ---------------------------------------------------- # -- General configuration ----------------------------------------------------
......
[metadata] [metadata]
name = {{cookiecutter.project_slug}} name = {{cookiecutter.project_slug}}
description = An example package for CI/CD working group description = {{cookiecutter.description}}
long_description = file: README.md long_description = file: README.md
long_description_content_type = text/markdown long_description_content_type = text/markdown
url = https://git.astron.nl/templates/python-package url = {{cookiecutter.project_url}}
license = Apache License 2.0 license = Apache License 2.0
classifiers = classifiers =
Development Status :: 3 - Alpha Development Status :: 3 - Alpha
......
[tox] [tox]
# Generative environment list to test all supported Python versions # Generative environment list to test all supported Python versions
envlist = py3{8,9,10,11,12},black,pep8,pylint envlist = py3{9,10,11,12,13},black,pep8,pylint
minversion = 3.18.0 min_version = 4.3.3
requires =
tox-ignore-env-name-mismatch >= 0.2.0
[testenv] [testenv]
usedevelop = True usedevelop = True
...@@ -9,25 +11,24 @@ package = wheel ...@@ -9,25 +11,24 @@ package = wheel
wheel_build_env = .pkg wheel_build_env = .pkg
setenv = setenv =
LANGUAGE=en_US
LC_ALL=en_US.UTF-8
PYTHONWARNINGS=default::DeprecationWarning PYTHONWARNINGS=default::DeprecationWarning
deps = deps =
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt
-r{toxinidir}/tests/requirements.txt -r{toxinidir}/tests/requirements.txt
commands = commands =
{envpython} --version {envpython} --version
{envpython} -m pytest {envpython} -m pytest tests/{posargs}
[testenv:coverage] [testenv:coverage]
commands = commands =
{envpython} --version {envpython} --version
{envpython} -m pytest --cov-report term --cov-report xml --cov-report html --cov={{cookiecutter.project_slug}} {envpython} -m pytest --cov-report term --cov-report xml --cov-report html --cov={{cookiecutter.project_slug}} tests/{posargs}
# Use generative name and command prefixes to reuse the same virtualenv # Use generative name and command prefixes to reuse the same virtualenv
# for all linting jobs. # for all linting jobs.
[testenv:{pep8,black,pylint,format}] [testenv:{pep8,black,pylint,format}]
usedevelop = False usedevelop = False
package = editable
envdir = {toxworkdir}/linting envdir = {toxworkdir}/linting
commands = commands =
pep8: {envpython} -m flake8 --version pep8: {envpython} -m flake8 --version
......
...@@ -2,10 +2,3 @@ ...@@ -2,10 +2,3 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
""" {{cookiecutter.project_name}} """ """ {{cookiecutter.project_name}} """
try:
from importlib import metadata
except ImportError: # for Python<3.8
import importlib_metadata as metadata
__version__ = metadata.version("{{cookiecutter.project_slug}}")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment