Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix repo metadata #307

Merged
merged 7 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/assets/cookiecutter-scverse-instance.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author_full_name": "scverse community",
"author_email": "[email protected]",
"github_user": "scverse",
"project_repo": "https://github.com/scverse/cookiecutter-scverse-instance",
"github_repo": "cookiecutter-scverse-instance",
"license": "BSD 3-Clause License",
"_copy_without_render": [
".github/workflows/**.yaml",
Expand Down
10 changes: 4 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
.DS_Store
*~

# Caches
__pycache__/
.*cache/

# Distribution / packaging
/build/
/dist/
/*.egg-info/

# Tests and coverage
__pycache__/
.ruff_cache/
/.pytest_cache/
/.cache/
/data/
/node_modules/

Expand Down
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author_full_name": "Your Name",
"author_email": "[email protected]",
"github_user": "your_github_username",
"project_repo": "https://github.com/{{ cookiecutter.github_user }}/{{ cookiecutter.project_name }}",
"github_repo": "{{ cookiecutter.project_name }}",
"license": [
"MIT License",
"BSD 2-Clause License",
Expand Down
31 changes: 31 additions & 0 deletions scripts/tests/test_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from __future__ import annotations

import re
from pathlib import Path
from typing import TYPE_CHECKING

import pytest
from cookiecutter.main import cookiecutter

if TYPE_CHECKING:
from collections.abc import Mapping
from typing import Any


HERE = Path(__file__).parent


@pytest.mark.parametrize(
("params", "path", "pattern"),
[
({}, "docs/conf.py", r'"github_repo": project_name,'),
({"github_repo": "floob"}, "docs/conf.py", r'"github_repo": "floob",'),
],
)
def test_build(tmp_path: Path, params: Mapping[str, Any], path: Path | str, pattern: re.Pattern | str):
cookiecutter(str(HERE.parent.parent), output_dir=tmp_path, no_input=True, extra_context=params)
proj_dir = tmp_path / "project-name"
assert proj_dir.is_dir()
path = proj_dir / path
pattern = re.compile(pattern, re.MULTILINE)
assert pattern.search(path.read_text())
5 changes: 2 additions & 3 deletions scripts/tests/test_cruft.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ class MockRelease:
@pytest.fixture
def con(response_mock) -> GitHubConnection:
resp = json.dumps({"login": "scverse-bot"})
with catch_warnings():
with response_mock(f"GET https://api.github.com:443/users/scverse-bot -> 200 :{resp}"):
return GitHubConnection("scverse-bot")
with catch_warnings(), response_mock(f"GET https://api.github.com:443/users/scverse-bot -> 200 :{resp}"):
return GitHubConnection("scverse-bot")


@pytest.fixture
Expand Down
7 changes: 1 addition & 6 deletions {{cookiecutter.project_name}}/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,12 @@ buck-out/
# Compiled files
.venv/
__pycache__/
.mypy_cache/
.ruff_cache/
.*cache/

# Distribution / packaging
/build/
/dist/
/*.egg-info/

# Tests and coverage
/.pytest_cache/
/.cache/
/data/
/node_modules/

Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.project_name}}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Documentation][badge-docs]][link-docs]

[badge-tests]: https://img.shields.io/github/actions/workflow/status/{{ cookiecutter.github_user }}/{{ cookiecutter.project_name }}/test.yaml?branch=main
[link-tests]: {{ cookiecutter.project_repo }}/actions/workflows/test.yml
[link-tests]: https://github.com/{{ cookiecutter.github_user }}/{{ cookiecutter.github_repo }}/actions/workflows/test.yml
[badge-docs]: https://img.shields.io/readthedocs/{{ cookiecutter.project_name }}

{{ cookiecutter.project_description }}
Expand Down Expand Up @@ -33,7 +33,7 @@ pip install {{ cookiecutter.project_name }}
1. Install the latest development version:

```bash
pip install git+{{ cookiecutter.project_repo }}.git@main
pip install git+https://github.com/{{ cookiecutter.github_user }}/{{ cookiecutter.github_repo }}.git@main
```

## Release notes
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_name}}/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
html_context = {
"display_github": True, # Integrate GitHub
"github_user": "{{cookiecutter.github_user}}",
"github_repo": "{{cookiecutter.project_repo}}",
"github_repo": {% if cookiecutter.project_name == cookiecutter.github_repo %}project_name{% else %}"{{cookiecutter.github_repo}}"{% endif %},
"github_version": "main",
"conf_py_path": "/docs/",
}
Expand Down
5 changes: 3 additions & 2 deletions {{cookiecutter.project_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ authors = [
maintainers = [
{name = "{{ cookiecutter.author_full_name }}", email = "{{ cookiecutter.author_email }}"},
]
# https://docs.pypi.org/project_metadata/#project-urls
urls.Documentation = "https://{{ cookiecutter.project_name }}.readthedocs.io/"
urls.Source = "{{ cookiecutter.project_repo }}"
urls.Home-page = "{{ cookiecutter.project_repo }}"
urls.Source = "https://github.com/{{ cookiecutter.github_user }}/{{ cookiecutter.github_repo }}"
urls.Homepage = "https://github.com/{{ cookiecutter.github_user }}/{{ cookiecutter.github_repo }}"
dependencies = [
"anndata",
# for debug logging (referenced from the issue template)
Expand Down
Loading