Python in nutshell for Architects

Shailendra Jain
3 min readMar 24, 2023

--

When I started to learn Python as an architect , I was wondering about the specific resource set which I can follow to get a high level understanding of the ecosystem . I worked on a lots of websites and courses to find the best. Finally I created a list of learning resources and sharing the same with you to save your time.

As a solution architect , you don’t need to know all the intricacies of Python programming, but understanding the key aspects and best practices will help you make informed decisions when designing solutions. Here’s an overview of essential Python aspects and a cheatsheet tailored for solution architects or any one who is keen to master the python development.

  • Python versions: Be aware of the Python version being used in your projects (Python 2.x or Python 3.x). As of January 1, 2020, Python 2.x is no longer supported, so it’s recommended to use Python 3.x.
  • Virtual environments: Use virtual environments (venv, virtualenv, or conda) to isolate dependencies and manage different project environments effectively.
  • Package management: Use pip (the Python package manager) to install and manage third-party packages. Utilize requirements.txt or Pipfile to specify and lock dependencies for your projects.
  • Coding style and conventions: Follow the PEP 8 style guide for writing clean, readable, and consistent Python code. Use tools like flake8, pylint, or black for linting and auto-formatting.
  • Testing: Write tests using Python’s built-in unittest framework or third-party libraries like pytest or nose. Implement test-driven development (TDD) and maintain high test coverage.
  • Documentation: Document your code using docstrings and tools like Sphinx to generate user-friendly documentation.
  • Performance: Use built-in Python tools like cProfile, timeit, and memory_profiler to profile and optimize the performance of your code. Be aware of the Global Interpreter Lock (GIL) and its implications on multi-threaded Python programs.
  • Concurrency and parallelism: Understand the differences between threads, processes, and asynchronous programming (asyncio) in Python. Choose the appropriate concurrency model based on your application’s requirements.
  • Web frameworks: Be familiar with popular Python web frameworks like Django, Flask, and FastAPI for building web applications and RESTful APIs.
  • Data processing and analysis: Utilize libraries like pandas, NumPy, and Dask for handling data processing and analysis tasks.
  • Deployment and scaling: Deploy your Python applications using WSGI servers (e.g., Gunicorn, uWSGI) or ASGI servers (e.g., Daphne, uvicorn) behind a reverse proxy (e.g., Nginx). Consider containerization (Docker) and orchestration (Kubernetes) for deploying and scaling your applications.

Quick Cheatsheet:

  • Virtual environments:Create: python -m venv venv_nameActivate: source venv_name/bin/activate (Linux/macOS) or venv_name\Scripts\activate (Windows)Deactivate: deactivate
  • Package management:Install package: pip install package_nameInstall from requirements.txt: pip install -r requirements.txtSave installed packages: pip freeze > requirements.txt
  • Testing:Run unittest tests: python -m unittest discoverRun pytest tests: pytest
  • Profiling:Time a script: python -m timeit -s 'setup_code' 'code_to_time'Profile a script: python -m cProfile -s cumulative script.py
  • Asyncio (Python 3.7+):Define a coroutine: async def function_name():Run a coroutine: await function_name()Run an event loop: asyncio.run(main())
  • Web frameworks:Django: pip install DjangoFlask

Learning Resources:

When managing a complex Python-based application in production that serves millions of users, it’s essential to focus on application performance, scalability, security, monitoring, and deployment practices. The following resources will help you achieve these goals:

Optimising Python Performance:

High Performance Python (O’Reilly Book)

Python Performance Tips (Official Python Wiki)

Handling Scalability and Concurrency:

Web Frameworks:

Implementing Security:

Monitoring Techniques:

Deployment and CI/CD Best Practices:

Containers and Orchestration:

Cloud Provider Libraries:

Caching for Better Performance:

Load Balancing and Reverse Proxies:

I hope that this article will help learners to find all important learning resources from place . If you like this curated list , don’t forget to follow me and give me some claps. Cheers !!!

You can find great learning resources collection on J2EE from my post https://medium.com/@asynchronouscal/j2ee-collection-of-great-resources-a98cf94de4f1

--

--

Shailendra Jain

A curious reader and learner by heart. A scientist in day to day life. Technical Architect @HCL Technology,India || Ex-IBM || Ex-Samsung