Skip to content

Commit ee183c3

Browse files
author
Alec Delaney
committed
Update setup.py to pyproject.toml template
1 parent 1a24f3b commit ee183c3

File tree

2 files changed

+67
-101
lines changed

2 files changed

+67
-101
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# SPDX-FileCopyrightText: 2022 Alec Delaney, written for Adafruit Industries
2+
# SPDX-FileCopyrightText: Copyright (c) {% now 'utc', '%Y' %} {{ cookiecutter.author_name }}{% if cookiecutter.company %} for {{ cookiecutter.company }}{% endif %}
3+
#
4+
# SPDX-License-Identifier: MIT
5+
6+
{# put keywords into an iterable list, based on word wrapping #}
7+
{%- set kw_list = namespace(kw_list=[], default=["adafruit", "blinka", "circuitpython", "micropython"]) -%}
8+
{%- do kw_list.default.append(cookiecutter.library_name|lower|replace(" ", "-")) -%}
9+
{%- do kw_list.default.extend(cookiecutter.library_keywords.split(" ")) -%}
10+
{%- set wrapped = kw_list.default|unique|join(" ")|wordwrap(break_long_words=False) -%}
11+
{%- do kw_list.kw_list.extend(wrapped.split("\n")) -%}
12+
{# create repo and pypi names #}
13+
{%- if cookiecutter.target_bundle != 'CircuitPython Org' -%}
14+
{%- if cookiecutter.library_prefix -%}
15+
{%- set repo_name = (cookiecutter.library_prefix | capitalize) -%}
16+
{%- set repo_name = repo_name + '_CircuitPython_' -%}
17+
{%- set repo_name = repo_name + cookiecutter.library_name | replace(" ", "_") -%}
18+
{%- else -%}
19+
{%- set repo_name = 'CircuitPython_' -%}
20+
{%- set repo_name = repo_name + cookiecutter.library_name | replace(" ", "_") -%}
21+
{%- endif -%}
22+
{%- else -%}
23+
{%- set repo_name = 'CircuitPython_Org_' + cookiecutter.library_name | replace(" ", "_") -%}
24+
{%- endif -%}
25+
{%- set pypi_name = repo_name|lower|replace("_", "-")|replace(" ", "-")|replace("circuitpython-org-", "circuitpython-") -%}
26+
[build-system]
27+
requires = [
28+
"setuptools",
29+
"wheel",
30+
"setuptools-scm",
31+
]
32+
33+
[project]
34+
name = "{{ pypi_name }}"
35+
description = "{{ cookiecutter.library_description }}"
36+
version = "0.0.0-auto.0"
37+
readme = "README.rst"
38+
authors = [
39+
{name = "Adafruit Industries", email = "[email protected]"}
40+
]
41+
urls = {Homepage = "https://github.com/{{ cookiecutter.github_user }}/{{ repo_name }}"}
42+
keywords = [
43+
{% for kw_list_keyword in kw_list.kw_list %}
44+
"{{ kw_list_keyword }}",
45+
{% endfor -%}
46+
]
47+
license = {text = "MIT"}
48+
classifiers = [
49+
"Intended Audience :: Developers",
50+
"Topic :: Software Development :: Libraries",
51+
"Topic :: Software Development :: Embedded Systems",
52+
"Topic :: System :: Hardware",
53+
"License :: OSI Approved :: MIT License",
54+
"Programming Language :: Python :: 3",
55+
]
56+
dynamic = ["dependencies", "optional-dependencies"]
57+
58+
[tool.setuptools]
59+
# You can just specify the packages manually here if your project is
60+
# simple. Or you can use find_packages().
61+
# TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER,
62+
# CHANGE `py_modules = ['...']` TO `packages = ['...']`
63+
py-modules = ["{% if cookiecutter.library_prefix %}{{ cookiecutter.library_prefix | lower | replace(" ", "_") }}_{% endif %}{{ cookiecutter.library_name | lower | replace(" ", "_") }}"]
64+
65+
[tool.setuptools.dynamic]
66+
dependencies = {file = ["requirements.txt"]}
67+
optional-dependencies = {optional = {file = ["optional_requirements.txt"]}}

{{ cookiecutter.__dirname }}/{% if cookiecutter.pypi_release in ['y', 'yes'] %}setup.py{% endif %}

Lines changed: 0 additions & 101 deletions
This file was deleted.

0 commit comments

Comments
 (0)