Skip to content

Refactor: Move packaging configuration from setup.py to setup.cfg#57

Open
podhmo wants to merge 3 commits into
masterfrom
refactor-setup-py-to-cfg
Open

Refactor: Move packaging configuration from setup.py to setup.cfg#57
podhmo wants to merge 3 commits into
masterfrom
refactor-setup-py-to-cfg

Conversation

@podhmo
Copy link
Copy Markdown
Owner

@podhmo podhmo commented May 21, 2025

I've migrated static metadata from setup.py to setup.cfg to align with modern Python packaging practices.

Key changes:

  • All static package metadata (name, version, author, dependencies, entry points, etc.) is now defined in setup.cfg.
  • setup.py has been simplified to from setuptools import setup; setup().
  • The version is dynamically read from the VERSION file.
  • long_description is dynamically read from README.md and CHANGES.txt.
  • I confirmed that package building and installation are working correctly with these changes.

I've migrated static metadata from `setup.py` to `setup.cfg` to align with modern Python packaging practices.

Key changes:
- All static package metadata (name, version, author, dependencies, entry points, etc.) is now defined in `setup.cfg`.
- `setup.py` has been simplified to `from setuptools import setup; setup()`.
- The `version` is dynamically read from the `VERSION` file.
- `long_description` is dynamically read from `README.md` and `CHANGES.txt`.
- I confirmed that package building and installation are working correctly with these changes.
Removed `setup.py` and adopted a PEP 517 compliant build process
using `pyproject.toml` and `setup.cfg`.

Key changes:
- Added `pyproject.toml` specifying `setuptools.build_meta` as the
  build backend and listing build requirements.
- `pyproject.toml` declares most metadata fields (version, readme,
  license, authors, dependencies, etc.) as `dynamic`, deferring to
  `setup.cfg` for their actual values. This allows `setuptools` to
  continue sourcing information like `version = file: VERSION` and
  `long_description = file: README.md, CHANGES.txt` from `setup.cfg`.
- `setup.py` has been deleted.
- The package successfully builds using `python -m build`, and the
  generated wheel contains the correct metadata (verified by inspecting
  the METADATA file), including the version read from the `VERSION` file.
I've migrated all packaging configuration from `setup.cfg` and the `VERSION`
file to `pyproject.toml`, adhering to PEP 621 and modern Python
packaging standards. `setup.cfg` and `VERSION` have been removed.

Key changes:
- `pyproject.toml` now defines all package metadata statically, including:
  - `name`, `version` (hardcoded to 0.6.2), `description`, `authors`,
    `license` (MIT, pointing to LICENSE file), `keywords`, `classifiers`.
  - `dependencies` and `optional-dependencies`.
  - `scripts` (for console entry points like `jqfpy`).
  - `urls`.
- Dynamic metadata sourcing via `[tool.setuptools.dynamic]` for:
  - `readme`: Long description is generated from `README.md` and
    `CHANGES.txt`, with `text/markdown` content type.
- Package discovery is configured via `[tool.setuptools.packages.find]`.
- Other build options like `include-package-data` and `zip-safe` are
  set in `[tool.setuptools]`.
- The `VERSION` file has been removed.
- `setup.cfg` has been removed.

The project builds successfully using `python -m build` with only
`pyproject.toml`. Inspection of the generated wheel's METADATA confirms
the accuracy of all configured metadata.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant