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

Added documentation for app.paths #1849

Merged
merged 8 commits into from Apr 17, 2023

Conversation

LunaMeadows
Copy link
Contributor

@LunaMeadows LunaMeadows commented Apr 8, 2023

Created a paths property so that it would be added to the app API Reference.
Added documentation for app.paths.

Adds documentation for app.paths so that users know how to use app.paths

Fixes #1569

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@LunaMeadows LunaMeadows marked this pull request as ready for review April 8, 2023 00:09
Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

A good start; some suggestions inline. I'd also suggest running through the development environment setup in the docs; that will catch some of these markup errors before you submit a PR. Those docs also describe why the towncrier CI failure is occurring.

resizeable=True,
minimizable=True,
factory=None, # DEPRECATED !
on_close=None,
Copy link
Member

Choose a reason for hiding this comment

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

I'm betting you use PyCharm. I can tell, because PyCharm's default indentation rules are Just Wrong. This has been picked up by the pre-commit check run in CI; if you install pre-commit in your local development environment, you'll get the same warning.

locations.

PROPERTIES:
**App**: Location of where the apps code is run.
Copy link
Member

Choose a reason for hiding this comment

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

The capitalisation is wrong here - the property is app, not App.


**Data**: System appropriate location to store user data.

**Cache**: System cache location. Files stored in this location may be able to be accessed quicker than normal locations.
Copy link
Member

Choose a reason for hiding this comment

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

This is a bit misleading. Cached files are used to optimise runtime performance, but that's not because the files load faster - cache file locations are just file locations. They're no faster to access.

The distinction is more about whether the files should be considered a permanent store of data, or ephemeral. You should assume that any cached file can and will be purged by the operating system at any time. Your browser uses cached files so that it doesn't need to repeatedly download an asset file; but if the cached file is deleted, it can be restored by downloading the file again.


**Logs**: Location of toga log files.

**Toga**: Returns a path to a Toga system resources.
Copy link
Member

Choose a reason for hiding this comment

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

It would be more accurate to say the location of the core Toga code module.

Paths for known safe system locations. Using paths makes sure you have a consistent and known location to store
files for your app. Also, some platforms do not allow arbitrary file access to any location on disk. On Android,
there are many limitations when it comes to accessing file locations and the apis you can use to read from those
locations.
Copy link
Member

Choose a reason for hiding this comment

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

Line length should be wrapped at ~80 chars. This should also mention that the locations returned are Pathlib objects.

there are many limitations when it comes to accessing file locations and the apis you can use to read from those
locations.

PROPERTIES:
Copy link
Member

Choose a reason for hiding this comment

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

It would be better to use native ReST markup, rather than capitalisation and indentation. This is effectively a subheading with bullet point descriptions.

It probably also warrants a description of why a property (paths) has properties.

Changed definition listed for cache and toga properties
Updated formating to use ReST styles
@LunaMeadows
Copy link
Contributor Author

Realized I included the wrong information in the changes file. Will update that to the proper information if anything else needs changed then or if it's all good I will submit the updated file.

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

This still needs some fixes - some of which I referenced in previous reviews.

changes/1569.feature.rst Outdated Show resolved Hide resolved
@property
def paths(self):
"""
Paths for known safe system locations. Using paths makes sure you have a consistent and known location to store
Copy link
Member

Choose a reason for hiding this comment

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

Line length is still an issue - it should be wrapped at ~80 chars.

There's also no mention of Pathlib as a return type, as previously requested.

Copy link
Member

Choose a reason for hiding this comment

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

Can I instead suggest that we wrap at 88 columns, the same as Black? That makes it much easier to set one line length in your editor and use it everywhere.

"""
Paths for known safe system locations. Using paths makes sure you have a consistent and known location to store
files for your app. Also, some platforms do not allow arbitrary file access to any location on disk.
On Android, there are many limitations when it comes to accessing file locations and the apis
Copy link
Member

Choose a reason for hiding this comment

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

This isn't an Android-specific thing. iOS has the same set of constraints - and technically, so do macOS and Windows when you use packaged/sandboxed apps.

Also - it's not just that they're known locations - it's that they're platform appropriate locations.

LunaMeadows and others added 4 commits April 15, 2023 05:13
Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
… set to 100 and not 80 like I thought.

Added description for why paths has properties

Added return type

Removed note about android specific limitations.
Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

I've made some minor wording changes, but otherwise, this looks good. Thanks!

@freakboy3742 freakboy3742 merged commit e7ffdbc into beeware:main Apr 17, 2023
43 checks passed
@LunaMeadows LunaMeadows deleted the App_path_#1569 branch May 3, 2023 05:44
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.

App.paths property is not documented
3 participants