-
Notifications
You must be signed in to change notification settings - Fork 166
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
use pytoolconfig for configuration #473
Conversation
Having minimal dependency outside of the standard library is one of the important goal of rope for me. I'd prefer to not have runtime dependencies on In my ideal world, The other dependencies that we pulled Also, if |
pydantic offers a couple of nice features - namely quick configuration validation. An alternative arrangement would be to use python dataclasses, and make pydantic a fully optional runtime dependency for validation. I will look into the viability of this option, since it reduces pytoolconfig's non-standard dependencies to 0 (packaging and tomli are both basically guaranteed to be installed). |
I've successfully removed the pydantic dependency by making pytoolconfig use dataclasses. I've also dropped python 3.6 (and some old python 2 code and <3.6 code) from this branch and gave rope the ability to detect the python version a project is using (and dependencies for autoimport). DocumentationI made a sphinx generator for configuration documentation and configured sphinx . I didn't add the RTD theme, but otherwise it's possible to use it on readthedocs. |
Hi Bagel, thanks for this, I've cherry-picked some of the commits out of this PR, since they're unrelated to the pytoolconfig/toml changes. In the future, I'd recommend creating individual PRs for each separate sets of changes, as it will make it much easier to review. |
CONFIGURATION.md
Outdated
| rope.compress_objectdb | | bool | False | | ||
| rope.automatic_soa | | bool | True | | ||
| rope.soa_followed_calls | The depth of calls to follow in static object analysis | int | 0 | | ||
| rope.preform_doa | If `False` when running modules or unit tests 'dynamic object analysis' is turned off. This makes them much faster. | bool | True | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: this should have been perform_doa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
This branch no longer specifies setuptools configuration in setup.py, the previous merge conflict resolution accidentally reverted this change.
It's good to have an example file here
Maybe figure out how to get pytoolconfig to generate the default config.py from Prefs class?
Why did you restore the default_config.py?
|
I restored it because we still need to provide an example configuration for people that still want to use Eventually I'd like this example file to be automatically generated from the Prefs dataclass so that it doesn't get out of sync with |
The documentation has documentation on config.py and all the subkeys. I may look into generating a config.py in the future, perhaps standardizing into pytoolconfig somehow. Maybe we can move it into docs and link it from the configuration.rst? |
Yes, that's the plan; it's now no longer the primary form of documentation, but just providing examples that users can copy and adapt and should be linked from configuration.rst. It would be useful to have examples for pyproject.toml as well. Not quite sure what the API can look like to be standardized in pytoolconfig, but it's basically just going to be "rendering a template based on Prefs dataclass". So either pytoolconfig need to gain a templating engine for this purpose or just keep it simple with a generic callable mechanism that, given the Prefs class, the callback can do anything the application needs to do, like generating files. |
For the scope of this PR though, I think we should just link this file from configuration.rst and move the default_config.py to docs. Auto-generating the example files should be looked into in a separate PR. |
Well the original idea was writing a whole markdown file from a PyToolConfig object, which contained all the requisite information for generating an entire configuration file But I decided that a custom markdown build system is a bad idea, so switched to sphinx but don't like their extension system as much. I'll have to look into better ways to do this (and PR changes back here), I think the way I'll go is generate markdown and use it in sphinx via myst. |
Thank you for the really great work in improving and modernizing rope's tooling situation, @bageljrkhanofemus. |
Description
Fixes #401
Use pyproject.toml based configuration via pytoolconfig.
Behavior is now
Rope will no longer create a config.py, but instead document each configuration key.
All the keys have been placed in
rope/base/prefs.py
. Future keys must be placed and documented here.Documentation
The project now uses sphinx to generate documentation (includeing configuration keys). It should work with read the docs out of the box.
Pyproject.toml
I moved setuptools metadata to pyproject.toml
https://setuptools.pypa.io/en/latest/userguide/quickstart.html - use config.py stub
Python 3.6
Python 3.6 is unsupported
I will implement the ability for rope to target old python versions automatically in a future PR, but this PR drops 3.6 support.
Pathlib
I added a pathlib method to the resource object to ease use of pathlib. I'm not sure if I used the correct name for it or should remove it.
Checklist (delete if not relevant):