From 5544977c9686402fbdf7cd79109f7e7846ca1002 Mon Sep 17 00:00:00 2001 From: Drew Bednar Date: Sun, 10 Dec 2023 19:47:17 -0500 Subject: [PATCH] Adding support for packaging --- README.md | 12 +++++++++- cookiecutter.json | 10 ++++---- {{cookiecutter.project_slug}}/LICENSE | 8 +++---- .../dev-requirements.in | 3 ++- {{cookiecutter.project_slug}}/pyproject.toml | 24 +++++++++++++++++++ 5 files changed, 46 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index eef18c6..dc3106f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,13 @@ # cookiecutter-basic -A basic cookiecutter template for most Androiddrew style repos. \ No newline at end of file +A basic cookiecutter template for most Androiddrew style repos. + +## Licenses + +Within a `pyproject.toml` file the license section expects the string identifier as determined by https://spdx.org/licenses/. This project supports a small subset of these licenses. + +Example: +``` +[project] +license = {text = "MIT"} +``` \ No newline at end of file diff --git a/cookiecutter.json b/cookiecutter.json index 68bc9a8..6d0f44f 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -7,11 +7,11 @@ "initial_dependencies": "", "description": "An templated Python project", "open_source_license": [ - "MIT license", - "BSD license", - "ISC license", - "Apache Software License 2.0", - "GNU General Public License v3", + "MIT", + "BSD-3-Clause", + "ISC", + "Apache-2.0", + "GPL-3.0-or-later", "Not open source" ] } \ No newline at end of file diff --git a/{{cookiecutter.project_slug}}/LICENSE b/{{cookiecutter.project_slug}}/LICENSE index 087b7e7..07d90fe 100644 --- a/{{cookiecutter.project_slug}}/LICENSE +++ b/{{cookiecutter.project_slug}}/LICENSE @@ -1,4 +1,4 @@ -{% if cookiecutter.open_source_license == 'MIT license' %} +{% if cookiecutter.open_source_license == 'MIT' %} MIT License Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} @@ -8,7 +8,7 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -{% elif cookiecutter.open_source_license == 'BSD license' %} +{% elif cookiecutter.open_source_license == 'BSD-3-Clause' %} BSD License Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} @@ -46,7 +46,7 @@ Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -{% elif cookiecutter.open_source_license == 'Apache Software License 2.0' %} +{% elif cookiecutter.open_source_license == 'Apache-2.0' %} Apache Software License 2.0 Copyright (c) {% now 'local', '%Y' %}, {{ cookiecutter.full_name }} @@ -62,7 +62,7 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -{% elif cookiecutter.open_source_license == 'GNU General Public License v3' %} +{% elif cookiecutter.open_source_license == 'GPL-3.0-or-later' %} GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 diff --git a/{{cookiecutter.project_slug}}/dev-requirements.in b/{{cookiecutter.project_slug}}/dev-requirements.in index f0b797f..557d1fa 100644 --- a/{{cookiecutter.project_slug}}/dev-requirements.in +++ b/{{cookiecutter.project_slug}}/dev-requirements.in @@ -1,8 +1,9 @@ -c ./requirements.txt black +build invoke -isort +isort<=5.12.0 pip-tools pre-commit pytest diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index caf0352..669178f 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -1,3 +1,27 @@ +[project] +name = "{{ cookiecutter.project_slug }}" +version = "0.1.0" +authors = [ + {name = "{{ cookiecutter.full_name }}", email = "{{ cookiecutter.email }}"}, +] +description = "{{ cookiecutter.description }}" +requires-python = ">=3.10" +{% if cookiecutter.open_source_license != 'Not open source' -%} +license = {text = "{{ cookiecutter.open_source_license }}"} +{% endif -%} +classifiers = [ + "Programming Language :: Python :: 3", +] +dynamic = ["readme", "dependencies"] + +[tool.setuptools.dynamic] +readme = {file = ["README.md"], content-type = "text/markdown"} +dependencies = {file = ["requirements.txt"]} + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + [tool.isort] profile = "black" line_length = 120