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

refactor: modernisation of proselint #1371

Draft
wants to merge 423 commits into
base: main
Choose a base branch
from
Draft

Conversation

Nytelife26
Copy link
Member

@Nytelife26 Nytelife26 commented May 13, 2024

this is a follow on from #1361. credit to @orgua for the initial work here.

following a request that no work from the initial refactoring effort should be used, preserved below, the oxidation of proselint begins.
image
it can be observed here that the time it now takes to launch proselint, parse CLI options, find config paths for both JSON and TOML, and deserialize them, is faster than it previously took just to load the CLI options. it is worth noting that the previous measurements were taken even after a highly optimised refactor that involved replacing click with a simplified parse function.
image

it may take some time to get this all up and running. i would like to thank any onlookers for bearing with me.

keeping this here so i don't forget:

  • moka for caching(? few libraries support TTL in an LRU, which is the style used in proselint)
  • postcard for cache persistence, due to its relatively good performance and efficient output size

This commit is expected to land at a time close to or after 2024-10-01,
following which Python 3.8 will be end-of-life. Several tools already
require a Python version >=3.9, which has caused dependency resolution
issues for some time now. Python 3.9 changed the workings of the type
system  quite substantially. This will allow for a higher code quality
going forwards.

BREAKING CHANGE: Python 3.8 is no longer supported as of this commit.

To migrate, update your system's Python version.
@tecosaur
Copy link

tecosaur commented Oct 9, 2024

This looks fantastic @Nytelife26! I see the last commit here is from July, is there much more that needs to be done?

@Nytelife26
Copy link
Member Author

is there much more that needs to be done?

I am in the process of porting proselint in its entirety, which became a necessity after an unfortunate conflict arose with the original author of the refactor. I see this as the best possible path forward for proselint - a fresh start, which will come with performance benefits, long-overdue housekeeping, and a good chance to implement some features people have been asking for for a long time.

This effort has not been easy, and while I'm back at university, things have been a hard balance. However, I have many of the internals done already (configuration, core parts of the command line, specification structures), and I feel good progress is being made.

I will be making this effort more public once I have a solid foundation in place. For now, the latest commits to this pull request mark the last Python version of the project, unless some major breakthrough in communication happens.

Let me know if you have any furher questions. As always, I am incredibly grateful and happy to see that people are still interested in proselint. Things were rough, with stagnant development after communications ceased some years ago, but I am excited to finally have the chance to revive this project.

@Nytelife26
Copy link
Member Author

Small victories are showing - the command line, configuration parser, and check primitives are operational. As an additional bonus, all of the check specifications will be evaluated and stored at compile-time, entirely eliminating runtime discovery costs from the Python version.

Shown here is the first test with an actual regex specification from the original code.

image

Some things are not yet possible for reasons beyond my control, like consistent case-insensitive matching without using hacky mode modifiers (blocked by fancy-regex#132). I also have yet to implement parallelization, but that will not be a priority until much of the other major work is complete; although, it should be as trivial as adding Rayon and adjusting the dispatch iterators.

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.

5 participants