Skip to content

Commit

Permalink
setup.py to pyproject.toml conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanDufraisse committed Oct 2, 2024
1 parent 566c04d commit 46c780d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "PROJECT_NAME"
version = "0.1.0"
description = "PROJECT_NAME: DESCRIPTION"
authors = [{ name = "FIRST_LAST_AUTHOR", email = "CONTACT_MAIL" }]
dependencies = [
"tqdm",
"loguru",
"ipykernel"
]
requires-python = ">=3.8"

[tool.setuptools]
packages = ["PACKAGE_NAME"]
package-dir = {"" = "src"}
14 changes: 5 additions & 9 deletions set_new_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,9 @@
print("Project name: {}".format(project_name))

# Ask for description
description = input("Long Description of your project: ")
description = input("Description of your project: ")
print("Description: {}".format(description))

# Ask for short description
short_description = input("Short Description of your project: ")
print("Short Description: {}".format(short_description))

# Ask name
name = input("Your name (i.e. John Doe): ")
print("Name: {}".format(name))
Expand All @@ -98,7 +94,9 @@
packages = packages.split(",")
packages = [package.strip() for package in packages]

with open(os.path.join(root_folder_of_project, "setup.py"), "r") as f:
# file = "setup.py"
file = "pyproject.toml"
with open(os.path.join(root_folder_of_project, file), "r") as f:
setup_file = f.read()

with open(os.path.join(root_folder_of_project, "src", "PACKAGE", "main.py"), "r") as f:
Expand All @@ -112,7 +110,6 @@

setup_file = setup_file.replace("PACKAGE_NAME", package_name)
setup_file = setup_file.replace("PROJECT_NAME", project_name)
setup_file = setup_file.replace("SHORT_DESCRIPTION", short_description)
setup_file = setup_file.replace("DESCRIPTION", description)
setup_file = setup_file.replace("FIRST_LAST_AUTHOR", name)
setup_file = setup_file.replace("CONTACT_MAIL", mail)
Expand All @@ -130,14 +127,13 @@

setup_file = setup_file.replace("PACKAGES", packages_str)

with open(os.path.join(root_folder_of_project, "setup.py"), "w") as f:
with open(os.path.join(root_folder_of_project, file), "w") as f:
f.write(setup_file)

# with open(os.path.join(root_folder_of_project, "README.md"), "r") as f:
# readme_file = f.read()
readme_file = default_string_readme
readme_file = readme_file.replace("PROJECT_NAME", project_name)
readme_file = readme_file.replace("SHORT_DESCRIPTION", short_description)
readme_file = readme_file.replace("DESCRIPTION", description)
readme_file = readme_file.replace("name_of_package", package_name)

Expand Down

0 comments on commit 46c780d

Please sign in to comment.