Skip to content

Add pyproject, cleanup python dependencies, deprecate python 3.9#1018

Merged
DJ2LS merged 4 commits intoDJ2LS:developfrom
as3ii:fix-py-side
Oct 27, 2025
Merged

Add pyproject, cleanup python dependencies, deprecate python 3.9#1018
DJ2LS merged 4 commits intoDJ2LS:developfrom
as3ii:fix-py-side

Conversation

@as3ii
Copy link
Contributor

@as3ii as3ii commented Oct 3, 2025

TODO:

  • Cleanup dependencies
  • Add pyproject.toml
  • Deprecate python 3.9, add support for python3.12
  • Lint/cleanup (autopep8, isort)
  • Switch to ruff for format+lint (add a CI workflow?)
  • fix tests when executed with pytest instead of unittest (maybe better in another PR)

@as3ii
Copy link
Contributor Author

as3ii commented Oct 3, 2025

any comment on the work done and the TODO above?

@DJ2LS
Copy link
Owner

DJ2LS commented Oct 3, 2025

Sorry for my late reply, i don't have much time at the moment.

Could you do me the favour and changing the branch to "develop"? That's our endpoint before merging into main so the changes can be tested

@DJ2LS
Copy link
Owner

DJ2LS commented Oct 3, 2025

I will have a look at your suggestion and changes soon!

@as3ii as3ii changed the base branch from main to develop October 3, 2025 23:37
@as3ii
Copy link
Contributor Author

as3ii commented Oct 3, 2025

Sorry for my late reply, i don't have much time at the moment.

Could you do me the favour and changing the branch to "develop"? That's our endpoint before merging into main so the changes can be tested

rebase completed onto develop.
Don't worry, I'll wait 👍🏻

@Mashintime
Copy link
Collaborator

Tested briefly. Currently running develop branch and copied my config.ini for testing. Appears to be issues with config processing and two things I've noticed straight away:

  1. auto_run_browser from config.ini isn't being honored (a browser window is opening despite my setting of false)

  2. hamlib is starting with extra args I don't want (and don't have set)

This PR:
2025-10-05T04:01:05.178197Z [info ] Successfully executed rigctld args=['-m', '2036', '-s', '0', '--set-conf', 'data_bits=0', '--set-conf', 'stop_bits=0', '--vfo', '-r', 'localhost:5002']
develope:
2025-10-05T04:04:40.831244Z [info ] Successfully executed rigctld args=['-m', '2036', '-r', 'localhost:5002']

Also getting this stacktrace
2025-10-05T04:03:42.220241Z [info ] [MDM] init: transmiting audio on 'DAX Audio TX (FlexRadio Systems DAX TX)'
Exception in thread runner thread:
Traceback (most recent call last):
File "C:\Python313\Lib\threading.py", line 1043, in _bootstrap_inner
self.run()
~~~~~~~~^^
File "C:\Python313\Lib\threading.py", line 994, in run
self._target(*self._args, **self._kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\dev2\FreeDATA\freedata_server\service_manager.py", line 67, in runner
self.ctx).start_servers()
~~~~~~~~~~~~~^^
File "C:\dev2\FreeDATA\freedata_server\socket_interface.py", line 204, in start_servers
self.command_server = CustomThreadedTCPServer(
~~~~~~~~~~~~~~~~~~~~~~~^
(self.ip, self.command_port),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<2 lines>...
socket_interface_manager=self
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "C:\dev2\FreeDATA\freedata_server\socket_interface.py", line 166, in init
super().init(server_address, RequestHandlerClass,
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
bind_and_activate=bind_and_activate)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python313\Lib\socketserver.py", line 457, in init
self.server_bind()
~~~~~~~~~~~~~~~~^^
File "C:\Python313\Lib\socketserver.py", line 478, in server_bind
self.socket.bind(self.server_address)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
TypeError: 'str' object cannot be interpreted as an integer

@DJ2LS
Copy link
Owner

DJ2LS commented Oct 5, 2025

Thanks for your work on the project, @as3ii I really appreciate help! Could you do me the favor, separating linting changes from "normal" changes? This makes it much easier reviewing the PR as I'm checking changed lines by line.

@DJ2LS
Copy link
Owner

DJ2LS commented Oct 5, 2025

Tested briefly. Currently running develop branch and copied my config.ini for testing. Appears to be issues with config processing and two things I've noticed straight away:

  1. auto_run_browser from config.ini isn't being honored (a browser window is opening despite my setting of false)
  2. hamlib is starting with extra args I don't want (and don't have set)

This PR: 2025-10-05T04:01:05.178197Z [info ] Successfully executed rigctld args=['-m', '2036', '-s', '0', '--set-conf', 'data_bits=0', '--set-conf', 'stop_bits=0', '--vfo', '-r', 'localhost:5002'] develope: 2025-10-05T04:04:40.831244Z [info ] Successfully executed rigctld args=['-m', '2036', '-r', 'localhost:5002']

