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

Adds prompt for package name #182

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 3 additions & 2 deletions cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"project_name": "ProjectName",
"repo_name": "{{ cookiecutter.project_name.lower().replace(' ', '_') }}",
"first_module_name": "{{ cookiecutter.repo_name.lower().replace(' ', '_') }}",
"repo_name": "{{ cookiecutter.project_name.lower().replace(' ', '_') }}",
"package_name": "{{ cookiecutter.repo_name.lower().replace(' ', '_').replace('-', '_') }}",
"first_module_name": "{{ cookiecutter.package_name }}",
"author_name": "Your name (or your organization/company/team)",
"author_email": "Your email (or your organization/company/team)",
"description": "A short description of the project (less than one line).",
Expand Down
4 changes: 2 additions & 2 deletions hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
MODULE_REGEX = r'^[_a-zA-Z][_a-zA-Z0-9]+$'
EMAIL_REGEX = r'[^@]+@[^@]+\.[^@]+'

repo_name = '{{ cookiecutter.repo_name }}'
package_name = '{{ cookiecutter.package_name }}'
module_name = '{{ cookiecutter.first_module_name }}'

author_email = '{{ cookiecutter.author_email }}'

for key in [repo_name, module_name]:
for key in [package_name, module_name]:
if not re.match(MODULE_REGEX, key):
print(key, re.match(MODULE_REGEX, key))
print('ERROR: "{}" is not a valid Python module name!'.format(key))
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.repo_name}}/.gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{{cookiecutter.repo_name}}/_version.py export-subst
{{cookiecutter.package_name}}/_version.py export-subst
2 changes: 1 addition & 1 deletion {{cookiecutter.repo_name}}/.github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
shell: bash -l {0}
{%- endif %}
run: |
pytest -v --cov={{ cookiecutter.repo_name }} --cov-report=xml --color=yes {{ cookiecutter.repo_name }}/tests/
pytest -v --cov={{ cookiecutter.package_name }} --cov-report=xml --color=yes {{ cookiecutter.package_name }}/tests/

- name: CodeCov
uses: codecov/codecov-action@v1
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.repo_name}}/.lgtm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ path_classifiers:
- versioneer.py # Set Versioneer.py to an external "library" (3rd party code)
- devtools/*
generated:
- {{cookiecutter.repo_name}}/_version.py
- {{cookiecutter.package_name}}/_version.py
2 changes: 1 addition & 1 deletion {{cookiecutter.repo_name}}/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import sys
sys.path.insert(0, os.path.abspath('..'))

import {{cookiecutter.repo_name}}
import {{cookiecutter.package_name}}


# -- Project information -----------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions {{cookiecutter.repo_name}}/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
# Self-descriptive entries which should always be present
# https://packaging.python.org/en/latest/specifications/declaring-project-metadata/
[project]
name = "{{cookiecutter.repo_name}}"
name = "{{cookiecutter.package_name}}"
description = "{{cookiecutter.description}}"
dynamic = ["version"]
readme = "README.md"
Expand Down Expand Up @@ -63,7 +63,7 @@ where = ["."]

# Ref https://setuptools.pypa.io/en/latest/userguide/datafiles.html#package-data
[tool.setuptools.package-data]
{{cookiecutter.repo_name}} = [
{{cookiecutter.package_name}} = [
"py.typed"
]

Expand All @@ -83,4 +83,4 @@ match = ["*"]
default-tag = "1.0.0"

[tool.versioningit.write]
file = "{{cookiecutter.repo_name}}/_version.py"
file = "{{cookiecutter.package_name}}/_version.py"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Unit and regression test for the {{cookiecutter.package_name}} package.
"""

# Import package, test suite, and other packages as needed
import sys

import pytest

import {{cookiecutter.package_name}}


def test_{{cookiecutter.package_name}}_imported():
"""Sample test, will always pass so long as import statement worked."""
assert "{{cookiecutter.package_name}}" in sys.modules

This file was deleted.

Loading