🚀 Get started

How to start using Naas in minutes.

Welcome to Naas

If you want to use Naas on your local Jupyter environment, it's free and open-source, just follow the procedure below :

Why Naas?

Jupyter Notebooks are awesome, but using them in production can be risky & messy.

Naas allows Jupyter Notebooks become a safe production script !

Basic features

Naas makes a dynamic production environment based out of your current notebook folder.

Create a folder, open a notebook, and import Naas :

import naas

Schedule your notebook

Send in production this notebook and run it, every day at 9:00

# do stuff in your notebook
naas.scheduler.add(recurrence="0 9 * * *")

Add a dependency

Send in production any file type like test.csv as a dependency:

naas.dependency.add("test.csv")

Add a secret key

Copy in production any secret key :

naas.secret.add(name="API_NAME", secret="API_KEY")

Remove the previous line and get your secret key with :

naas.secret.get(name="MY_API_KEY")

This allows you to push your notebook in production without sensitive data getting exposed.

Advanced features

If you use Naas cloud they all work natively, otherwise go to :

Use Notebooks as API

Copy in production this notebook and allow to run it by calling the returned URL:

naas.api.add()

Call the URL with your navigator you will get a message and see the notebook has run.

If you want to download the notebook result instead, add this line:

naas.api.respond_notebook()

Expose assets

Copy in production this asset ( file ) and allow to get it by calling the returned url:

link = naas.assets.add("tesla-chart.html")

Send notifications

Send an email notification to anyone, notify about data changes, alert on notebooks operations, etc...

# Get link var from previous step
subject = "The tesla action is going up"
content = "check in the link the chart data maide from fresh dataset : " + link
naas.notifications.send(email=email, subject=subject, content=content)

Version

Get

the version number in your local machine

import naas
naas.version()

Are you at the last version

import naas
naas.up_to_date()

Get remote version

the last version number in Github

import naas
naas.get_last_version()

Update

If you need update it will restart your machine

import naas
naas.auto_update()

Documentation

Show a button to quick open this documentation from Jupyter

import naas
naas.doc()

Help

If at any time you are lost, you need help, or just want some info !

import naas
naas.open_help()

Close help chat

import naas
naas.close_help()

N_ENV

This represent the naas env vars, you can get all to make your script work `naas.n_env`

api_port
current
version
remote_mode
api
notif_api
callback_api
proxy_api
hub_api
any_user_url
user_url
naas_folder
server_root
path_naas_folder
shell_user
remote_api
token
user
tz
sentry_dsn
scheduler
scheduler_interval
scheduler_job_max
scheduler_job_name
scheduler_timeout

Current

get data in production of current running notebook.

For now current give you this :

import naas
print(naas.n_env.current)
# This will be empty in dev = in notebook run by you
# and with vars when run by naas runner ( scheduler or webhook )

Timezone

Set timezone

import naas
naas.set_remote_timezone("Europe/Lisbon")

Get timezone

import naas
naas.get_remote_timezone()

Download url

Create a download link to naas from any public url, it can be in github, or anywere !

import naas
url = "https://github.com/jupyter-naas/awesome-notebooks/blob/master/Airtable/Airtable_delete_data.ipynb"
dl_url = naas.get_download_url(url)

Changelog

Show changelog

import naas
naas.changelog()

Feature request

show feature request inside Jupyter

import naas
mode = "naas" # can be naas, naas_drivers, awesome_notebook
naas.feature_request(mode)

Check if you are in production

import naas
naas.is_production()