Also getting this stacktrace 2025-10-05T04:03:42.220241Z [info ] [MDM] init: transmiting audio on 'DAX Audio TX (FlexRadio Systems DAX TX)' Exception in thread runner thread: Traceback (most recent call last): File "C:\Python313\Lib\threading.py", line 1043, in _bootstrap_inner self.run() ~~~~~~~~^^ File "C:\Python313\Lib\threading.py", line 994, in run self._target(*self._args, **self._kwargs) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\dev2\FreeDATA\freedata_server\service_manager.py", line 67, in runner self.ctx).start_servers() ~~~~~~~~~~~~~^^ File "C:\dev2\FreeDATA\freedata_server\socket_interface.py", line 204, in start_servers self.command_server = CustomThreadedTCPServer( ~~~~~~~~~~~~~~~~~~~~~~~^ (self.ip, self.command_port), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<2 lines>... socket_interface_manager=self ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\dev2\FreeDATA\freedata_server\socket_interface.py", line 166, in init super().init(server_address, RequestHandlerClass, ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bind_and_activate=bind_and_activate) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python313\Lib\socketserver.py", line 457, in init self.server_bind() ~~~~~~~~~~~~~~~~^^ File "C:\Python313\Lib\socketserver.py", line 478, in server_bind self.socket.bind(self.server_address) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^ TypeError: 'str' object cannot be interpreted as an integer

Thanks for reporting this, @Mashintime , I'm wondering if it is a general bug? Will try to reproduce it as well.

@DJ2LS
Copy link
Owner

DJ2LS commented Oct 5, 2025

@as3ii tbh, I'm not that happy with the linting stuff as its sometimes causing weird output. Maybe we can define linting in a developer / contributor manual? So we only respect some specific linting rules or adjust them. For example, sometimes it's making more sense in terms of readability, having slightly longer lines / more characters by line. Sure....pep rules are important. Looking forward to your opinion :-)

@DJ2LS
Copy link
Owner

DJ2LS commented Oct 5, 2025

Tested briefly. Currently running develop branch and copied my config.ini for testing. Appears to be issues with config processing and two things I've noticed straight away:

  1. auto_run_browser from config.ini isn't being honored (a browser window is opening despite my setting of false)
  2. hamlib is starting with extra args I don't want (and don't have set)

This PR: 2025-10-05T04:01:05.178197Z [info ] Successfully executed rigctld args=['-m', '2036', '-s', '0', '--set-conf', 'data_bits=0', '--set-conf', 'stop_bits=0', '--vfo', '-r', 'localhost:5002'] develope: 2025-10-05T04:04:40.831244Z [info ] Successfully executed rigctld args=['-m', '2036', '-r', 'localhost:5002']

Also getting this stacktrace 2025-10-05T04:03:42.220241Z [info ] [MDM] init: transmiting audio on 'DAX Audio TX (FlexRadio Systems DAX TX)' Exception in thread runner thread: Traceback (most recent call last): File "C:\Python313\Lib\threading.py", line 1043, in _bootstrap_inner self.run() ~~~~~~~~^^ File "C:\Python313\Lib\threading.py", line 994, in run self._target(*self._args, **self._kwargs) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\dev2\FreeDATA\freedata_server\service_manager.py", line 67, in runner self.ctx).start_servers() ~~~~~~~~~~~~~^^ File "C:\dev2\FreeDATA\freedata_server\socket_interface.py", line 204, in start_servers self.command_server = CustomThreadedTCPServer( ~~~~~~~~~~~~~~~~~~~~~~~^ (self.ip, self.command_port), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<2 lines>... socket_interface_manager=self ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\dev2\FreeDATA\freedata_server\socket_interface.py", line 166, in init super().init(server_address, RequestHandlerClass, ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ bind_and_activate=bind_and_activate) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python313\Lib\socketserver.py", line 457, in init self.server_bind() ~~~~~~~~~~~~~~~~^^ File "C:\Python313\Lib\socketserver.py", line 478, in server_bind self.socket.bind(self.server_address) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^ TypeError: 'str' object cannot be interpreted as an integer

I can confirm this issue, but its only occurring within this branch/PR

@DJ2LS
Copy link
Owner

DJ2LS commented Oct 5, 2025

I suggest reverting the linting commit and doing it step by step ( per linting rule, comments, line length, .... separated as PR) . This makes reviewing easier and more time efficient. It's also easier then finding issues. Sorry if I'm crashing your work, @as3ii there is no negative intension behind, just having problems with reviewing the changes while an issue occurred. I would appreciate if we can continue on the other topics you suggested. Specially regarding pytest vs unittest - it's a part which needs to be improved, maybe you have ideas. Also regarding contribution guidelines, maybe we can introduce some, specially regarding linting so everything becomes easier

@as3ii
Copy link
Contributor Author

as3ii commented Oct 5, 2025

Thanks for your work on the project, @as3ii I really appreciate help! Could you do me the favor, separating linting changes from "normal" changes? This makes it much easier reviewing the PR as I'm checking changed lines by line.

which of the 4 commits should I split?

