Skip to content

Commit f0a4c2c

Browse files
committed
Merge remote-tracking branch 'origin/main' into 237-issue-template-for-citation-data
2 parents 35722c1 + b01915e commit f0a4c2c

13 files changed

Lines changed: 68 additions & 86 deletions

File tree

.mlc-config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
},
1313
{
1414
"pattern": "^https://bestpractices.coreinfrastructure.org/projects/<replace-with-created-project-identifier>"
15+
},
16+
{
17+
"pattern": "^.github/workflows/sonarcloud.yml$"
1518
}
1619
],
1720
"replacementPatterns": [

tests/test_project.py

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import os
22
import subprocess
3-
import shlex
3+
from sys import platform
4+
from typing import Sequence
5+
6+
import pytest
47

58

69
def test_project_folder(cookies):
@@ -12,25 +15,47 @@ def test_project_folder(cookies):
1215
assert project.project.isdir()
1316

1417

15-
def run(command: str, dirpath: os.PathLike) -> subprocess.CompletedProcess:
16-
return subprocess.run(shlex.split(command),
18+
def run(args: Sequence[str], dirpath: os.PathLike) -> subprocess.CompletedProcess:
19+
return subprocess.run(args=args,
1720
stdout=subprocess.PIPE,
1821
stderr=subprocess.PIPE,
1922
cwd=dirpath,
2023
encoding="utf-8")
2124

2225

23-
def test_pytest(cookies):
26+
@pytest.fixture
27+
def baked_with_development_dependencies(cookies):
2428
result = cookies.bake()
25-
env_output = run('python3 -m venv env', result.project)
29+
env_output = run(['python3', '-m', 'venv', 'env'], result.project)
2630
assert env_output.returncode == 0
27-
latest_pip_output = run('env/bin/pip3 install --upgrade pip setuptools', result.project)
31+
env_bin = 'env/Scripts/' if platform.startswith("win") else 'env/bin/'
32+
latest_pip_output = run([f'{env_bin}pip3', 'install', '--upgrade', 'pip', 'setuptools'], result.project)
2833
assert latest_pip_output.returncode == 0
29-
pip_output = run('env/bin/pip3 install --editable .[dev]', result.project)
34+
pip_output = run([f'{env_bin}pip3', 'install', '--editable', '.[dev]'], result.project)
3035
assert pip_output.returncode == 0
36+
return result.project, env_bin
37+
3138

32-
pytest_output = run('env/bin/pytest', result.project)
39+
def test_pytest(baked_with_development_dependencies):
40+
project_dir, env_bin = baked_with_development_dependencies
41+
pytest_output = run([f'{env_bin}pytest'], project_dir)
3342
assert pytest_output.returncode == 0
34-
assert '== 3 passed in' in pytest_output.stdout
35-
assert (result.project / 'coverage.xml').exists()
36-
assert (result.project / 'htmlcov/index.html').exists()
43+
assert '== 3 passed in' in pytest_output.stdout
44+
assert (project_dir / 'coverage.xml').exists()
45+
assert (project_dir / 'htmlcov/index.html').exists()
46+
47+
48+
def test_subpackage(baked_with_development_dependencies):
49+
project_dir, env_bin = baked_with_development_dependencies
50+
subpackage = (project_dir / 'my_python_package' / 'mysub')
51+
subpackage.mkdir()
52+
(subpackage / '__init__.py').write_text('FOO = "bar"', encoding="utf-8")
53+
54+
subsubpackage = (project_dir / 'my_python_package' / 'mysub' / 'mysub2')
55+
subsubpackage.mkdir()
56+
(subsubpackage / '__init__.py').write_text('FOO = "bar"', encoding="utf-8")
57+
58+
build_output = run([f'{env_bin}python3', 'setup.py', 'build'], project_dir)
59+
assert build_output.returncode == 0
60+
assert (project_dir / 'build' / 'lib' / 'my_python_package' / 'mysub' / '__init__.py').exists()
61+
assert (project_dir / 'build' / 'lib' / 'my_python_package' / 'mysub' / 'mysub2' / '__init__.py').exists()
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: 'Next step: Sonarcloud integration'
3-
labels:
4-
- 'action required'
53
---
64

75
Continuous code quality can be handled by [Sonarcloud](https://sonarcloud.io/). This repository is configured to use Sonarcloud to perform quality analysis and code coverage report on each push.
@@ -12,7 +10,7 @@ In order to configure Sonarcloud analysis [GitHub Action workflow](.github/workf
1210
1. login with your GitHub account
1311
1. add Sonarcloud organization or reuse existing one
1412
1. set up a repository
15-
1. go to [new code definition administration page](https://sonarcloud.io/project/new_code?id={{ cookiecutter.github_organization }}_{{ cookiecutter.project_name }}) and select `Number of days` option
13+
1. go to [new code definition administration page](https://sonarcloud.io/project/new_code?id={{cookiecutter.github_organization}}_{{cookiecutter.project_name}}) and select `Number of days` option
1614
1. To be able to run the analysis:
1715
1. a token must be created at [Sonarcloud account](https://sonarcloud.io/account/security/)
18-
1. the created token must be added as `SONAR_TOKEN` to [secrets on GitHub](https://github.com/{{ cookiecutter.github_organization }}/{{ cookiecutter.project_name }}/settings/secrets/actions)
16+
1. the created token must be added as `SONAR_TOKEN` to [secrets on GitHub](https://github.com/{{cookiecutter.github_organization}}/{{cookiecutter.project_name}}/settings/secrets/actions)
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: 'Next step: Zenodo integration'
3-
labels:
4-
- 'action required'
53
---
64

75
Zenodo integration instructions.
Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
---
2-
title: 'Next step: readthedocs'
3-
labels:
4-
- 'action required'
2+
title: 'Next step: Read the Docs'
53
---
64

7-
Readthedocs instructions.
5+
Your Python package should have publicly available documentation, including API documentation for your users.
6+
[Read the Docs](https://readthedocs.org) can host your user documentation for you.
7+
8+
To host the documentation of this repository please perform the following instructions:
9+
10+
1. go to [Read the Docs](https://readthedocs.org/dashboard/import/?)
11+
1. log in with your GitHub account
12+
1. find `{{ cookiecutter.github_organization }}/{{ cookiecutter.project_name }}` in list and press `+` button.
13+
* If repository is not listed,
14+
1. go to [Read the Docs GitHub app](https://github.com/settings/connections/applications/fae83c942bc1d89609e2)
15+
2. make sure {{ cookiecutter.github_organization }} has been granted access.
16+
3. reload repository list on Read the Docs import page
17+
1. wait for the first build to be completed at <https://readthedocs.org/projects/{{ cookiecutter.project_name }}/builds>
18+
1. check that the link of the documentation badge in the [README.md]({{ cookiecutter.repository }}) works
19+
20+
See [README.dev.md#]({{cookiecutter.repository}}/blob/main/README.dev.md#generating-the-api-docs) how to build documentation site locally.

{{cookiecutter.project_name}}/.github/next_steps/04_citation.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: 'Next step: Citation data'
3-
labels:
4-
- 'action required'
53
---
64

75
The repository has been set up with a [GitHub action](https://github.com/marketplace/actions/cffconvert) that monitors your citation data. It checks the following 6 aspects:
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
title: 'Next step: Linting'
3-
labels:
4-
- 'action required'
53
---
64

75
Linting instructions

{{cookiecutter.project_name}}/.github/next_steps/labels.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

{{cookiecutter.project_name}}/.github/workflows/next_steps.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ jobs:
55
runs-on: ubuntu-latest
66
steps:
77
- uses: actions/checkout@v2
8-
- name: Create labels
9-
uses: crazy-max/ghaction-github-labeler@v3
10-
with:
11-
github-token: ${{ secrets.GITHUB_TOKEN }}
12-
yaml-file: .github/next_steps/labels.yml
13-
skip-delete: true
148
- name: Create Sonarcloud integration issue
159
uses: JasonEtco/create-an-issue@v2
1610
env:
@@ -51,7 +45,7 @@ jobs:
5145
echo 'Created issues that must be completed to have fully working Python package:
5246
* Sonarcloud integration ${{ steps.sonarcloud.outputs.url }}
5347
* Zenodo integration ${{ steps.zenodo.outputs.url }}
54-
* Readthedocs instructions ${{ steps.readthedocs.outputs.url }}
48+
* Read the Docs instructions ${{ steps.readthedocs.outputs.url }}
5549
* Citation data ${{ steps.citation.outputs.url }}
5650
* Linting fixes ${{ steps.linting.outputs.url }}'
5751
- name: Cleanup files needed to create next steps issues

{{cookiecutter.project_name}}/.github/workflows/publish.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)