diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8362e2a..3b64520 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,9 +25,9 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.10' - name: Install Python dependencies diff --git a/copier.yml b/copier.yml index 92ac306..3511d3d 100644 --- a/copier.yml +++ b/copier.yml @@ -2,11 +2,19 @@ project_name: type: str help: What is the name of your project? default: example_project + validator: >- + {% if not (project_name | regex_search('^[a-zA-Z][a-zA-Z0-9\_]+$')) %} + project_name must start with a letter, followed one or more letters, digits or underscores all lowercase. + {% endif %} module_name: type: str help: What is your python module name? If left blank, will default to project_name. default: "{{project_name}}" + validator: >- + {% if not (module_name | regex_search('^[a-zA-Z][a-zA-Z0-9\_]+$')) %} + module_name must start with a letter, followed one or more letters, digits or underscores all lowercase. + {% endif %} author_name: type: str diff --git a/python-project-template/.github/workflows/python-package.yml.jinja b/python-project-template/.github/workflows/python-package.yml.jinja index 2ab100b..1f2fdc8 100644 --- a/python-project-template/.github/workflows/python-package.yml.jinja +++ b/python-project-template/.github/workflows/python-package.yml.jinja @@ -18,9 +18,9 @@ jobs: python-version: ['3.8', '3.9', '3.10'] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python {% raw %}${{ matrix.python-version }}{% endraw %} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: {% raw %}${{ matrix.python-version }}{% endraw %} - name: Install dependencies @@ -32,7 +32,9 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Run unit tests with pytest run: | - python -m pytest --cov=. --cov-report=xml + python -m pytest tests --cov={{module_name}} --cov-report=xml + - name: Upload coverage report to codecov + uses: codecov/codecov-action@v3 - name: Analyze code with pylint run: | pylint -rn -sn --recursive=y ./src \ No newline at end of file diff --git a/python-project-template/.pre-commit-config.yaml b/python-project-template/.pre-commit-config.yaml index 7f8a8ce..2d78ba7 100644 --- a/python-project-template/.pre-commit-config.yaml +++ b/python-project-template/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: - id: pytest-check name: pytest-check description: Run unit tests with pytest. - entry: pytest --cov=. --cov-report=html + entry: pytest --cov=./src --cov-report=html language: system pass_filenames: false always_run: true diff --git a/python-project-template/pyproject.toml.jinja b/python-project-template/pyproject.toml.jinja index c774116..7a6a1f1 100644 --- a/python-project-template/pyproject.toml.jinja +++ b/python-project-template/pyproject.toml.jinja @@ -40,3 +40,4 @@ build-backend = "setuptools.build_meta" disable = """ missing-module-docstring, """ +ignore-patterns = "^_.*" # Ignore files that start with an underscore, i.e. _version.py