Skip to content

Modernize Python packaging without touching deps - #1607

Draft
rhaist wants to merge 1 commit into
kk7ds:masterfrom
rhaist:pyproject-cleanup
Draft

rhaist wants to merge 1 commit into
kk7ds:masterfrom
rhaist:pyproject-cleanup

Conversation

@rhaist

@rhaist rhaist commented Jul 9, 2026 •

Copy link
Copy Markdown
Contributor

Hi @kk7ds — sorry if this is inappropriate for a drive-by PR, and feel free to close it if the answer is simply "no" — but I'd like to suggest a cleanup of the top-level packaging files. I've marked it as a draft since I know the binary build infrastructure lives outside this repo and I can't test against it.

This consolidates setup.py, setup.cfg, requirements.txt, test-requirements.txt, .mypy.ini and pylintrc into a single pyproject.toml — without changing any dependency or pin:

  • The wxPython pins move verbatim (same platform markers, same Phoenix#2225 reference, same "keep in sync with binary builds" comment) to the [wx] extra
  • The test dependencies (including the pytest pin) move to a [test] extra; the tox envs use extras = test instead of -rtest-requirements.txt
  • pywin32 moves into the main dependencies — it was in requirements.txt but missing from setup.py, so this closes a small gap
  • setup.cfg goes away entirely: it only held a bdist_rpm section still describing rpttool ("A frequency tool for Icom D-STAR Repeaters")
  • pylintrc goes away: nothing references it (style checks are flake8/mypy via tox)

Verified locally:

  • tox -e unit: 481 passed, 12 skipped
  • tox -e style: byte-identical mypy results with the old .mypy.ini and the new [tool.mypy] section
  • sdist contains the same data files as before (stock configs, locales, icons, MANIFEST.in unchanged apart from the requirements line)
  • pip install -e . exposes the same three console scripts
  • CI needs no changes — all jobs go through tox
  • flake.nix (pip install -e .) and snapcraft (python plugin) both work with pyproject-based builds

The one thing this does change for developers: the wiki's pip install -r requirements.txt step becomes pip install -e '.[wx,test]'. Happy to adjust anything, split this up, or drop parts of it — and if the timing is bad or you'd rather keep the current layout, no hard feelings.

One thing that definitely needs your input: if the build system stamps setup.py's version=0 at build time, that step would need to target version = "0" in pyproject.toml instead.

@rhaist
rhaist force-pushed the pyproject-cleanup branch from 4d95dc5 to a348eb2 Compare July 9, 2026 12:07
@kk7ds

kk7ds commented Jul 14, 2026

Copy link
Copy Markdown
Owner

I appreciate it, but I really really just want to own the binary build process. 99% of chirp users are consuming the binary builds and I really need to prioritize that stuff. It'll need to be updated at some point I know, but it has to be done in lockstep with the binary builds. You can leave this open and I can aim to get the other half of the build process working with it at some point, but no promises on timeline.

@rhaist

rhaist commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

@kk7ds I totally understand. This is mainly a feasibility study from my end to see if this modernization can be done while honoring the dependency constraints. I can leave this PR draft open for your reference. Let me know if you need changes or input from me on it when you start working on the topic. Happy to help.

@McNeight McNeight left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand where Dan is coming from, and I understand that you were going for a "light touch" for consolidating these files, but I'd like to understand something.

Why wasn't tox.ini also incorporated into pyproject.toml? It seems to be an important part of unit and driver testing. At a minimum, I would think the tox package would be added to the project.optional-dependencies.test section?

Thanks for doing this.

Comment thread pyproject.toml Outdated
@rhaist

rhaist commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

@McNeight Two reasons I left tox.ini alone:

  1. The tox.ini also carries the [flake8] configuration, and flake8 has no pyproject.toml support at all — so a migration would still leave config split across two files. tox itself only gained native TOML config in 4.21 (late 2024), so moving it would also impose a fairly new tox version floor on developers for no functional gain.

  2. Scope: this PR is deliberately limited to replacing setup.py/setup.cfg, which is forced by setuptools deprecations. tox.ini keeps working indefinitely, so there was nothing to fix there — and given Dan's comment above, keeping the diff minimal seemed right.

On adding tox to project.optional-dependencies.test: tox is the tool that creates the test environment and installs .[test] into it, so listing it inside that extra would be circular. Like pip itself, it belongs in the developer's outer environment rather than in the project's dependencies.

@kk7ds

kk7ds commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Yeah the python community has sort of decided for us that everything should be put into pyproject.toml, which is not universally loved (I certainly don't like it). Been a lot of "deciding for us" lately on a lot of topics :(

McNeight added a commit to McNeight/chirp that referenced this pull request Jul 18, 2026
* Integrated files from PR kk7ds#1607
* Made platform agnostic changes to chirp/platform.py
* Fix circular import introduced in chirp/chirp_common.py


# Conflicts:
#	chirp/kenwood_tone.py
Consolidate the packaging and tool configuration into a single
pyproject.toml without changing any dependencies or pins:

- setup.py: moved verbatim to [project] (metadata, dependencies,
  entry points); homepage URL updated to chirpmyradio.com
- requirements.txt: wxPython pins moved to the [wx] extra with the
  same platform markers and sync-with-binary-builds comment; pywin32
  moved to the main dependencies (it was missing from setup.py)
- test-requirements.txt: moved to a [test] extra; tox envs now use
  "extras = test" (pyserial/requests dropped from the list as they
  are already install requirements)
- .mypy.ini: moved to [tool.mypy]; mypy reads it automatically so
  the --config-file argument is gone
- setup.cfg: removed; it only held a stale bdist_rpm section still
  describing rpttool
- pylintrc: removed; nothing references it (style checks use
  flake8/mypy via tox)

Verified: tox -e unit passes (481 passed, 12 skipped), tox -e style
produces identical results with old and new mypy config, sdist
contains the same data files (stock configs, locales, icons), and
"pip install -e ." exposes the same three console scripts.

The developer wiki instructions change from
"pip install -r requirements.txt" to "pip install -e .[wx,test]".
@rhaist
rhaist force-pushed the pyproject-cleanup branch from 5853a29 to 0aa6ec2 Compare July 27, 2026 06:48
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.

3 participants