Skip to content

Conversation

@theMarix
Copy link
Contributor

@theMarix theMarix commented Mar 9, 2025

This pull reintroduced CI builds. The CI builds are now performed via a GitHub workflow that mimics the previous TravisCI setup. To get things working properly however, a couple further changes needed to be made:

  • Tests were moved to modern Python versions.
  • Usage of setup.py test has been dropped in favour of pytest
  • An issue with tainting of the ntfy default configuration in tests has been fixed.
  • Tests for xmpp code need to be skipped as the sleekxmpp library is no longer maintained and no longer works on any non-EOL version of Python.
  • Code was reformatted via YAPF to make the corresponding CI test pass

Further, as it was convenient, some further changes were made:

  • YAPF is now run in a separate step, so that it does not need to be re-run for the full build matrix
  • Dependencies are cached to reduce load on PyPI.

I did not drop the tests for the xmpp features as we might want to switch to using slixmpp in the future.

When dropping the setup.py test mechanism I had to find a different way to specify the test requirements. I moved them into test-requirements.txt. An alternative might be to switch the whole test set-up to Tox. This would allow having a CI test specification that could also easily be run locally and also make it trivial to run operations like formatting.

Note that some of this PR was generated via Copilot. So if you don't want LLM code in your project, please let me know.

CI Setup:

  • .github/workflows/ci.yml: Added a new CI workflow configuration to run format checks and tests on different operating systems and Python versions.

Documentation Updates:

  • README.md: Updated the testing section to include instructions for installing test dependencies and running tests using pytest.

Code Formatting Improvements:

  • ntfy/__init__.py: Improved code readability by adjusting the formatting of notify function calls and argument handling. [1] [2]
  • ntfy/backends/*: Applied consistent formatting to notify function definitions and calls across multiple backend files, including linux.py, matrix.py, notifico.py, ntfy_sh.py, prowl.py, pushbullet.py, pushover.py, slack_webhook.py, telegram.py, and win32.py. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]

CLI and Configuration:

  • ntfy/cli.py: Improved formatting of argument parsing and message formatting functions for better readability. [1] [2] [3] [4] [5]
  • ntfy/config.py: Made a minor change to copy the default configuration to avoid potential issues with mutable defaults.

Miscellaneous:

  • ntfy/terminal.py: Improved formatting of functions related to terminal window focus detection. [1] [2]
  • setup.py: Removed unused test dependencies and the tests_require and test_suite arguments from the setup configuration. [1] [2]

theMarix and others added 13 commits March 9, 2025 13:26
…execution

[`setup.py test` has been deprecated for a while now](https://setuptools.pypa.io/en/latest/deprecated/commands.html#test-build-package-and-run-a-unittest-suite) and `test_dependencies` actually seems to fail on modern Python and setuptools versions. Thus:
- Install additional test dependencies from test-requirements.txt
- Switch from setup.py test to pytest for running tests
- Update README with new testing commands
The used sleekxmpp library is no longer maintained and does not work on any non-EOL version of Python.

We might want to switch to using https://codeberg.org/poezio/slixmpp in the future.
We need to account for parallel execution of jobs.
It does not make sense to check formatting separately for each Platform
The dependencies don't install properly in this case
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
It seems the YAPF formatting check was broken for a while and non-conformant formattings snuck in. This reformats the codebase with YAPF.
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