Anvil Documentation Suggestions [ON-GOING]

linking this thread for missing docs on anvil.tables.app_tables in the api docs.

linking 2 issues on anvil.server

I don’t think this is listed in the docs.
It could also be included in the api documenation I don’t think callable is even listed there.
https://anvil.works/docs/api/anvil.server


suggested enhancement to the advanced section of anvil.server.callable
on how to use decorators to validate users and user privileges

this often comes up in the forum but isn’t in the docs.

The instruction in the step 4 is missing a bit of information.

It’s important to remember to change
ArticleEdit() ---> missing

to 

ArticleEdit(item=new_article)

Media.get_url(…) is not documented but is fairly essential in combination with its use in an Iframe component (sees Altair example).

Also I was puzzled why the url property was None. Today I found the explanation here: https://anvil.works/docs/media#using-media-objects-directly but not in the API docs.

I created a Ploty graph on a new app, and clicked on the help button within the Properties pane of the Anvil editor. The Python import statement references graph_objects vs the full documentation page mentions graph_objs. (see screenshot) The latter works for all cases, the former does not find the Marker class per the code example given. I was trying to change the color of the bars of my bar chart. Using the latter module import worked.

API Docs
anvil.server module

Should also list:

  • callable
  • background_task
  • launch_background_task
  • task_state
  • session
  • type Task and its members (though this is summarized nicely in the docs)
1 Like

Thanks all for continuing to raise issues as you find them. They’re all on our issue tracker and I’m working to get them all fixed! :slight_smile:

5 Likes

I found that --letsencrypt-staging should be added to prevent Let’s Encrypt’s stringent rate limits

anvil-app-server --app CRUDnewsappwalkthrough --origin https://ryans-test-app.xyz/ 

https://anvil.works/docs/how-to/standalone-runtime/vps-app-server-guides/digitalocean-app-server-deployment

It would be great that you could add full Python 3 should be used to make sure there is no Background Tasks Timeout on Individual plan
https://anvil.works/docs/background-tasks

There is a error in this document:
pip install anvil-standalone-runtime should be changed to pip install anvil-app-server

$ sudo su
\# apt update
\# apt install openjdk-8-jdk python3.7 virtualenv
\# echo 'net.ipv4.ip_unprivileged_port_start=0' > /etc/sysctl.d/50-unprivileged-ports.conf
\# sysctl --system
\# exit
$ virtualenv -p python3 venv
$ . venv/bin/activate
$ pip install anvil-standalone-runtime  --> change to pip install anvil-app-server
$ git clone git@anvil.works:2222/SOME_APP.git MyApp
$ anvil-app-server --app MyApp --origin https://my-hostname.example.com
3 Likes

https://github.com/anvil-works/anvil-runtime/blob/master/README.md

smtp-encryption

Enable TLS for connecting to outbound SMTP server (see  `smtp-host` ).

and

--smtp-encryption Use TLS to connect to SMTP server

It could be made clearer that this option is not a boolean “true” or “false” but requires “starttls” or “ssl” as a string value.

(let [session (Session/getInstance (make-props (merge {“mail.smtp.starttls.enable” (if (contains? #
{“ssl” “starttls”} encryption) “true” “false”)}
(when (= encryption “starttls”)
{“mail.smtp.starttls.required” “true”}))))
1 Like

In https://anvil.works/docs/api/anvil#Image_attributes, the purpose of display_mode is given as “Determines how the image’s size should be adjusted to fit the size of this Image component”
but its valid values are not specified here.

Edit: You can find them at https://anvil.works/docs/media/image-manipulation, but you might not think to look there.

1 Like

The documentation for server code says that

Server functions run synchronously and should return fairly quickly. By default, the timeout is set to 30 seconds, after which a running function will be stopped. For longer-running jobs, you should use Background Tasks.

However, it does not specify how to change the timeout length (and I’m not entirely sure you even can, as it implies), and it does not note that background tasks are subject to the same limit (when using the ‘Basic’ runtime, as noted by Tony.Nguyen)

1 Like

app_tables.[table_name].delete_all_rows() cannot be found in any document.
I need the function and only found it in this clone app:

1 Like

I’d like to amplify this. To find it in the documentation, you have to use the browser’s find feature, not the site’s.

I haven’t found class definitions for tables at all in the API reference. Without that, our friends at Anvil have no place to hang documentation of its class members.

1 Like

Thank you all for the recent additions. I’ve added them to our issue tracker and we will work on getting them all fixed.

2 Likes

It is great that geting values from several columns are documented:

Due to my limited python knowledge and missing self. in the document, it took me 1 hour to find out. Hopefully the fix will save ones’ time

def handle_click(**event_args):
  alert("The button got clicked!")

self.button_1.set_event_handler('click', handle_click) --> should be self.handle_click

https://anvil.works/docs/client/components#events

It should only be self if handle_click is defined inside the class. It could, in theory, be defined outside of the class scope - which I think the docs are implying… Say just below your import statements and above the class definition - or even as a function defined in some module somewhere in your app. In this case the docs are accurate.

But it is the case that this is not typical behaviour and so the docs here might better align with the general style expected and certainly the default style when you double click on a button - wherein the click event automatically gets defined inside the scope of the class… :thinking:

1 Like