Skip to content
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

Migrate to pyproject.toml and modernize project configuration, fix some issues #100

Merged
merged 11 commits into from
Feb 2, 2025

Conversation

mdevolde
Copy link
Contributor

This pull request introduces significant changes to modernize the project's setup and workflows. The primary focus is on migrating from setup.py to the standardized pyproject.toml as per PEP 517 and PEP 518. Additionally, this PR updates the automated test workflow to use the latest versions of the technologies used. It also increases the language tool version and corrects a minor bug in the command line.

Key Changes

  1. Migration to pyproject.toml:

    • Replaced the legacy setup.py with pyproject.toml for project metadata and build configuration.
    • Utilized [project] table as defined in PEP 621, which standardizes how project metadata is declared.
    • Declared build-system requirements (setuptools and wheel) under [build-system] as per PEP 518.
  2. Updates to GitHub Actions Workflow:

    • Added support for Python 3.9, 3.10, and 3.11, while deprecating older versions.
    • Integrated setup-python@v4 and setup-java@v3 for improved compatibility and modern features.
    • Ensured all steps are executed within isolated venv environments.
  3. Refactoring and Dependency Management:

    • Updated dependencies and optional dependencies in pyproject.toml.
    • Removed redundant or unused dependencies like wheel from runtime requirements.
    • Specified requires-python = ">=3.9" to target modern Python versions and leverage their features.
  4. Bug patches and version upgrades

    • Languagetool version increased to 6.5
    • Fixed bug in command line launch

Why

The migration to pyproject.toml aligns the project with modern Python packaging standards, as recommended by PEP 621. This transition simplifies dependency declaration, improves compatibility with build tools, and ensures the project remains future-proof. I think this is a good thing to facilitate contributions in the future.

Testing

  • Verified installation and build processes using python -m build.
  • Ensured compatibility with the declared Python versions (3.9 to 3.11).
  • Validated GitHub Actions workflow on push and pull request triggers (pytest tests)

- Replaced setup.py with pyproject.toml as the primary configuration file.
- Updated build and installation process to leverage PEP 517/518 standards.
- Configured package metadata, dependencies, and optional dependencies in pyproject.toml.
- Removed legacy setup.py and its references across the project.
- Updated MANIFEST.in to ensure proper inclusion/exclusion of files in source distributions.
- Adjusted GitHub Actions workflows and deployment script to use modern build commands (e.g., `python -m build`).
- Updating .gitignore to include pyenv and some build dirs

This commit modernizes the package and aligns it with current Python packaging standards, improving maintainability and compatibility with tools like pip, build, and twine.
- Updated Python versions to test on 3.9, 3.10, and 3.11, replacing older versions (3.6, 3.7, 3.8).
- Migrated from `setup-python@v2` to `setup-python@v4` for improved support and compatibility.
- Introduced virtual environment (`venv`) for isolating dependencies in each job.
- Adding a java installation with `setup-java@v3` for consistent JDK 21 setup.
- Added verification steps for installed dependencies and environment details.
- Updated the runner to Ubuntu 22.04 for a more modern and supported environment.
- Fixed a bug in the command line (retrieving the version with a deprecated function)
…20, and 3.8 no longer maintained since 2024)
@mdevolde
Copy link
Contributor Author

mdevolde commented Jan 26, 2025

I've just added a fix for a bug that was preventing the _terminate_server function from executing correctly, which by extension prevented the correct execution of close function and therefore of context managers with the LanguageTool class, on Windows.

The process was not killed correctly and there was a deadlock on stdout.

This was the problem encountered by the person in #76 and by the person in #56

… with windows, resolve an incomatibilty of a test with windows
@mdevolde
Copy link
Contributor Author

I have just fixed a problem in the _unregister_spellings function (which, on Windows, did not restore the file to its initial state). So I've modernized _register_spellings and _unregister_spellings to also take duplicates into account. I've also fixed a small problem in a test that made it incompatible with Windows.

… account, removed “guess_language” which is not included in dependencies, replaced print function which is useless since python 3
@mdevolde
Copy link
Contributor Author

My last two pushs made the command line usable again, even when you have an unsupported local language, and added the bash tests of the command line to the github actions workflow.

That's all I wanted to do in my PR! Good review. Don't hesitate if you have any questions or changes to ask.

@mdevolde mdevolde changed the title Migrate to pyproject.toml and modernize project configuration Migrate to pyproject.toml and modernize project configuration, fix some issues Jan 27, 2025
@mdevolde
Copy link
Contributor Author

(Latest commit to correct a display problem when downloading a customized version of LanguageTool (#88), and added picky mode (#91))

…rers, pipelineCaching, premiumOnly and pipelinePrewarming wasn't working) and removing deprecated options
@mdevolde
Copy link
Contributor Author

mdevolde commented Feb 2, 2025

Fixed a bug that prevented some local server options from working, as they were written in the wrong format and therefore not understandable by Languagetool.
This commit corrects issue #101.

@jxmorris12 jxmorris12 merged commit efd5bde into jxmorris12:master Feb 2, 2025
3 checks passed
@jxmorris12
Copy link
Owner

Thanks so much @mdevolde!

@mdevolde
Copy link
Contributor Author

mdevolde commented Feb 2, 2025

@jxmorris12 Would it be possible to bump the version of the package.

You can also change the LanguageTool installation version at the very beginning of the readme from 6.4 to 6.5.

There is also the ‘Full list of configuration options’ section in the readme which should be updated.

(I can do a quick PR with all this if you prefer)

@jxmorris12
Copy link
Owner

Do you mind adding through a PR, then I'll push to pypi? @mdevolde

@mdevolde
Copy link
Contributor Author

mdevolde commented Feb 2, 2025

@jxmorris12 I'll be doing that shortly

@mdevolde
Copy link
Contributor Author

mdevolde commented Feb 2, 2025

@jxmorris12 All done!

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.

2 participants