Skip to content

Commit

Permalink
Resolve discussion in #128.
Browse files Browse the repository at this point in the history
Decided to put __init__.py and rename 'module_name' to 'package_name'
because it's a package. If advanced users want to make a namespace
package then they can just remove __init__.py. Keep project_slug as the
pip/pypi/repo name.
  • Loading branch information
samcunliffe committed Oct 24, 2023
1 parent f7bd811 commit bbc6dd4
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ repos:
hooks:
- id: ruff
args: ["--config", "pyproject.toml"]
exclude: "{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}"
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
hooks:
Expand All @@ -19,6 +20,7 @@ repos:
- id: mypy
args: [--config-file, pyproject.toml]
additional_dependencies: ["pytest"]
exclude: "{{cookiecutter.project_slug}}/src/{{cookiecutter.package_name}}"
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
Expand Down
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"github_username": "{{ cookiecutter.author_name.replace(' ', '-') }}",
"project_name": "Python Template",
"project_slug": "{{ cookiecutter.project_name.lower().replace(' ', '-').replace('_', '-') }}",
"module_name": "{{ cookiecutter.project_slug.replace('-', '_') }}",
"package_name": "{{ cookiecutter.project_slug.replace('-', '_') }}",
"project_short_description": "A cookieninja template with ARC recommendations.",
"funder": "JBFC: The Joe Bloggs Funding Council",
"licence": ["MIT", "BSD-3", "GPL-3.0"],
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ def project_config():
return {
"project_name": "Cookiecutter Test",
"expected_repo_name": "cookiecutter-test",
"expected_slug": "cookiecutter_test",
"expected_package_name": "cookiecutter_test",
}
6 changes: 2 additions & 4 deletions tests/test_package_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ def test_package_generation(
"LICENCE.md",
"pyproject.toml",
"src",
Path("src") / project_config["expected_slug"],
Path("src")
/ project_config["expected_slug"]
/ f"{project_config['expected_slug']}.py",
Path("src") / project_config["expected_package_name"],
Path("src") / project_config["expected_package_name"] / "__init__.py",
"tests",
Path(".github"),
Path(".github") / "workflows",
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_slug}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ pep8-naming.classmethod-decorators = [

[tool.setuptools_scm]
local_scheme = "no-local-version"
write_to = "src/{{ cookiecutter.module_name }}/_version.py"
write_to = "src/{{ cookiecutter.package_name }}/_version.py"

[tool.tomlsort]
all = true
Expand Down

0 comments on commit bbc6dd4

Please sign in to comment.