PyCon Otto 6-9 April 2017 Florence. Rusty Python. Rust, a new language for our programmer tool belt. Matteo

Size: px
Start display at page:

Download "PyCon Otto 6-9 April 2017 Florence. Rusty Python. Rust, a new language for our programmer tool belt. Matteo"

Transcription

1 PyCon Otto 6-9 April 2017 Florence Rusty Python Rust, a new language for our programmer tool belt Matteo 1

2 Rust Born as a personal project started in 2006 by Mozilla employee Graydon Hoare Mozilla began sponsoring the project in 2009 and announced it in 2010 A young language, with a growing usage in production (Dropbox, Mozilla, Canonical, OVH,...) 2. 1

3 2. 2

4 Hello, World! install the Rust toolchain with `rustup` $ cargo new hello-world --bin Created binary (application) `hello-world` project $ cd hello-world/ $ tree. Cargo.toml src main.rs 1 directory, 2 files 3

5 Hello, World! fn main() { println!("hello, World!"); huhu? `println!`? 4

6 How we run it? `cargo run` $ cargo run Compiling hello-world v0.1.0 (file:///home/naufraghi/.../hello-world) Finished dev [unoptimized + debuginfo] target(s) in 0.41 secs Running `target/debug/hello-world` Hello world! 5

7 Docstrings? //! Programma di esempio per _PyCon Otto_, //! l'immancabile «Hello, World!». fn main() { println!("hello, World!"); `cargo doc --open` 6

8 Integrated docs Cool, but in Python have `doctest`, I can't live without it! 7

9 And Rust "borrowed" the idea! //! Libreria di esempio per _PyCon Otto_, //! l'immancabile «Hello, World!». //! //! ``` //! use hello_world_lib::greater; //! let message = greater("world"); //! assert_eq!(message, "Hello, World!"); //! ``` pub fn greater(name: &str) -> String { format!("hello, {!", name) in fact a lot of ideas from Python 8

10 Run `cargo test --doc` $ cargo test --doc Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs Doc-tests hello-world-lib running 1 test test greater_0... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured 9

11 Let me see that code again... pub fn greater(name: &str) -> String { format!("hello, {!", name) Where is the `return`? It's implicit, the last expression is returned... beware of forgetting some `return` in Python after a switch :) 10

12 Optional arguments pub fn greater2(optional_name: Option<&str>) -> String { //! Restituisce un saluto di default se il nome è None //! //! ``` //! use hello_world_lib::greater2; //! let message = greater2(none); //! assert_eq!(message, "Hello, World!"); //! //! let message = greater2(some("matteo")); //! assert_eq!(message, "Hello, Matteo!"); //! ``` let name = match optional_name { Some(name) => name, None => "World", ; format!("hello, {!", name) no default values... yet `if` and `match`are expressions in Rust 11

13 Managing None Python var = some_optional_value() if var is not None: res = do_something_with(var) else: res = None Rust res = if let Some(var) = some_optional_value() { Some(do_something_with(var)) else { None 12

14 `None` is a serious thing fn main() { let out = if let Some(value) = some_optional_value("some") { do_something_with(value) else { None ; println!("out: {:?", out); 13

15 Nice error messages 14. 1

16 Rust Playground

17 In Rust we have other ways some_optional_value().map(do_something_with) pub enum Option<T> { None, Some(T), `Option::map` will not call `do_something_with` if the value is `None` 15

18 `Option` docs 16

19 Methods struct Circle { x: f64, y: f64, radius: f64, impl Circle { fn area(&self) -> f64 { std::f64::consts::pi * (self.radius * self.radius) self &self &mut self 17

20 Traits struct Circle { x: f64, y: f64, radius: f64, trait HasArea { fn area(&self) -> f64; this is what your lib users will need to implement impl HasArea for Circle { fn area(&self) -> f64 { std::f64::consts::pi * (self.radius * self.radius) 18

21 Duck typing Python def print_area(shape) { print("this shape has an area of {".format(shape.area())); Rust fn print_area<t: HasArea>(shape: T) { println!("this shape has an area of {", shape.area()); Traits are something we can use where in Python we were using duck typing 19

22 Implementing Traits class Counter(abc.Iterator): struct Counter { def init (self): count: usize, self.count = 0 def nxt (self): impl Counter { self.count += 1 fn new() -> Counter { return self.count Counter { count: 0 impl Iterator for Counter { type Item = usize; fn nxt(&mut self) -> Option<Self::Item> { self.count += 1; Some(self.count) with a typo in both Traits are somewhat similar to the `collections.abc` in Python 20

23 error[e0407]: method `nxt` is not a member of trait `Iterator` --> <anon>:11:5 Implementing Traits 11 fn nxt(&mut self) -> Option<Self::Item> { ^ starting here self.count += 1; >>> 13 c = Counter() Some(self.count) Traceback 14 (most recent call last): File ^ "<ipython-input-29-f3cf168481b9>",...ending here: not a member line of trait 1, in `Iterator` <module> c = Counter() TypeError: error[e0046]: Can't not instantiate all trait items abstract implemented, class Counter missing: with `next` abstract --> <anon>:9:1 methods next 9 impl Iterator for Counter { _^ starting here type Item = usize; 11 fn nxt(&mut self) -> Option<Self::Item> { 12 self.count += 1; 13 Some(self.count) _^...ending here: missing `next` in implementation = note: `next` from trait: `fn(&mut Self) -> std::option::option<<self as std::iter::iterator>::item>` Runtime check Compile time check 21

24 We have barely seen Rust as a language Rust is not easy, there are a lot of concepts, one can learn step-by-step. The tooling is good The docs are good Let's use Rust! 22

25 Let's rewrite Electric Sheep Fly down! Paper on 41 pages 23

26 Iterated Function System Barnsley fern Given 4 linear function with some magic parameters (a,b,c,d,e,f) / a b \ / x \ / e \ f(x,y) = + \ c d / \ y / \ f / Choose a random starting point, say (0,0) Loop: pick a random function apply the func on the last point collect the result 24

27 Iterated Function System F (x, y) w 1 1 F (x, y) w 2 2 F (x, y) w 3 3 F (x, y) w 4 4 p = F (p ) i+1 k i Plot the histogram Take one at random and collect the points 25. 1

28 Python for i in range(iterations): f = np.random.choice(arange(4), p=weights) if f == 0: P = F1 * P + F1c elif f == 1: P = F2 * P + F2c elif f == 2: P = F3 * P + F3c else: P = F4 * P + F4c if i > pointstoskip: drawpoints[frame][i-pointstoskip] = squeeze(asarray(p)) 25. 2

29 Rust for i in 0..iterations + 1 { let f = wc.ind_sample(&mut rng); if f == 1 { p = f1 * p + f1c; else if f == 2 { p = f2 * p + f2c; else if f == 3 { p = f3 * p + f3c; else { p = f4 * p + f4c; if i > points_to_skip { points.push((p.x, p.y)); 25. 3

30 How does it work? 26. 1

31 Build the extension $ python setup.py develop running develop running egg_info writing top-level names to ifs.egg-info/top_level.txt writing dependency_links to ifs.egg-info/dependency_links.txt writing ifs.egg-info/pkg-info reading manifest file 'ifs.egg-info/sources.txt' writing manifest file 'ifs.egg-info/sources.txt' running build_ext running build_rust cargo rustc --lib --manifest-path Cargo.toml \ --features cpython/extension-module cpython/python3-sys \ --release -- --crate-type cdylib Finished release [optimized] target(s) in 0.0 secs Creating /home/naufraghi/.../python3.5/site-packages/ifs.egg-link (link to.) ifs 1.0 is already the active version in easy-install.pth Installed /home/naufraghi/documents/src/rusty-python-pyconotto/barnsley-fern Processing dependencies for ifs==1.0 Finished processing dependencies for ifs==

32 Generating the fern $ python fern.py Using Python Frame 0 generated... Frame 11 generated Fern data generation completed in 23.3s Rendered frame Rendered frame 0011 Converting to animated gif... Gif Generated 26. 3

33 Generating the fern $ python fern.py rust Using Rust Frame 0 generated... Frame 11 generated Fern data generation completed in 0.4s Rendered frame Rendered frame 0011 Converting to animated gif... Gif Generated 26. 4

34 Generating the fern image size 300 -> 600 iterations > $ python fern.py rust Using Rust Frame 0 generated... Frame 11 generated Fern data generation completed in 3.3s Rendered frame Rendered frame 0011 Converting to animated gif... Gif Generated 26. 5

35 Python wrapper use cpython::{pyresult, Python; use barnsley_fern; py_module_initializer!(_iterated_function_systems, _inititerated_function_systems, PyInit iterated_function_systems, py, m { try!(m.add(py, " doc ", "Rust iterated function systems")); try!(m.add(py, "barnsley_fern", py_fn!(py, py_barnsley_fern(iterations: usize, points_to_skip: usize, bending: f64)))); Ok(()) ); fn py_barnsley_fern(py: Python, iterations: usize, points_to_skip: usize, bending: f64) -> PyResult<Vec<(f64, f64)>> { Ok(barnsley_fern(iterations, points_to_skip, bending)) 27

36 Python wrapper rust-cpython has an impl for most builtin types 28

37 from setuptools import setup from setuptools_rust import RustExtension setup.py setup(name='ifs', version='1.0', rust_extensions=[ RustExtension('ifs._iterated_function_systems', 'Cargo.toml', debug=false)], packages=['ifs'], # rust extensions are not zip safe, just like C-extensions. zip_safe=false) [package] name = "ifs" version = "0.1.0" authors = ["Matteo Bertini <matteo@naufraghi.net>"] [lib] name = "iterated_function_systems" crate-type = ["cdylib"] Cargo.toml [dependencies] nalgebra = "0.11.2" rand = "0.3.15" cpython = "0.1" 29

38 CI up and running matrix: allow_failures: os: osx include: - language: generic os: osx python: 2.7 env: [tox] envlist = py27, py35 [testenv] commands = - RUST_VERSION=stable - language: python python: 2.7 env: - RUST_VERSION=stabledeps =... pytest python setup.py install pip install example/ py.test # Manually install python on osx before_install: - if [[ $TRAVIS_OS_NAME == 'osx' ]]; then ci/osx-install.sh; fi install: - curl -ssf sh -s -- -y --default-toolchain $RUST_VERSION - export PATH="$HOME/.cargo/bin:$PATH" - rustc -V script: - sudo pip install tox - tox 30

39 Take away Rust seems to be here to stay Rust is high level enough Integrating Rust in Python is easy We can write fast and safe Rust extensions! 31

40 Thanks! Questions? 32. 1

41 Other choices Cython C: CPython / ffi c++: SIP (PyQt) c++: pybind11 (modern boost::python) fortran: f2py Rust: CPython / ffi 32. 2

42 Resources

Rust: system programming with guarantees

Rust: system programming with guarantees Rust: system programming with guarantees CRI Monthly Seminar Arnaud Spiwack Pierre Guillou MINES ParisTech, PSL Research University Fontainebleau, July 6th, 2015 1 / 29 High level programming languages

More information

Introduction to Rust. CC-BY Mozilla. Jonathan Pallant

Introduction to Rust. CC-BY Mozilla. Jonathan Pallant Introduction to Rust CC-BY Mozilla Jonathan Pallant 27 October 2016 What is Rust? Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. www.rust-lang.org

More information

MY PYTHON IS RUSTING. A PYTHON AND RUST LOVE STORY Ronacher

MY PYTHON IS RUSTING. A PYTHON AND RUST LOVE STORY Ronacher MY PYTHON IS RUSTING A PYTHON AND RUST LOVE STORY Armin @mitsuhiko Ronacher and here is where you can find me twitter.com/@mitsuhiko github.com/mitsuhiko lucumr.pocoo.org/ so I heard you are doing Rust

More information

Why you should take a look at

Why you should take a look at Why you should take a look at Antonin Carette - FOSDEM 2018 - Rust devroom Slides and resources available @ github.com/k0pernicus/fosdem_rust_talk 1 Chalut 'tiot biloute! I tried to understand what the

More information

Introduction to Rust 2 / 101

Introduction to Rust 2 / 101 1 / 101 Introduction to Rust 2 / 101 Goal Have a good chance of being able to read and understand some Rust code. 3 / 101 Agenda 1. What's not that unique about Rust 2. What makes Rust somewhat unique

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Closures and Iterators In Rust CMSC330 Spring 2018 Copyright 2018 Michael Hicks, the University of Maryland. Some material based on https://doc.rustlang.org/book/second-edition/index.html

More information

Rust for C++ Programmers

Rust for C++ Programmers Rust for C++ Programmers Vinzent Steinberg C++ User Group, FIAS April 29, 2015 1 / 27 Motivation C++ has a lot of problems C++ cannot be fixed (because of backwards compatibility) Rust to the rescue! 2

More information

Let s Rust in Samba. Trying to use Samba with Rust libraries. Kai Blin Samba Team. SambaXP

Let s Rust in Samba. Trying to use Samba with Rust libraries. Kai Blin Samba Team. SambaXP Let s Rust in Samba Trying to use Samba with Rust libraries Kai Blin Samba Team SambaXP 2018 2017-06-06 Intro M.Sc. in Computational Biology Ph.D. in Microbiology Samba Team member 2/42 Overview Rust Intro

More information

The Rust Programming Language

The Rust Programming Language The Rust Programming Language The Rust Programming Language The Rust Project Developpers The Rust Programming Language, The Rust Project Developpers. Contents I Introduction 7 1 The Rust Programming Language

More information

Rust intro. (for Java Developers) JFokus #jfokus 1. 1

Rust intro. (for Java Developers) JFokus #jfokus 1. 1 Rust intro (for Java Developers) JFokus 2017 - #jfokus 1. 1 Hi! Computer Engineer Programming Electronics Math

More information

Programming In Rust. Jim Blandy, / Portland, (Slides are as presented; followup discussion,

Programming In Rust. Jim Blandy, / Portland, (Slides are as presented; followup discussion, Programming In Rust Jim Blandy, Mozilla @jimblandy / Portland, 2015 (Slides are as presented; followup discussion, fixes, etc. on Reddit: http://goo.gl/thj2pw) 2 The set of Rust enthusiasts certainly seems

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Structs and Enums in Rust CMSC330 Spring 2018 Copyright 2018 Niki Vazou, the University of Maryland. Some material based on https://doc.rustlang.org/book/second-edition/index.html

More information

$ cat ~/.profile GIT_AUTHOR_NAME=Florian Gilcher TWITTER_HANDLE=argorak GITHUB_HANDLE=skade BLOG=skade.

$ cat ~/.profile GIT_AUTHOR_NAME=Florian Gilcher TWITTER_HANDLE=argorak GITHUB_HANDLE=skade BLOG=skade. Useful Rust $ cat ~/.profile GIT_AUTHOR_NAME=Florian Gilcher GIT_AUTHOR_EMAIL=florian@rustfest.eu TWITTER_HANDLE=argorak GITHUB_HANDLE=skade BLOG=skade.me YAKS=yakshav.es Backend Developer Ruby Programmer

More information

RustPython. FOSDEM 2019 Brought to you by: Shing and Windel :P

RustPython. FOSDEM 2019 Brought to you by: Shing and Windel :P RustPython FOSDEM 2019 Brought to you by: Shing and Windel :P Outline - Who are we? - What is python? What is rust? What is the problem with C? - Overview of RustPython internals parser/compiler/vm/imports

More information

7. (2 pts) str( str( b ) ) str '4' will not compile (single, double, or triple quotes

7. (2 pts) str( str( b ) ) str '4' will not compile (single, double, or triple quotes For the following questions, use these variable definitions a = 45 b = 4 c = 39999 d = "7" What is the value and type of each of the following expressions or, if it won't compile, circle that answer type

More information

Oxidising GStreamer. Rust out your multimedia! GStreamer Conference October 2017, Prague. Sebastian 'slomo' Dröge < >

Oxidising GStreamer. Rust out your multimedia! GStreamer Conference October 2017, Prague. Sebastian 'slomo' Dröge < > Oxidising GStreamer Rust out your multimedia! GStreamer Conference 2017 22 October 2017, Prague Sebastian 'slomo' Dröge < > sebastian@centricular.com Introduction Who? What? + What is Rust? Type-safe,

More information

CMSC 330: Organization of Programming Languages. Ownership, References, and Lifetimes in Rust

CMSC 330: Organization of Programming Languages. Ownership, References, and Lifetimes in Rust CMSC 330: Organization of Programming Languages Ownership, References, and Lifetimes in Rust CMSC330 Spring 2018 1 Memory: the Stack and the Heap The stack constant-time, automatic (de)allocation Data

More information

Rust Advanced Topics

Rust Advanced Topics Rust Advanced Topics Adapted from https://skade.github.io/rust-three-dayscourse/presentation/toc/english.html Generic Functions 1. fn takes_anything(thing: T) -> T { 2. thing 3. } 4. fn main() { 5.

More information

PyPI to 0install Documentation

PyPI to 0install Documentation PyPI to 0install Documentation Release 0.1.0 Tim Diels Mar 14, 2017 Contents 1 User documentation 3 1.1 Installation................................................ 3 1.2 Running.................................................

More information

FROM SCRIPT TO PACKAGES. good practices for hassle-free code reuse

FROM SCRIPT TO PACKAGES. good practices for hassle-free code reuse FROM SCRIPT TO PACKAGES good practices for hassle-free code reuse WHAT S THIS TUTORIAL IS ABOUT How to make your code usable by someone else WHO AM I? Contributor to numpy/scipy since 2007 Windows, Mac

More information

Tokio: How we hit 88mph. Alex Crichton

Tokio: How we hit 88mph. Alex Crichton Tokio: How we hit 88mph Alex Crichton Tokio: How we hit 142km/h Alex Crichton Mio is low level Tokio Zero-cost futures trait Future Lightweight tasks A L E X S T O K I O RUST 2016 2018 MIO, FUTURES,

More information

CS1114 Spring 2015 Test ONE ANSWER KEY. page 1 of 8 pages (counting the cover sheet)

CS1114 Spring 2015 Test ONE ANSWER KEY. page 1 of 8 pages (counting the cover sheet) CS1114 Spring 2015 Test ONE ANSWER KEY page 1 of 8 pages (counting the cover sheet) For the following questions, use these variable definitions a = 36 b = 3 c = 12 d = '3' What is the type and value of

More information

python-packaging Documentation

python-packaging Documentation python-packaging Documentation Release 0.1 Scott Torborg Sep 20, 2017 Contents 1 Minimal Structure 3 2 Specifying Dependencies 7 3 Better Package Metadata 9 4 Let There Be Tests 13 5 Command Line Scripts

More information

Continuous Integration INRIA

Continuous Integration INRIA Vincent Rouvreau - https://sed.saclay.inria.fr February 28, 2017 Contents 1 Preamble In this exercice, you will learn how to install your Python program with packaging tools, test it, measure the tests

More information

1: /////////////// 2: // 1. Basics // 3: /////////////// 4: 5: // Functions. i32 is the type for 32-bit signed integers 6: fn add2(x: i32, y: i32) ->

1: /////////////// 2: // 1. Basics // 3: /////////////// 4: 5: // Functions. i32 is the type for 32-bit signed integers 6: fn add2(x: i32, y: i32) -> 1: /////////////// 2: // 1. Basics // 3: /////////////// 4: 5: // Functions. i32 is the type for 32-bit signed integers 6: fn add2(x: i32, y: i32) -> i32 { 7: // Implicit return (no semicolon) 8: x + y

More information

Rust. A new systems programming language. 1.0 was released on May 15th. been in development 5+ years. releases every 6 weeks

Rust. A new systems programming language. 1.0 was released on May 15th. been in development 5+ years. releases every 6 weeks 1 Rust A new systems programming language 1.0 was released on May 15th been in development 5+ years releases every 6 weeks Pursuing the trifecta: safe, concurrent, fast Gone through many radical iterations

More information

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup Purpose: The purpose of this lab is to setup software that you will be using throughout the term for learning about Python

More information

GNU Radio with a Rusty FPGA. Brennan Ashton

GNU Radio with a Rusty FPGA. Brennan Ashton GNU Radio with a Rusty FPGA Brennan Ashton 02.03.2019 Overview How feasible is it to write a GNU Radio block in Rust? What is involved in accelerating a block with an FPGA? Why Rust? Memory Management

More information

Archan. Release 2.0.1

Archan. Release 2.0.1 Archan Release 2.0.1 Jul 30, 2018 Contents 1 Archan 1 1.1 Features.................................................. 1 1.2 Installation................................................ 1 1.3 Documentation..............................................

More information

Django-CSP Documentation

Django-CSP Documentation Django-CSP Documentation Release 3.0 James Socol, Mozilla September 06, 2016 Contents 1 Installing django-csp 3 2 Configuring django-csp 5 2.1 Policy Settings..............................................

More information

LECTURE 20. Optimizing Python

LECTURE 20. Optimizing Python LECTURE 20 Optimizing Python THE NEED FOR SPEED By now, hopefully I ve shown that Python is an extremely versatile language that supports quick and easy development. However, a lot of the nice features

More information

The Case for Building a Kernel

The Case for Building a Kernel The Case for Building a Kernel in Rust Amit Levy Brad Campbell Branden Ghena Pat Pannuto Philip Levis Prabal Dutta Stanford University & University of Michigan September 2nd 2017 Memory and type safety

More information

Less known packaging features and tricks

Less known packaging features and tricks Less known packaging features and tricks Who Ionel Cristian Mărieș ionel is read like yonel, @ionelmc, blog.ionelmc.ro Did PyPI releases of 40 something distinct packages, since 2007 Working on a project

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Smart Pointers in Rust CMSC330 Spring 2018 Copyright 2018 Michael Hicks, the University of Maryland. Some material based on https://doc.rustlang.org/book/second-edition/index.html

More information

A Python for Future Generations. Ronacher

A Python for Future Generations. Ronacher A Python for Future Generations Armin @mitsuhiko Ronacher Hi, I'm Armin... and I do Open Source, lots of Python and SaaS Flask Sentry and here is where you can find me twitter.com/@mitsuhiko github.com/mitsuhiko

More information

Course May 18, Advanced Computational Physics. Course Hartmut Ruhl, LMU, Munich. People involved. SP in Python: 3 basic points

Course May 18, Advanced Computational Physics. Course Hartmut Ruhl, LMU, Munich. People involved. SP in Python: 3 basic points May 18, 2017 3 I/O 3 I/O 3 I/O 3 ASC, room A 238, phone 089-21804210, email hartmut.ruhl@lmu.de Patrick Böhl, ASC, room A205, phone 089-21804640, email patrick.boehl@physik.uni-muenchen.de. I/O Scientific

More information

TESTING IN RUST. A PRIMER IN TESTING AND FOSDEM 2018

TESTING IN RUST. A PRIMER IN TESTING AND FOSDEM 2018 TESTING IN RUST A PRIMER IN TESTING AND MOCKING @donald_whyte FOSDEM 2018 ABOUT ME So ware Engineer @ Engineers Gate Real-time trading systems Scalable data infrastructure Python/C++/Rust developer MOTIVATION

More information

Containers. Pablo F. Ordóñez. October 18, 2018

Containers. Pablo F. Ordóñez. October 18, 2018 Containers Pablo F. Ordóñez October 18, 2018 1 Welcome Song: Sola vaya Interpreter: La Sonora Ponceña 2 Goals Containers!= ( Moby-Dick ) Containers are part of the Linux Kernel Make your own container

More information

Mixed language programming

Mixed language programming Mixed language programming Simon Funke 1,2 Ola Skavhaug 3 Joakim Sundnes 1,2 Hans Petter Langtangen 1,2 Center for Biomedical Computing, Simula Research Laboratory 1 Dept. of Informatics, University of

More information

MY GOOD FRIEND RUST. Matthias Endler trivago

MY GOOD FRIEND RUST. Matthias Endler trivago MY GOOD FRIEND RUST Matthias Endler trivago How to write the word Mississippi? How to write the word Mississippi? Mississippi Sebastian is stupid. Oh please tell me more about Matthias Endler! } Düsseldorf,

More information

bottle-rest Release 0.5.0

bottle-rest Release 0.5.0 bottle-rest Release 0.5.0 February 18, 2017 Contents 1 API documentation 3 1.1 bottle_rest submodule.......................................... 3 2 What is it 5 2.1 REST in bottle..............................................

More information

Python for Non-programmers

Python for Non-programmers Python for Non-programmers A Gentle Introduction 1 Yann Tambouret Scientific Computing and Visualization Information Services & Technology Boston University 111 Cummington St. yannpaul@bu.edu Winter 2013

More information

COMP-520 GoLite Tutorial

COMP-520 GoLite Tutorial COMP-520 GoLite Tutorial Alexander Krolik Sable Lab McGill University Winter 2019 Plan Target languages Language constructs, emphasis on special cases General execution semantics Declarations Types Statements

More information

Rust. A safe, concurrent, practical language. Graydon Hoare October 2012

Rust. A safe, concurrent, practical language. Graydon Hoare October 2012 Rust A safe, concurrent, practical language Graydon Hoare October 2012 This is not a marketing talk Purpose: Convince you there's something interesting here Provide some technical

More information

CUSTOM CODE CHECKS. Anton Marchukov. PyCon Israel 2017

CUSTOM CODE CHECKS. Anton Marchukov. PyCon Israel 2017 Anton Marchukov PyCon Israel 2017 ABOUT ME @martchukov Senior Software Engineer at Red Hat. ovirt Community Infra team. CI and related infrastructure. Lots of automation in Python. DevOps advocate. ovirt

More information

withenv Documentation

withenv Documentation withenv Documentation Release 0.7.0 Eric Larson Aug 02, 2017 Contents 1 withenv 3 2 Installation 5 3 Usage 7 3.1 YAML Format.............................................. 7 3.2 Command Substitutions.........................................

More information

twosheds Documentation

twosheds Documentation twosheds Documentation Release 0.1.0 Ceasar Bautista August 14, 2015 Contents 1 Features 3 2 User Guide 5 2.1 Installation................................................ 5 2.2 Quickstart................................................

More information

Naked Documentation. Release Christopher Simpkins

Naked Documentation. Release Christopher Simpkins Naked Documentation Release 0.1.31 Christopher Simpkins Nov 04, 2017 Contents 1 A Python Command Line Application Framework 1 1.1 New Projects............................................... 1 1.2 Command

More information

Next Gen Networking Infrastructure With Rust

Next Gen Networking Infrastructure With Rust Next Gen Networking Infrastructure With Rust Hi, I m @carllerche You may remember me from Most newer databases are written in a language that includes a runtime C / C++ Memory management we ll do it live

More information

Getting along and working together. Fortran-Python Interoperability Jacob Wilkins

Getting along and working together. Fortran-Python Interoperability Jacob Wilkins Getting along and working together Fortran-Python Interoperability Jacob Wilkins Fortran AND Python working together? Fortran-Python May 2017 2/19 Two very different philosophies Two very different code-styles

More information

Summer 2016 Internship: Mapping with MetPy

Summer 2016 Internship: Mapping with MetPy Summer 2016 Internship: Mapping with MetPy Alex Haberlie 7/29/2016 MetPy refresher Collection of tools in Python for reading, visualizing and performing calculations with weather data. The space MetPy

More information

Python for Earth Scientists

Python for Earth Scientists Python for Earth Scientists Andrew Walker andrew.walker@bris.ac.uk Python is: A dynamic, interpreted programming language. Python is: A dynamic, interpreted programming language. Data Source code Object

More information

CS Programming Languages: Python

CS Programming Languages: Python CS 3101-1 - Programming Languages: Python Lecture 5: Exceptions / Daniel Bauer (bauer@cs.columbia.edu) October 08 2014 Daniel Bauer CS3101-1 Python - 05 - Exceptions / 1/35 Contents Exceptions Daniel Bauer

More information

cget Documentation Release Paul Fultz II

cget Documentation Release Paul Fultz II cget Documentation Release 0.1.0 Paul Fultz II Jun 27, 2018 Contents 1 Introduction 3 1.1 Installing cget.............................................. 3 1.2 Quickstart................................................

More information

Interfacing With Other Programming Languages Using Cython

Interfacing With Other Programming Languages Using Cython Lab 19 Interfacing With Other Programming Languages Using Cython Lab Objective: Learn to interface with object files using Cython. This lab should be worked through on a machine that has already been configured

More information

Sage Reference Manual: Python technicalities

Sage Reference Manual: Python technicalities Sage Reference Manual: Python technicalities Release 8.1 The Sage Development Team Dec 09, 2017 CONTENTS 1 Various functions to debug Python internals 3 2 Variants of getattr() 5 3 Metaclasses for Cython

More information

Speeding up Python. Antonio Gómez-Iglesias April 17th, 2015

Speeding up Python. Antonio Gómez-Iglesias April 17th, 2015 Speeding up Python Antonio Gómez-Iglesias agomez@tacc.utexas.edu April 17th, 2015 Why Python is nice, easy, development is fast However, Python is slow The bottlenecks can be rewritten: SWIG Boost.Python

More information

A shell can be used in one of two ways:

A shell can be used in one of two ways: Shell Scripting 1 A shell can be used in one of two ways: A command interpreter, used interactively A programming language, to write shell scripts (your own custom commands) 2 If we have a set of commands

More information

Building and Installing Software

Building and Installing Software Building and Installing Software On UD HPC Community Clusters William Totten Network & Systems Services Conventions when Installing Software Installation base directory /opt/shared /home/work/ lab/sw/name/version

More information

Python Packaging. Jakub Wasielak

Python Packaging. Jakub Wasielak Python Packaging Jakub Wasielak http://blog.pykonik.org/ http://koderek.edu.pl/ facebook.com/startechkrk https://pl.pycon.org/2017/ What? Why? Architecture https://packaging.python.org/current/ Installation

More information

CMSC 330: Organization of Programming Languages. Rust Basics

CMSC 330: Organization of Programming Languages. Rust Basics CMSC 330: Organization of Programming Languages Rust Basics CMSC330 Spring 2018 1 Organization It turns out that a lot of Rust has direct analogues in OCaml So we will introduce its elements with comparisons

More information

streamio Documentation

streamio Documentation streamio Documentation Release 0.1.0.dev James Mills April 17, 2014 Contents 1 About 3 1.1 Examples................................................. 3 1.2 Requirements...............................................

More information

Introduction to Scientific Python, CME 193 Jan. 9, web.stanford.edu/~ermartin/teaching/cme193-winter15

Introduction to Scientific Python, CME 193 Jan. 9, web.stanford.edu/~ermartin/teaching/cme193-winter15 1 LECTURE 1: INTRO Introduction to Scientific Python, CME 193 Jan. 9, 2014 web.stanford.edu/~ermartin/teaching/cme193-winter15 Eileen Martin Some slides are from Sven Schmit s Fall 14 slides 2 Course Details

More information

Python Development Workflow

Python Development Workflow Python Development Workflow Best Practice to create / test / versioning / automate and more Marcelo Mello mmello@redhat.com / tchello.mello@gmail.com Pablo Hess phess@redhat.com / pablonhess@gmail.com

More information

Object Model Comparisons

Object Model Comparisons Object Model Comparisons 1 Languages are designed, just like programs Someone decides what the language is for Someone decides what features it's going to have Can't really understand a language until

More information

Exceptions in Python. AMath 483/583 Lecture 27 May 27, Exceptions in Python. Exceptions in Python

Exceptions in Python. AMath 483/583 Lecture 27 May 27, Exceptions in Python. Exceptions in Python AMath 483/583 Lecture 27 May 27, 2011 Today: Python exception handling Python plus Fortran: f2py Next week: More Python plus Fortran Visualization Parallel IPython Read: Class notes and references If you

More information

PyBuilder Documentation

PyBuilder Documentation PyBuilder Documentation Release 0.10 PyBuilder Team Jun 21, 2018 Contents 1 Installation 1 1.1 Virtual Environment........................................... 1 1.2 Installing completions..........................................

More information

Introduction to computers and Python. Matthieu Choplin

Introduction to computers and Python. Matthieu Choplin Introduction to computers and Python Matthieu Choplin matthieu.choplin@city.ac.uk http://moodle.city.ac.uk/ 1 Objectives To get a brief overview of what Python is To understand computer basics and programs

More information

DNS Zone Test Documentation

DNS Zone Test Documentation DNS Zone Test Documentation Release 1.1.3 Maarten Diemel Dec 02, 2017 Contents 1 DNS Zone Test 3 1.1 Features.................................................. 3 1.2 Credits..................................................

More information

The Rust Way of OS Development. Philipp Oppermann

The Rust Way of OS Development. Philipp Oppermann The Rust Way of OS Development Philipp Oppermann May 30, 2018 HTWG Konstanz About Me Computer science student at KIT (Karlsruhe) Writing an OS in Rust blog series (os.phil-opp.com) Embedded Rust development

More information

Argparse Tutorial Release 2.7.9

Argparse Tutorial Release 2.7.9 Argparse Tutorial Release 2.7.9 Guido van Rossum and the Python development team December 10, 2014 Python Software Foundation Email: docs@python.org Contents 1 Concepts 1 2 The basics 2 3 Introducing Positional

More information

CMSC 330: Organization of Programming Languages. Strings, Slices, Vectors, HashMaps in Rust

CMSC 330: Organization of Programming Languages. Strings, Slices, Vectors, HashMaps in Rust CMSC 330: Organization of Programming Languages Strings, Slices, Vectors, HashMaps in Rust CMSC330 Spring 2018 1 String Representation Rust s String is a 3-tuple A pointer to a byte array (interpreted

More information

C2Rust Migrating Legacy Code to Rust

C2Rust Migrating Legacy Code to Rust C2Rust Migrating Legacy Code to Rust Acknowledgements & Disclaimer This research was developed with funding from the Defense Advanced Research Projects Agency (DARPA). The views, opinions and/or findings

More information

Idiomatic Rust. Writing concise and elegant Rust code

Idiomatic Rust. Writing concise and elegant Rust code Idiomatic Rust Writing concise and elegant Rust code Matthias Endler! Düsseldorf, Germany! Backend Engineer at! Website performance! Hot Chocolate matthiasendler mre matthias-endler.de EXPECTATION... REALITY...

More information

Python Project Documentation

Python Project Documentation Python Project Documentation Release 1.0 Tim Diels Jan 10, 2018 Contents 1 Simple project structure 3 1.1 Code repository usage.......................................... 3 1.2 Versioning................................................

More information

Catbook Workshop: Intro to NodeJS. Monde Duinkharjav

Catbook Workshop: Intro to NodeJS. Monde Duinkharjav Catbook Workshop: Intro to NodeJS Monde Duinkharjav What is NodeJS? NodeJS is... A Javascript RUNTIME ENGINE NOT a framework NOT Javascript nor a JS package It is a method for running your code in Javascript.

More information

Advances in Programming Languages

Advances in Programming Languages Advances in Programming Languages Lecture 18: Concurrency and More in Rust Ian Stark School of Informatics The University of Edinburgh Friday 24 November 2016 Semester 1 Week 10 https://blog.inf.ed.ac.uk/apl16

More information

Python for C programmers

Python for C programmers Python for C programmers The basics of Python are fairly simple to learn, if you already know how another structured language (like C) works. So we will walk through these basics here. This is only intended

More information

CIS192 Python Programming

CIS192 Python Programming CIS192 Python Programming Graphical User Interfaces Robert Rand University of Pennsylvania December 03, 2015 Robert Rand (University of Pennsylvania) CIS 192 December 03, 2015 1 / 21 Outline 1 Performance

More information

Not-So-Mini-Lecture 6. Modules & Scripts

Not-So-Mini-Lecture 6. Modules & Scripts Not-So-Mini-Lecture 6 Modules & Scripts Interactive Shell vs. Modules Launch in command line Type each line separately Python executes as you type Write in a code editor We use Atom Editor But anything

More information

Multimedia-Programmierung Übung 7

Multimedia-Programmierung Übung 7 Multimedia-Programmierung Übung 7 Ludwig-Maximilians-Universität München Sommersemester 2009 Ludwig-Maximilians-Universität München Multimedia-Programmierung 7-1 Today Introduction to No more Python :ʼ-(

More information

COMP519 Web Programming Lecture 21: Python (Part 5) Handouts

COMP519 Web Programming Lecture 21: Python (Part 5) Handouts COMP519 Web Programming Lecture 21: Python (Part 5) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool Functions

More information

CSE : Python Programming. Decorators. Announcements. The decorator pattern. The decorator pattern. The decorator pattern

CSE : Python Programming. Decorators. Announcements. The decorator pattern. The decorator pattern. The decorator pattern CSE 399-004: Python Programming Lecture 12: Decorators April 9, 200 http://www.seas.upenn.edu/~cse39904/ Announcements Projects (code and documentation) are due: April 20, 200 at pm There will be informal

More information

Scripting With Jython

Scripting With Jython Scripting With Jython In this chapter, we will look at scripting with Jython. For our purposes, we will define scripting as the writing of small programs to help out with daily tasks. These tasks are things

More information

diceware Documentation

diceware Documentation diceware Documentation Release 0.1 Uli Fouquet March 28, 2015 Contents 1 Install 3 2 Usage 5 3 What is it good for? 7 4 Is it secure? 9 5 Developer Install 11 5.1 Documentation Install..........................................

More information

Introduction to Scientific Computing with Python, part two.

Introduction to Scientific Computing with Python, part two. Introduction to Scientific Computing with Python, part two. M. Emmett Department of Mathematics University of North Carolina at Chapel Hill June 20 2012 The Zen of Python zen of python... fire up python

More information

pysharedutils Documentation

pysharedutils Documentation pysharedutils Documentation Release 0.5.0 Joel James August 07, 2017 Contents 1 pysharedutils 1 2 Indices and tables 13 i ii CHAPTER 1 pysharedutils pysharedutils is a convenient utility module which

More information

PYTHON. Varun Jain & Senior Software Engineer. Pratap, Mysore Narasimha Raju & TEST AUTOMATION ARCHITECT. CenturyLink Technologies India PVT LTD

PYTHON. Varun Jain & Senior Software Engineer. Pratap, Mysore Narasimha Raju & TEST AUTOMATION ARCHITECT. CenturyLink Technologies India PVT LTD PYTHON Varun Jain & Senior Software Engineer Pratap, Mysore Narasimha Raju & TEST AUTOMATION ARCHITECT CenturyLink Technologies India PVT LTD 1 About Python Python is a general-purpose interpreted, interactive,

More information

Shell Scripting. Todd Kelley CST8207 Todd Kelley 1

Shell Scripting. Todd Kelley CST8207 Todd Kelley 1 Shell Scripting Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 If we have a set of commands that we want to run on a regular basis, we could write a script A script acts as a Linux command,

More information

1. BASICS OF PYTHON. JHU Physics & Astronomy Python Workshop Lecturer: Mubdi Rahman

1. BASICS OF PYTHON. JHU Physics & Astronomy Python Workshop Lecturer: Mubdi Rahman 1. BASICS OF PYTHON JHU Physics & Astronomy Python Workshop 2017 Lecturer: Mubdi Rahman HOW IS THIS WORKSHOP GOING TO WORK? We will be going over all the basics you need to get started and get productive

More information

swiftenv Documentation

swiftenv Documentation swiftenv Documentation Release 1.3.0 Kyle Fuller Sep 27, 2017 Contents 1 The User Guide 3 1.1 Installation................................................ 3 1.2 Getting Started..............................................

More information

Tizen TCT User Guide

Tizen TCT User Guide Tizen 2.3.1 TCT User Guide Table of Contents 1. Environment setup... 3 1.1. Symbols and abbreviations... 3 1.2. Hardware Requirements... 3 1.3. Software Requirements... 3 2. Getting TCT-source and TCT-manager...

More information

Alastair Burt Andreas Eisele Christian Federmann Torsten Marek Ulrich Schäfer. October 6th, Universität des Saarlandes. Introduction to Python

Alastair Burt Andreas Eisele Christian Federmann Torsten Marek Ulrich Schäfer. October 6th, Universität des Saarlandes. Introduction to Python Outline Alastair Burt Andreas Eisele Christian Federmann Torsten Marek Ulrich Schäfer Universität des Saarlandes October 6th, 2009 Outline Outline Today s Topics: 1 More Examples 2 Cool Stuff 3 Text Processing

More information

Overview of the UNIX File System

Overview of the UNIX File System Overview of the UNIX File System Navigating and Viewing Directories Adapted from Practical Unix and Programming Hunter College Copyright 2006 Stewart Weiss The UNIX file system The most distinguishing

More information

61A Lecture 3. Friday, September 5

61A Lecture 3. Friday, September 5 61A Lecture 3 Friday, September 5 Announcements There's plenty of room in live lecture if you want to come (but videos are still better) Please don't make noise outside of the previous lecture! Homework

More information

Teaching Python: The Hard Parts. Elana Hashman Rackspace PyCon 2016 Portland, OR

Teaching Python: The Hard Parts. Elana Hashman Rackspace PyCon 2016 Portland, OR Teaching Python: The Hard Parts Elana Hashman Rackspace PyCon 2016 Portland, OR Background Community Data Science Workshops Python Workshops for Beginners Total Beginners Platform Diversity Majority of

More information

Instructions for using the CSU Baseline Algorithms

Instructions for using the CSU Baseline Algorithms Instructions for using the CSU Baseline Algorithms David Bolme and Ross Beveridge Computer Science Department Colorado State University http://www.cs.colostate.edu/facerec Last Update - June 14, 2012 Overview

More information

tld Documentation Release 0.9 Artur Barseghyan

tld Documentation Release 0.9 Artur Barseghyan tld Documentation Release 0.9 Artur Barseghyan Jun 13, 2018 Contents 1 Prerequisites 3 2 Documentation 5 3 Installation 7 4 Usage examples 9 5 Update the list of TLD names

More information

PTN-202: Advanced Python Programming Course Description. Course Outline

PTN-202: Advanced Python Programming Course Description. Course Outline PTN-202: Advanced Python Programming Course Description This 4-day course picks up where Python I leaves off, covering some topics in more detail, and adding many new ones, with a focus on enterprise development.

More information

Modularization. Functions and Modules. Functions. Functions how to define

Modularization. Functions and Modules. Functions. Functions how to define Modularization Functions and Modules MBV-INFx410 Fall 2015 Programs can get big Risk of doing the same thing many times Functions and modules encourage - re-usability - readability - helps with maintenance

More information