SlideShare a Scribd company logo
1 of 23
Download to read offline
Building open source
with Django
Ed Crewe
#dbbug
Django Bath and Bristol Users Group
https://www.djangoproject.com/
Ed Crewe * - DBBUG
Python and Django developer.
Representing Django Bristol and Bath User
Group.
Django is a leading web framework, in Python,
used by the likes of Mozilla, Instagram and
OpenStack.
It is the framework bundled with Google App
Engine - whose team is lead by the inventor of
Python, Guido Van Rossum.
Introduction
* Developer at the University of Bristol (& amateur painter - see slide pics!)
- I used to work at UWE before that!
Python is a high level programming language, it
inherits many of the same principles set out by
the first programming language explicitly
designed to be object orientated,
Smalltalk (1970)
Python was invented at the end of the 1980s
and a number of its concepts were shared by
Java when it came along a few years later. The
main difference being Java's static typing and
verbose syntax, rather than Python's /
Smalltalk's strong dynamic typing.
The core areas of Python use are scientific /
numerical analysis (replacing Fortran),
educational tools (Raspberry Pi etc.), config
management, and of course web software.
What is python?
The Zen of Python
The key ethos of Python is quite well adhered to
by the creators of Django.
Simple, explicit, DRY (inheritance), less code, RAD, loose coupling tight cohesion.
Python lets you do what you want - procedural or OOP, multiple inheritance or
interfaces, pre-compiled or meta / interactive programming ... so unusually diverse
in methodology terms, but it has very strict rules of convention - break them and
you advertise your failings - but those failings will still compile.
There should ideally only be one syntactic way any line of code is written, and that
way is the simplest and most readable way - see the PEPs (Python Enhancement
Proposals). However a core principle of Python coding is also
'It is easier to ask forgiveness, than permission' coined by Grace Hopper
Hence exception handling for program flow is OK, programming methodologies or
typing should not be enforced - so you can go do what you want, as long as you
write for readability, then ask forgiveness ... if it doesn't pass PEP lint tests!
Django was created around the same time as Ruby on the Rails and open sourced
a few months afterwards in 2005.
Like Rails it is MVC based and one of the top ten most popular web frameworks,
alongside ASP MVC, CakePHP, Spring, Flask etc.
Its a medium complexity orientated framework, sitting between Spring and the
micro-frameworks (eg. Flask) on the scale of large development vs. productivity.
So for systems that require less than 10 full time developers - but are more than a
few weeks work for one.
Like most significant open source projects it has a non-profit foundation to promote
it and protect its licences.
Probably the most well known example is the Apache foundation* - which looks
after many smaller open source projects, particularly Java based ones, perhaps
because due to its commercial heritage Java doesn't have its own language
foundation like Python, Perl etc.
What is django?
* Colleague Damian Steer in Bristol Uni ITS R&D is a member
Started by Dan Fairs in 2008 ~ 100 members.
Mainly developers with a scattering of project
managers.
The Django Bath and Bristol Users Group is a place for
local developers and companies to come and talk
Django, Python, and web development in general.
We run events every couple of months, with a mix of
socials and technical meets.
#dbbug Django Bath and Bristol Users Group
Membership is a mix of freelancers and company members, eg. from
The House of Omni, ISM Games, Potato, SecondSync, Digital TV labs,
Maplecroft, Joinerysoft, Netsight, Bravo6 etc.
plus the odd public sector bod like me from the University of Bristol and
Cardiff University
#dbbug What do we do?
So it may be lightning talks or
more a more in depth talks
from a member.
We tend to
alternate, talk
sessions with
socials.
Even at the talk sessions there will
usually be some social lubrication
such as beer and pizza - hopefully
paid for by a recruitment company!
We have also done a django dash (a competitive
sprint), and a group outing to Djangocon.eu, a
couple of years ago when it was in Amsterdam.
https://groups.google.com/forum/?fromgroups=#!forum/dbug
Please come along to our next meet.
Not that we have a date for it yet, but just
email the list at Google group search for dbbug
... if you email and ask to meet, it will prompt
somebody to suggest a date for the next one -
so you can be the inspiration for that gathering!
You don't have to be a developer or a Python user
already, but it helps if you aim to be one.
List is mainly for group events
(sometimes gets job offers and newbie questions too)
#dbbug Come and join us
(...you don't have to be an evangelist)
Django is being used at the University to provide an integration framework
for web applications that need to appear on our public web.
So this integrates with our institutional CMS driven content and central
data sources (e.g. http://www.bris.ac.uk/ilrt/people)
We are also using it to rewrite our national survey system BOS (like survey
monkey for academic and cross institutional provision)
Django use at Bristol University
Background
- the survey application
1. Daily scrum to report progress and decide current
work units
2. Sprints of 3-4 weeks duration
3. Back log to handle sprint over spill
4. Product owner to help lead overall work
prioritisation
5. Continuous Integration - nightly builds for various
test suites
6. Maybe not full TDD but good test coverage
7. Continuous refactor effort
Agile practises
B.C.S. SCRUM talk by Nigel Baker - Agile Bear
Splitting a large development project into packages
Caters for separate tests, documentation, release
management and development cycles.
Encourages increase in modularisation and encapsulation -
helps to decouple the code. (Macro level OOP!)
Adding generic functionality - separate package can be used
across projects.
Aim for it to be entirely generic then it can be released - this
then opens it up to being freely tested and improved and / or
influence other components of an open framework
Packaging functional components
In python (and hence django) packages are called eggs.
There is a central repository of all open source eggs called
PyPI (the cheese shop), like CPAN. https://pypi.python.org
PyPI is built into the core language packaging features. Create a
folder add a few files including setup.py, to make it an egg, and
run python setup.py register to push it to PyPI.
A user of your code then just has to download and run python
setup or use the pip add on and run pip install package-name to
add it to their django based site.
Python packages
https://pypi.python.org/pypi/django-cookieless
Django requires cookies to maintain session, and hence for authorisation.
However there are cases when forms are used on public sites, where setting cookies
is not desirable (due to privacy legislation), since technically they are not required for
anonymous users to respond to forms. So if used, strictly consent is needed from the
user to set them.
This package is designed to cater for anonymous user session maintenance, without
cookies.
It provides a sessions implementation and decorator class for views to allow for forms
to maintain state without using cookies by posting the encrypted session id between
forms, or via urls. This also enables a user to run multiple sessions across different
browser tabs.
e.g. django-cookieless
Open source ethos
Python ethos = OS ethos - code should be
readable, openly accessible, reusable and
adaptable by everyone.
So open source should be well documented and
maintained with test suites, release management.
To deliver these goals.
Note that the majority of commercial software is
also now, at least partially, open source.
Sharing code
To start sharing code, just reply to somebody with some.
Maybe on a platform email list or stack overflow or the like.
If its a longer snippet you may want to use your platform's
favourite paste bin site, eg. http://dpaste.com to share it.
If you think its of general use why not make it more
permanently public, for django that means
http://djangosnippets.org/
If its more than a snippet then it should be in a versioning
system, so why not pick a public one ...
Like Facebook, but with a purpose!
Community coding
Site Pros Cons
github.com market leader only does git
bitbucket.com
(Atlassian)
git or mercurial *
free private repos
Its written in django :-)
has been accused of
plaigarising github
code.google.com git, mercurial or
svn (for the old folks)
poorly featured,
few signs of new releases
gitorious.org like github but open
source infrastructure
only does git
bit flakey and smaller scale
sourceforge.net the original ... ... and worst.
graveyard of old projects
* Mercurial is the Python twin of Git (written in C), separated at birth!
1. Reply to help lists - stack overflow or python and django specific
2. Reply to project support chat rooms
3. Reporting bugs
4. Fixing bugs
5. Adding new features to existing packages
6. Contributing enough to warrant a new release
7. Coagulating snippets, paste bins, stack overflows into an egg
8. Creating and releasing your own package
9. Acting as a release manager
10. Becoming a core contributor of a large project
11. Starting your own large project / framework / language
(Warning 11 is not for people who have a life outside coding)
The open road
Creative co-operation
Githubs fun visualisation of contributors to one of my eggs .... hmm need to catch
up merging those forks, or I will lose release manager / origin status for it ...
Don't be afraid to commit
Contributing to Django core, or other Python projects
(Boosting you half way along the open road!)
A workshop next week, 8th June, by fellow DBBUG member, Daniele Procida
http://www.cardiffdevworkshop.com (Details - room 3 - 1:50pm)
See https://dont-be-afraid-to-commit.readthedocs.org/ for more information.
The workshop will take participants through the complete cycle of
identifying a simple issue in a Django or Python project, writing a patch
with tests and documentation, and submitting it.
The workshop is aimed at the first-time committer. Very little experience
is required: https://dont-be-afraid-to-commit.readthedocs.
org/en/latest/prerequisites.html
Interested in Django ...
home https://www.djangoproject.com/
dbbug https://groups.google.com/forum/?fromgroups=#!forum/dbug
free book http://www.djangobook.com/en/2.0/index.html
90 other books http://www.amazon.co.uk/s/ref=nb_sb_noss_1?url=search-alias&field-
keywords=django+python
chat #django
IRC
https://code.djangoproject.com/wiki/IrcFAQ
help https://groups.google.com/forum/?fromgroups#!forum/django-users
core devs https://groups.google.com/forum/?fromgroups#!forum/django-developers
other dbbugs http://www.djangonauts.org/
jobs http://djangogigs.com/ and http://www.djangojobs.org/
add ons https://www.djangopackages.com/
Ed Crewe
https://groups.google.com/forum/?fromgroups=#!forum/dbug
#dbbug
django bath and bristol user group
university of bristol - ITS - R&D
http://www.bris.ac.uk/ilrt
ed.crewe@bristol.ac.uk
Contact
PS: Also a member of SW Big Data
http://www.meetup.com
/south-west-big-data/

More Related Content

Viewers also liked

урок по вулканам исправлен
урок по вулканам исправленурок по вулканам исправлен
урок по вулканам исправленMarinaOstraeva
 
La web 2.0 resumen
La web 2.0 resumenLa web 2.0 resumen
La web 2.0 resumenNino Castro
 
Colliers Advantage brochure
Colliers Advantage brochureColliers Advantage brochure
Colliers Advantage brochureAmber Terriaco
 
Offers For All
Offers For AllOffers For All
Offers For AllKamal Jat
 
Colliers advantage brochure
Colliers advantage brochureColliers advantage brochure
Colliers advantage brochureAmber Terriaco
 
NeuroRescescue EU Cluster of Excellence on Neuroscience
NeuroRescescue EU Cluster of Excellence on NeuroscienceNeuroRescescue EU Cluster of Excellence on Neuroscience
NeuroRescescue EU Cluster of Excellence on NeurosciencePARC DE SALUT
 

Viewers also liked (8)

Pancasila
PancasilaPancasila
Pancasila
 
урок по вулканам исправлен
урок по вулканам исправленурок по вулканам исправлен
урок по вулканам исправлен
 
La web 2.0 resumen
La web 2.0 resumenLa web 2.0 resumen
La web 2.0 resumen
 
Colliers Advantage brochure
Colliers Advantage brochureColliers Advantage brochure
Colliers Advantage brochure
 
Offers For All
Offers For AllOffers For All
Offers For All
 
Colliers advantage brochure
Colliers advantage brochureColliers advantage brochure
Colliers advantage brochure
 
NeuroRescescue EU Cluster of Excellence on Neuroscience
NeuroRescescue EU Cluster of Excellence on NeuroscienceNeuroRescescue EU Cluster of Excellence on Neuroscience
NeuroRescescue EU Cluster of Excellence on Neuroscience
 
Hair loss
Hair lossHair loss
Hair loss
 

More from IT MegaMeet

Coding in community
Coding in communityCoding in community
Coding in communityIT MegaMeet
 
Get it into your genes - The EnsEMBL Project
Get it into your genes - The EnsEMBL ProjectGet it into your genes - The EnsEMBL Project
Get it into your genes - The EnsEMBL ProjectIT MegaMeet
 
The LCH Grid - High Performance Computing in High Energy Particle Physics
The LCH Grid - High Performance Computing in High Energy Particle PhysicsThe LCH Grid - High Performance Computing in High Energy Particle Physics
The LCH Grid - High Performance Computing in High Energy Particle PhysicsIT MegaMeet
 
Coding masterclasses for schools
Coding masterclasses for schoolsCoding masterclasses for schools
Coding masterclasses for schoolsIT MegaMeet
 
Embracing Continuous Integration
Embracing Continuous IntegrationEmbracing Continuous Integration
Embracing Continuous IntegrationIT MegaMeet
 
Scrum - a deceptively simple process
Scrum - a deceptively simple processScrum - a deceptively simple process
Scrum - a deceptively simple processIT MegaMeet
 
The Inner Secrets of Compilers
The Inner Secrets of CompilersThe Inner Secrets of Compilers
The Inner Secrets of CompilersIT MegaMeet
 

More from IT MegaMeet (7)

Coding in community
Coding in communityCoding in community
Coding in community
 
Get it into your genes - The EnsEMBL Project
Get it into your genes - The EnsEMBL ProjectGet it into your genes - The EnsEMBL Project
Get it into your genes - The EnsEMBL Project
 
The LCH Grid - High Performance Computing in High Energy Particle Physics
The LCH Grid - High Performance Computing in High Energy Particle PhysicsThe LCH Grid - High Performance Computing in High Energy Particle Physics
The LCH Grid - High Performance Computing in High Energy Particle Physics
 
Coding masterclasses for schools
Coding masterclasses for schoolsCoding masterclasses for schools
Coding masterclasses for schools
 
Embracing Continuous Integration
Embracing Continuous IntegrationEmbracing Continuous Integration
Embracing Continuous Integration
 
Scrum - a deceptively simple process
Scrum - a deceptively simple processScrum - a deceptively simple process
Scrum - a deceptively simple process
 
The Inner Secrets of Compilers
The Inner Secrets of CompilersThe Inner Secrets of Compilers
The Inner Secrets of Compilers
 

Recently uploaded

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 

Recently uploaded (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 

Building open source with django

  • 1. Building open source with Django Ed Crewe #dbbug Django Bath and Bristol Users Group https://www.djangoproject.com/
  • 2. Ed Crewe * - DBBUG Python and Django developer. Representing Django Bristol and Bath User Group. Django is a leading web framework, in Python, used by the likes of Mozilla, Instagram and OpenStack. It is the framework bundled with Google App Engine - whose team is lead by the inventor of Python, Guido Van Rossum. Introduction * Developer at the University of Bristol (& amateur painter - see slide pics!) - I used to work at UWE before that!
  • 3. Python is a high level programming language, it inherits many of the same principles set out by the first programming language explicitly designed to be object orientated, Smalltalk (1970) Python was invented at the end of the 1980s and a number of its concepts were shared by Java when it came along a few years later. The main difference being Java's static typing and verbose syntax, rather than Python's / Smalltalk's strong dynamic typing. The core areas of Python use are scientific / numerical analysis (replacing Fortran), educational tools (Raspberry Pi etc.), config management, and of course web software. What is python?
  • 4. The Zen of Python The key ethos of Python is quite well adhered to by the creators of Django. Simple, explicit, DRY (inheritance), less code, RAD, loose coupling tight cohesion. Python lets you do what you want - procedural or OOP, multiple inheritance or interfaces, pre-compiled or meta / interactive programming ... so unusually diverse in methodology terms, but it has very strict rules of convention - break them and you advertise your failings - but those failings will still compile. There should ideally only be one syntactic way any line of code is written, and that way is the simplest and most readable way - see the PEPs (Python Enhancement Proposals). However a core principle of Python coding is also 'It is easier to ask forgiveness, than permission' coined by Grace Hopper Hence exception handling for program flow is OK, programming methodologies or typing should not be enforced - so you can go do what you want, as long as you write for readability, then ask forgiveness ... if it doesn't pass PEP lint tests!
  • 5. Django was created around the same time as Ruby on the Rails and open sourced a few months afterwards in 2005. Like Rails it is MVC based and one of the top ten most popular web frameworks, alongside ASP MVC, CakePHP, Spring, Flask etc. Its a medium complexity orientated framework, sitting between Spring and the micro-frameworks (eg. Flask) on the scale of large development vs. productivity. So for systems that require less than 10 full time developers - but are more than a few weeks work for one. Like most significant open source projects it has a non-profit foundation to promote it and protect its licences. Probably the most well known example is the Apache foundation* - which looks after many smaller open source projects, particularly Java based ones, perhaps because due to its commercial heritage Java doesn't have its own language foundation like Python, Perl etc. What is django? * Colleague Damian Steer in Bristol Uni ITS R&D is a member
  • 6. Started by Dan Fairs in 2008 ~ 100 members. Mainly developers with a scattering of project managers. The Django Bath and Bristol Users Group is a place for local developers and companies to come and talk Django, Python, and web development in general. We run events every couple of months, with a mix of socials and technical meets. #dbbug Django Bath and Bristol Users Group Membership is a mix of freelancers and company members, eg. from The House of Omni, ISM Games, Potato, SecondSync, Digital TV labs, Maplecroft, Joinerysoft, Netsight, Bravo6 etc. plus the odd public sector bod like me from the University of Bristol and Cardiff University
  • 7. #dbbug What do we do? So it may be lightning talks or more a more in depth talks from a member. We tend to alternate, talk sessions with socials. Even at the talk sessions there will usually be some social lubrication such as beer and pizza - hopefully paid for by a recruitment company! We have also done a django dash (a competitive sprint), and a group outing to Djangocon.eu, a couple of years ago when it was in Amsterdam.
  • 8. https://groups.google.com/forum/?fromgroups=#!forum/dbug Please come along to our next meet. Not that we have a date for it yet, but just email the list at Google group search for dbbug ... if you email and ask to meet, it will prompt somebody to suggest a date for the next one - so you can be the inspiration for that gathering! You don't have to be a developer or a Python user already, but it helps if you aim to be one. List is mainly for group events (sometimes gets job offers and newbie questions too) #dbbug Come and join us (...you don't have to be an evangelist)
  • 9. Django is being used at the University to provide an integration framework for web applications that need to appear on our public web. So this integrates with our institutional CMS driven content and central data sources (e.g. http://www.bris.ac.uk/ilrt/people) We are also using it to rewrite our national survey system BOS (like survey monkey for academic and cross institutional provision) Django use at Bristol University
  • 10. Background - the survey application
  • 11.
  • 12. 1. Daily scrum to report progress and decide current work units 2. Sprints of 3-4 weeks duration 3. Back log to handle sprint over spill 4. Product owner to help lead overall work prioritisation 5. Continuous Integration - nightly builds for various test suites 6. Maybe not full TDD but good test coverage 7. Continuous refactor effort Agile practises B.C.S. SCRUM talk by Nigel Baker - Agile Bear
  • 13. Splitting a large development project into packages Caters for separate tests, documentation, release management and development cycles. Encourages increase in modularisation and encapsulation - helps to decouple the code. (Macro level OOP!) Adding generic functionality - separate package can be used across projects. Aim for it to be entirely generic then it can be released - this then opens it up to being freely tested and improved and / or influence other components of an open framework Packaging functional components
  • 14. In python (and hence django) packages are called eggs. There is a central repository of all open source eggs called PyPI (the cheese shop), like CPAN. https://pypi.python.org PyPI is built into the core language packaging features. Create a folder add a few files including setup.py, to make it an egg, and run python setup.py register to push it to PyPI. A user of your code then just has to download and run python setup or use the pip add on and run pip install package-name to add it to their django based site. Python packages
  • 15. https://pypi.python.org/pypi/django-cookieless Django requires cookies to maintain session, and hence for authorisation. However there are cases when forms are used on public sites, where setting cookies is not desirable (due to privacy legislation), since technically they are not required for anonymous users to respond to forms. So if used, strictly consent is needed from the user to set them. This package is designed to cater for anonymous user session maintenance, without cookies. It provides a sessions implementation and decorator class for views to allow for forms to maintain state without using cookies by posting the encrypted session id between forms, or via urls. This also enables a user to run multiple sessions across different browser tabs. e.g. django-cookieless
  • 16. Open source ethos Python ethos = OS ethos - code should be readable, openly accessible, reusable and adaptable by everyone. So open source should be well documented and maintained with test suites, release management. To deliver these goals. Note that the majority of commercial software is also now, at least partially, open source.
  • 17. Sharing code To start sharing code, just reply to somebody with some. Maybe on a platform email list or stack overflow or the like. If its a longer snippet you may want to use your platform's favourite paste bin site, eg. http://dpaste.com to share it. If you think its of general use why not make it more permanently public, for django that means http://djangosnippets.org/ If its more than a snippet then it should be in a versioning system, so why not pick a public one ...
  • 18. Like Facebook, but with a purpose! Community coding Site Pros Cons github.com market leader only does git bitbucket.com (Atlassian) git or mercurial * free private repos Its written in django :-) has been accused of plaigarising github code.google.com git, mercurial or svn (for the old folks) poorly featured, few signs of new releases gitorious.org like github but open source infrastructure only does git bit flakey and smaller scale sourceforge.net the original ... ... and worst. graveyard of old projects * Mercurial is the Python twin of Git (written in C), separated at birth!
  • 19. 1. Reply to help lists - stack overflow or python and django specific 2. Reply to project support chat rooms 3. Reporting bugs 4. Fixing bugs 5. Adding new features to existing packages 6. Contributing enough to warrant a new release 7. Coagulating snippets, paste bins, stack overflows into an egg 8. Creating and releasing your own package 9. Acting as a release manager 10. Becoming a core contributor of a large project 11. Starting your own large project / framework / language (Warning 11 is not for people who have a life outside coding) The open road
  • 20. Creative co-operation Githubs fun visualisation of contributors to one of my eggs .... hmm need to catch up merging those forks, or I will lose release manager / origin status for it ...
  • 21. Don't be afraid to commit Contributing to Django core, or other Python projects (Boosting you half way along the open road!) A workshop next week, 8th June, by fellow DBBUG member, Daniele Procida http://www.cardiffdevworkshop.com (Details - room 3 - 1:50pm) See https://dont-be-afraid-to-commit.readthedocs.org/ for more information. The workshop will take participants through the complete cycle of identifying a simple issue in a Django or Python project, writing a patch with tests and documentation, and submitting it. The workshop is aimed at the first-time committer. Very little experience is required: https://dont-be-afraid-to-commit.readthedocs. org/en/latest/prerequisites.html
  • 22. Interested in Django ... home https://www.djangoproject.com/ dbbug https://groups.google.com/forum/?fromgroups=#!forum/dbug free book http://www.djangobook.com/en/2.0/index.html 90 other books http://www.amazon.co.uk/s/ref=nb_sb_noss_1?url=search-alias&field- keywords=django+python chat #django IRC https://code.djangoproject.com/wiki/IrcFAQ help https://groups.google.com/forum/?fromgroups#!forum/django-users core devs https://groups.google.com/forum/?fromgroups#!forum/django-developers other dbbugs http://www.djangonauts.org/ jobs http://djangogigs.com/ and http://www.djangojobs.org/ add ons https://www.djangopackages.com/
  • 23. Ed Crewe https://groups.google.com/forum/?fromgroups=#!forum/dbug #dbbug django bath and bristol user group university of bristol - ITS - R&D http://www.bris.ac.uk/ilrt ed.crewe@bristol.ac.uk Contact PS: Also a member of SW Big Data http://www.meetup.com /south-west-big-data/