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

rename project_name as directory_name #278

Merged
merged 10 commits into from
May 3, 2021
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ cookiecutter https://github.com/nlesc/python-template.git

| Name | Default value | Explanation |
| ------------------------- | ------------- | ----------- |
| directory_name | my-python-project | Name of the directory that contains the package. Avoid using spaces or uppercase letters for the best experience across operating systems. To get an impression of what will be generated, see the directory tree [below](https://github.com/NLeSC/python-template#step-33-read-about-what-was-just-generated) |
| package_name | my_python_package | Name of the package. Avoid using spaces, dashes, or uppercase letters for the best experience across operating systems. |
| project_name | my-python-project | Name of the project that contains the package. Avoid using spaces or uppercase letters for the best experience across operating systems. |
| package_short_description |   | The information that you enter here will end up in the README, documentation, license, and setup.cfg, so it may be a good idea to prepare something in advance. |
| keyword1 | keyword1 | A term that describes your package. |
| keyword2 | keyword2 | Another term that describes your package. |
Expand All @@ -81,7 +81,7 @@ cookiecutter https://github.com/nlesc/python-template.git
| code_of_conduct_email | yourname@esciencecenter.nl | Email address of the person who should be contacted in case of violations of the Code of Conduct. |

Once the project files have been generated, follow the steps outlined in
[{{cookiecutter.project_name}}/next_steps.md]({{cookiecutter.project_name}}/next_steps.md).
[{{cookiecutter.directory_name}}/next_steps.md]({{cookiecutter.directory_name}}/next_steps.md).

### Step 3/3: Read about what was just generated

Expand Down
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"directory_name": "my-python-project",
"package_name": "my_python_package",
"project_name": "my-python-project",
"_copy_without_render": [".github/workflows/*"],
"package_short_description": "",
"keyword1": "keyword1",
Expand Down
2 changes: 1 addition & 1 deletion hooks/post_gen_project.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
print("\nProject was successfully generated. For next steps, refer to file {{ cookiecutter.project_name }}/next_steps.md.\n")
print("\nProject was successfully generated. For next steps, refer to file {{ cookiecutter.directory_name }}/next_steps.md.\n")
6 changes: 3 additions & 3 deletions hooks/pre_gen_project.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Note: cookiecutter first makes the main level directory using
# project_name from cookiecutter.json before running this hook
# directory_name from cookiecutter.json before running this hook

{{ cookiecutter.update({
"package_name": cookiecutter.package_name.lower().replace(" ", "_").replace("-", "_"),
"project_name": cookiecutter.project_name.lower().replace(" ", "-"),
"directory_name": cookiecutter.directory_name.lower().replace(" ", "-"),
"full_name": cookiecutter.full_name.replace('\"', '\\\"'),
"repository": "https://github.com/" + cookiecutter.github_organization + "/" + cookiecutter.project_name.lower().replace(" ", "-"),
"repository": "https://github.com/" + cookiecutter.github_organization + "/" + cookiecutter.directory_name.lower().replace(" ", "-"),
"package_short_description": cookiecutter.package_short_description.replace('\"', '\\\"')
}) }}
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ dev =

[tool:pytest]
testpaths = tests
norecursedirs = .git .github hooks {{cookiecutter.project_name}}
norecursedirs = .git .github hooks {{cookiecutter.directory_name}}
8 changes: 4 additions & 4 deletions tests/test_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ def test_single_quotes_in_name_and_description(cookies):
assert project.exit_code == 0


def test_dash_in_project_name(cookies):
def test_dash_in_directory_name(cookies):
ctx = {
"project_name": "my-python-project"
"directory_name": "my-python-project"
}
project = cookies.bake(extra_context=ctx)

assert project.exit_code == 0


def test_space_in_project_name(cookies):
def test_space_in_directory_name(cookies):
ctx = {
"project_name": "my python project"
"directory_name": "my python project"
}
project = cookies.bake(extra_context=ctx)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ In order to configure Sonarcloud analysis [GitHub Action workflow](.github/workf
1. login with your GitHub account
1. add Sonarcloud organization or reuse existing one
1. set up a repository
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
1. go to [new code definition administration page](https://sonarcloud.io/project/new_code?id={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}) and select `Number of days` option
1. To be able to run the analysis:
1. a token must be created at [Sonarcloud account](https://sonarcloud.io/account/security/)
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)
1. the created token must be added as `SONAR_TOKEN` to [secrets on GitHub](https://github.com/{{cookiecutter.github_organization}}/{{cookiecutter.directory_name}}/settings/secrets/actions)
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ To host the documentation of this repository please perform the following instru

1. go to [Read the Docs](https://readthedocs.org/dashboard/import/?)
1. log in with your GitHub account
1. find `{{ cookiecutter.github_organization }}/{{ cookiecutter.project_name }}` in list and press `+` button.
1. find `{{ cookiecutter.github_organization }}/{{ cookiecutter.directory_name }}` in list and press `+` button.
* If repository is not listed,
1. go to [Read the Docs GitHub app](https://github.com/settings/connections/applications/fae83c942bc1d89609e2)
2. make sure {{ cookiecutter.github_organization }} has been granted access.
3. reload repository list on Read the Docs import page
1. wait for the first build to be completed at <https://readthedocs.org/projects/{{ cookiecutter.project_name }}/builds>
1. wait for the first build to be completed at <https://readthedocs.org/projects/{{ cookiecutter.directory_name }}/builds>
1. check that the link of the documentation badge in the [README.md]({{ cookiecutter.repository }}) works

See [README.dev.md#]({{cookiecutter.repository}}/blob/main/README.dev.md#generating-the-api-docs) how to build documentation site locally.
2 changes: 1 addition & 1 deletion {{cookiecutter.project_name}}/CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# YAML 1.2
---
cff-version: "1.1.0"
title: "{{ cookiecutter.project_name }}"
title: "{{ cookiecutter.package_name }}"
authors:
-
family-names: {{ cookiecutter.full_name.split(' ')[-1] }}
Expand Down
14 changes: 7 additions & 7 deletions {{cookiecutter.project_name}}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
| fair-software.eu recommendations | |
| :-- | :-- |
| (1/5) code repository | [![github repo badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)]({{cookiecutter.repository}}) |
| (2/5) license | [![github license badge](https://img.shields.io/github/license/{{cookiecutter.github_organization}}/{{cookiecutter.project_name}})]({{cookiecutter.repository}}) |
| (3/5) community registry | [![RSD](https://img.shields.io/badge/rsd-{{cookiecutter.project_name}}-00a3e3.svg)](https://www.research-software.nl/software/{{cookiecutter.project_name}}) [![workflow pypi badge](https://img.shields.io/pypi/v/{{cookiecutter.project_name}}.svg?colorB=blue)](https://pypi.python.org/project/{{cookiecutter.project_name}}/) |
| (2/5) license | [![github license badge](https://img.shields.io/github/license/{{cookiecutter.github_organization}}/{{cookiecutter.directory_name}})]({{cookiecutter.repository}}) |
| (3/5) community registry | [![RSD](https://img.shields.io/badge/rsd-{{cookiecutter.directory_name}}-00a3e3.svg)](https://www.research-software.nl/software/{{cookiecutter.directory_name}}) [![workflow pypi badge](https://img.shields.io/pypi/v/{{cookiecutter.directory_name}}.svg?colorB=blue)](https://pypi.python.org/project/{{cookiecutter.directory_name}}/) |
| (4/5) citation | [![DOI](https://zenodo.org/badge/DOI/<replace-with-created-DOI>.svg)](https://doi.org/<replace-with-created-DOI>) |
| (5/5) checklist | [![workflow cii badge](https://bestpractices.coreinfrastructure.org/projects/<replace-with-created-project-identifier>/badge)](https://bestpractices.coreinfrastructure.org/projects/<replace-with-created-project-identifier>) |
| howfairis | [![fair-software badge](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow)](https://fair-software.eu) |
| **Other best practices** | &nbsp; |
| Static analysis | [![workflow scq badge](https://sonarcloud.io/api/project_badges/measure?project={{cookiecutter.github_organization}}_{{cookiecutter.project_name}}&metric=alert_status)](https://sonarcloud.io/dashboard?id={{cookiecutter.github_organization}}_{{cookiecutter.project_name}}) |
| Coverage | [![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project={{cookiecutter.github_organization}}_{{cookiecutter.project_name}}&metric=coverage)](https://sonarcloud.io/dashboard?id={{cookiecutter.github_organization}}_{{cookiecutter.project_name}}) |
| Documentation | [![Documentation Status](https://readthedocs.org/projects/{{cookiecutter.project_name}}/badge/?version=latest)](https://{{cookiecutter.project_name}}.readthedocs.io/en/latest/?badge=latest) |
| Static analysis | [![workflow scq badge](https://sonarcloud.io/api/project_badges/measure?project={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}&metric=alert_status)](https://sonarcloud.io/dashboard?id={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}) |
| Coverage | [![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}&metric=coverage)](https://sonarcloud.io/dashboard?id={{cookiecutter.github_organization}}_{{cookiecutter.directory_name}}) |
| Documentation | [![Documentation Status](https://readthedocs.org/projects/{{cookiecutter.directory_name}}/badge/?version=latest)](https://{{cookiecutter.directory_name}}.readthedocs.io/en/latest/?badge=latest) |
| **GitHub Actions** | &nbsp; |
| Build | [![build]({{cookiecutter.repository}}/actions/workflows/build.yml/badge.svg)]({{cookiecutter.repository}}/actions/workflows/build.yml) |
| Metadata consistency | [![cffconvert]({{cookiecutter.repository}}/actions/workflows/cffconvert.yml/badge.svg)]({{cookiecutter.repository}}/actions/workflows/cffconvert.yml) |
Expand All @@ -33,7 +33,7 @@ To install {{ cookiecutter.package_name }} from GitHub repository, do:

```console
git clone {{ cookiecutter.repository }}.git
cd {{ cookiecutter.project_name }}
cd {{ cookiecutter.directory_name }}
python3 -m pip install .
```

Expand All @@ -43,7 +43,7 @@ Include a link to your project's full documentation here.

## Contributing

If you want to contribute to the development of {{ cookiecutter.project_name }},
If you want to contribute to the development of {{ cookiecutter.package_name }},
have a look at the [contribution guidelines](CONTRIBUTING.md).

## Credits
Expand Down
4 changes: 2 additions & 2 deletions {{cookiecutter.project_name}}/next_steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ control](https://guide.esciencecenter.nl/#/best_practices/version_control) using
[git](https://git-scm.com/) and [GitHub](https://github.com/).

```shell
cd {{ cookiecutter.project_name }}
cd {{ cookiecutter.directory_name }}
git init
git add --all
git commit -m "first commit"
Expand All @@ -19,7 +19,7 @@ git remote add origin {{ cookiecutter.repository }}

Go to
[https://github.com/organizations/{{cookiecutter.github_organization}}/repositories/new](https://github.com/organizations/{{cookiecutter.github_organization}}/repositories/new)
and create a new repository named `{{ cookiecutter.project_name }}` as an empty repository, then push your commits to GitHub:
and create a new repository named `{{ cookiecutter.directory_name }}` as an empty repository, then push your commits to GitHub:

```shell
git push --set-upstream origin main
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_name}}/project_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ help you decide which tool to use for packaging.
## Package version number

- We recommend using [semantic versioning](https://guide.esciencecenter.nl/#/best_practices/releases?id=semantic-versioning).
- For convenience, the package version is stored in a single place: `{{ cookiecutter.project_name }}/.bumpversion.cfg`.
- For convenience, the package version is stored in a single place: `{{ cookiecutter.directory_name }}/.bumpversion.cfg`.
For updating the version number, make sure the dev dependencies are installed and run `bumpversion patch`,
`bumpversion minor`, or `bumpversion major` as appropriate.
- Don't forget to update the version number before [making a release](https://guide.esciencecenter.nl/#/best_practices/releases)!
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_name}}/sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sonar.organization={{ cookiecutter.github_organization }}
sonar.projectKey={{ cookiecutter.github_organization }}_{{ cookiecutter.project_name }}
sonar.projectKey={{ cookiecutter.github_organization }}_{{ cookiecutter.directory_name }}
sonar.host.url=https://sonarcloud.io
sonar.sources={{ cookiecutter.package_name }}/
sonar.tests=tests/
Expand Down