@as3ii tbh, I'm not that happy with the linting stuff as its sometimes causing weird output. Maybe we can define linting in a developer / contributor manual? So we only respect some specific linting rules or adjust them. For example, sometimes it's making more sense in terms of readability, having slightly longer lines / more characters by line. Sure....pep rules are important. Looking forward to your opinion :-)

one of my goals with this PR is exactly this: remove "old" tools like autopep8/black/isort and switch to ruff, which is a configurable (via pyproject.toml or its dedicated config file) linter and formatter that incorporates inside all the rules defined by various PEP, flake8, pyflake, pycodestyle, and others, in this way you just need to run ruff check to get linting and ruff format to automatically format all the code.
If you want I can write here an example, maybe tell me the max line length you prefer (120?), if you want a list of all the other rules see: https://docs.astral.sh/ruff/rules/ (not all of them are enabled by default)

@as3ii
Copy link
Contributor Author

as3ii commented Oct 5, 2025

IIRC ruff by default enables only E4 E7 E9 F. As an example, in other projects I usually explicitly enable E W I N D UP ASYNC S BLE B A COM C4 DTZ EM FA ISC ICN LOG G PIE PYI Q RSE RET SLF SIM TID TCH INT ARG TD FIX ERA PL TRY PERF FURB DOC RUF and set the appropriate target python version

@DJ2LS
Copy link
Owner

DJ2LS commented Oct 5, 2025

Thanks, let's remove 04f0ca5 and d3976b4 - I'm open minded to usage of ruff as its combining some tools. A CI integration would be preferred. But I think we should do this in a separate PR.

Regardingpyproject.tomlfile, we probably could deprecate setup.py, question is, if we can move pyproject.toml to project root as well. I would appreciate of there is a way, we could use the pyproject.toml as well for auto publishing a pip package. IIRC it's possible, and it might bring us benefits regarding Suse Build Services.

@DJ2LS
Copy link
Owner

DJ2LS commented Oct 5, 2025

Regarding deprecation of 3.9, I waited until EOL which is reached by 10/25 - lets do it :-)

@as3ii
Copy link
Contributor Author

as3ii commented Oct 5, 2025

Thanks, let's remove 04f0ca5 and d3976b4 - I'm open minded to usage of ruff as its combining some tools. A CI integration would be preferred. But I think we should do this in a separate PR.

Regardingpyproject.tomlfile, we probably could deprecate setup.py, question is, if we can move pyproject.toml to project root as well. I would appreciate of there is a way, we could use the pyproject.toml as well for auto publishing a pip package. IIRC it's possible, and it might bring us benefits regarding Suse Build Services.

In other words, I have to remove the commits regarding code formatting and linting from this PR (putting them in a different PR, dedicated to the switch to ruff and everything linked), and leave in this PR dependency/pyproject changes. Did I understand correctly?

@DJ2LS
Copy link
Owner

DJ2LS commented Oct 6, 2025

Thanks, let's remove 04f0ca5 and d3976b4 - I'm open minded to usage of ruff as its combining some tools. A CI integration would be preferred. But I think we should do this in a separate PR.
Regardingpyproject.tomlfile, we probably could deprecate setup.py, question is, if we can move pyproject.toml to project root as well. I would appreciate of there is a way, we could use the pyproject.toml as well for auto publishing a pip package. IIRC it's possible, and it might bring us benefits regarding Suse Build Services.

In other words, I have to remove the commits regarding code formatting and linting from this PR (putting them in a different PR, dedicated to the switch to ruff and everything linked), and leave in this PR dependency/pyproject changes. Did I understand correctly?

Yes, thats correctly. Only thing we have to check is the correct place for pyproject.toml - I think in projects root might make more sense - but thats something we could also adjust afterwards as a work in progress.

@as3ii
Copy link
Contributor Author

as3ii commented Oct 6, 2025

removed the linting commits, removed references of python versions older then 3.10 (and added 3.13 where missing)

@as3ii as3ii marked this pull request as ready for review October 6, 2025 13:25
@as3ii as3ii changed the title Improve python side Add pyproject, cleanup python dependencies, deprecate python 3.9 Oct 6, 2025
@as3ii as3ii marked this pull request as draft October 8, 2025 08:53
colorama
ordered-set
nuitka<=2.7.13
nuitka<=2.7.16
Copy link
Owner

Choose a reason for hiding this comment

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

We have to test, if 2.7.16 is running fine, in past we had several issues with latest nuitka version.

Copy link
Owner

Choose a reason for hiding this comment

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

We also have a setup.py file in project root, maybe we can standardize everything and also fixing the pip package creation by this way. Deleting setup.py then. But I suggest a separated PR for this.

Copy link
Owner

Choose a reason for hiding this comment

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

I'm carefully with NSIS changes as it's a pain maintaining it. So in this case, this acts just as an escape character?

@DJ2LS DJ2LS marked this pull request as ready for review October 27, 2025 07:45
@DJ2LS DJ2LS merged commit ed0095c into DJ2LS:develop Oct 27, 2025
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