-
Notifications
You must be signed in to change notification settings - Fork 12
Update from setup.py to pyproject.toml
#164
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
base: develop
Are you sure you want to change the base?
Conversation
540a8db to
336618a
Compare
|
@mcdonnnj - I'm not sure what kind of version bump to apply here, if any. |
|
The The |
|
I realize that we want |
dav3r
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks like a solid start to me. Thanks for getting us switched over to pyproject.toml. 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request migrates the project from a setup.py-based build configuration to a modern pyproject.toml-based configuration using the Hatchling build backend. This modernization consolidates configuration files and follows current Python packaging best practices (PEP 517/518).
- Migrates from
setup.pytopyproject.tomlwith Hatchling as the build backend - Consolidates
pytest.iniand.isort.cfgconfigurations intopyproject.toml - Updates GitHub labeler configuration to reference the new configuration file
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Removed legacy setup.py file (116 lines) |
| pytest.ini | Removed standalone pytest configuration file |
| .isort.cfg | Removed standalone isort configuration file |
| pyproject.toml | Added comprehensive project configuration including build system, dependencies, tool configurations, and metadata |
| .github/labeler.yml | Updated file references from setup.py, .isort.cfg, and pytest.ini to pyproject.toml |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@mcdonnnj - Any thoughts here? Are you still researching the current landscape of build backends? |
|
In this PR I moved the Do we want to leave the |
This is because this file now contains configurations for test tools. Also remove test tool config files that no longer exist.
These may be of use to folks who are editing pyproject.toml for a descendant of this skeleton repository.
901f748 to
3b8d5fc
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
I get what you are saying and see the appeal of getting rid of |
In a way you already do, since The |
LOL, I forgot about that. In that case, I agree with your plan to replace |
This gets rid of the .bandit.yml file that was being used only against the test code.
571c4d3 to
da7213e
Compare
|
@mcdonnnj - At one point you said that if we used import setuptools
setuptools.setup()I don't see the point of that, though. Also, it appears that I'm kind of of the opinion that until we have native extensions it's a tossup between I think this PR would change only slightly if we used |
|
FYI, here are the necessary changes for moving to diff --git a/pyproject.toml b/pyproject.toml
index 370ba01..727434b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,9 +1,9 @@
# For more information about configuring project metadata for the
-# hatch build backend, please see
-# https://hatch.pypa.io/latest/config/metadata/
+# setuptools build backend, please see
+# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
[build-system]
-build-backend = "hatchling.build"
-requires = ["hatchling"]
+build-backend = "setuptools.build_meta"
+requires = ["setuptools"]
[project]
authors = [
@@ -38,11 +38,10 @@ dependencies = [
"schema",
]
description = "Example Python library"
-dynamic = ["version"]
+dynamic = ["readme", "version"]
keywords = ["skeleton"]
license = "CC0-1.0"
name = "example"
-readme = "README.md"
requires-python = ">=3.9"
[project.optional-dependencies]
@@ -74,12 +73,12 @@ issues = "https://github.com/cisagov/skeleton-python-library/issues"
mission = "https://www.cisa.gov/cybersecurity"
source = "https://github.com/cisagov/skeleton-python-library"
-[tool.hatch.version]
-# Versions should comply with PEP440
-path = "src/example/_version.py"
-
[tool.pytest.ini_options]
# Increase verbosity, display extra test summary info for tests that
# did not pass, display code coverage results, and enable debug
# logging.
addopts = "--verbose -ra --cov --log-cli-level=DEBUG"
+
+[tool.setuptools.dynamic]
+readme = {file = ["README.md"], content-type = "text/markdown"}
+version = {attr = "example._version.__version__"} |
Keeping the |
Yes, in the first link they say it can coexist but nowhere do they say it must be present. My point is that if everything can be moved into the |
Actually, it isn't even necessary if you're compiling native code. So I don't see any reason to keep a |
The setuptools build backend: - Supports native extensions, in contrast with the hatchling build backend - Is the most commonly used build backend among projects on PyPI - Is an officially supported build backend from Python, in contrast with the hatchling build backend
Please see commit 461f872. |
Please see commit 461f872. |
This ensures that the data file(s) are incorporated into the wheels that are built.
This directory can be created by `pip install .`.
dav3r
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks reasonable to me. 👍
This comment is no longer applicable since we moved to using |

🗣 Description
This pull request updates our project packaging configuration from using a
setup.pyfile to using apyproject.tomlfile with asetuptoolsbuild backend.See also cisagov/skeleton-generic#235.
💭 Motivation and context
Resolves #163. Resolves #136.
🧪 Testing
All automated tests pass.
✅ Pre-approval checklist
bump_versionscript if this repository is versioned and the changes in this PR warrant a version bump.✅ Pre-merge checklist
✅ Post-merge checklist