🐍📰 TinyDB: A Lightweight JSON Database for Small Projects If you're looking for a JSON document-oriented database that requires no configuration for your Python project, TinyDB could be exactly what you need https://lnkd.in/dh8KSssN
TinyDB: Lightweight JSON Database for Python Projects
More Relevant Posts
-
Everyone that works with Python knows the mandatory commands when you open the project folder in a terminal: $ cd project-folder $ source .venv/bin/activate $ pip install -r requirements.txt or uv sync (use uv, it's much better) And sometimes: $ docker compose up But, even being just a few lines, it gets annoying over time. So, initially I wrote a simple bash script that verifies a few things and prepares the environment. It is better, since I only write one line instead of three, but it's still annoying. Happily, recently at work, Denílson Ebling presented me a tool used for automating commands when you enter or leave a directory: direnv. Direnv allows you to write a bash script (and even use some custom built-in commands) to automatically prepare the environment when you enter the directory! And, of course, it "unloads" the env when you leave. All you need to do is write the script (some are already done in direnv documentation) and run "direnv allow". I used a simple python environment as example, but think about big and complex environments, where the incorrect order of the commands can really mess up something. Here is the direnv GitHub page: https://github.com/direnv
To view or add a comment, sign in
-
-
I would even add devenv with direnv: https://devenv.sh/ . That way you can declaratively define your project and dev environment.
Machine Learning Engineer at Zeit | MLOps & Cloud Infrastructure | 2x AWS Certified | ML in Production | Docker | Python
Everyone that works with Python knows the mandatory commands when you open the project folder in a terminal: $ cd project-folder $ source .venv/bin/activate $ pip install -r requirements.txt or uv sync (use uv, it's much better) And sometimes: $ docker compose up But, even being just a few lines, it gets annoying over time. So, initially I wrote a simple bash script that verifies a few things and prepares the environment. It is better, since I only write one line instead of three, but it's still annoying. Happily, recently at work, Denílson Ebling presented me a tool used for automating commands when you enter or leave a directory: direnv. Direnv allows you to write a bash script (and even use some custom built-in commands) to automatically prepare the environment when you enter the directory! And, of course, it "unloads" the env when you leave. All you need to do is write the script (some are already done in direnv documentation) and run "direnv allow". I used a simple python environment as example, but think about big and complex environments, where the incorrect order of the commands can really mess up something. Here is the direnv GitHub page: https://github.com/direnv
To view or add a comment, sign in
-
-
Ever wondered why FastAPI is so fast even though it's built with Python? Python is often considered slower than languages like Go or Node.js. Yet FastAPI can deliver performance that competes with them. So why is FastAPI so fast? The answer lies in the architecture underneath it. 1️⃣ Starlette (Lightweight ASGI framework) FastAPI is built on Starlette, which is an ASGI (Asynchronous Server Gateway Interface) framework. FastAPI uses Starlette for the core web functionality such as: • Routing • Middleware • WebSockets • Background tasks • Request/response handling Majorly performance is coming from the Starlette. 2️⃣ Pydantic for data validation FastAPI relies heavily on type hints in Python. These are used by Pydantic to automatically validate the incoming data. Pydantic v2 which is written in Rust, making validation extremely fast compared to traditional Python validation logic. 3️⃣ Uvicorn as the ASGI server FastAPI typically runs on Uvicorn, which is optimized for performance. Uvicorn uses: • uvloop — a high-performance event loop written in C • httptools — a fast HTTP parser also written in C FastAPI isn’t fast because Python suddenly became faster. It’s fast because of it underlying Architecture. Good architecture often matters more than the language itself.
To view or add a comment, sign in
-
Python Architecture 1. Python Source Code This is the .py file you write. Example: print("Hello, World!") This is high-level, human-readable code. ========= 2. Lexical Analysis & Parsing When you run the program: The Lexer converts source code into tokens The Parser checks syntax It generates an Abstract Syntax Tree (AST) If there’s a syntax error, it stops here ============= 3. Compilation to Bytecode Python compiles the AST into Bytecode. Bytecode is platform-independent. Stored in __pycache__ as .pyc files. Example: hello.cpython-312.pyc ================ 4. Python Virtual Machine (PVM) The Python Virtual Machine executes the bytecode. It is the runtime engine of Python. It interprets bytecode instruction by instruction. It makes Python platform-independent. 👉 The PVM is part of CPython. ============ 6. Interaction with Operating System The Python runtime communicates with: File system Network Devices OS APIs Through system calls and C libraries. ============ Python Code (.py) ↓ Lexer & Parser ↓ AST ↓ Bytecode (.pyc) ↓ Python Virtual Machine (PVM) ↓ Operating System
To view or add a comment, sign in
-
Imagine being able to write C code using Python? That just became a reality with the PythoC library. PythoC is a Domain-Specific Language (DSL) compiler that allows developers to write C-like programs and create .exe's using standard Python syntax. You can call the compiled library directly from Python like this, # test1.py from pythoc import compile, i32 @compile def add(x: i32, y: i32) -> i32: return x + y # Compile to native code @compile def main() -> i32: return add(10, 20) result = main() print(result) Then run it like this, python test1.py # prints 30 Or you can create a stand-alone .exe to run. My Towards Data Science article takes you through the details. Read it for free below. https://lnkd.in/eWAku8Wg
To view or add a comment, sign in
-
📦 Where to Find Python Packages (Libraries) The main place to discover and install Python packages is: 🌐 Python Package Index (PyPI) 👉 https://pypi.org PyPI is the official repository for Python packages — like an “App Store” for Python 🐍 🔎 How to Find Packages on PyPI Go to PyPI website Search for what you want (e.g., “HTTP requests”, “data analysis”, “AI”) Open a package page Copy the install command Example packages: Requests → for HTTP/API calls NumPy → math & arrays pandas → data handling Flask → web apps ⚡ Install Any Package (uv) After finding a package: uv pip install package-name Example: uv pip install requests uv pip install pandas 🧠 How to Know Which Package You Need ✅ 1. Search by Problem Type in Google: “Python library for ___” Examples: “Python library for machine learning” “Python library for charts” “Python library for web scraping” ✅ 2. Use GitHub Projects Many popular libraries are open source and documented on: 🌐 GitHub Search for Python projects to discover useful tools. ✅ 3. Ask AI or Documentation You can ask: “Best Python library for image processing” “Best library for trading bots” “Best backend framework in Python” ⭐ Popular Package Categories 🌍 Web & APIs Flask Django FastAPI 📊 Data Science & AI NumPy pandas scikit-learn TensorFlow PyTorch 🤖 Automation Selenium BeautifulSoup 📈 Visualization Matplotlib Seaborn Plotly 🎯 Pro Tip (Very Important) Always check: ✔ Documentation ✔ Last update date ✔ Community usage ✔ Compatibility with your Python version Not all packages are maintained. 🏆 Beginner Strategy Start with trusted, widely used libraries first. If you want, I can also give you: ✅ Top Python packages every developer should know ✅ Best packages for AI jobs 💰 ✅ Packages for freelancing & automation ✅ A roadmap from beginner → expert
To view or add a comment, sign in
-
Excel users get frustrated seeing errors while trying Python in Excel or while practicing Python separately (if they are new to Python) First, remember that every programmer sees errors daily. This is the reason Stack Overflow is one of the most visited developer platforms in the world. If you are coming from Excel with no prior programming experience, understanding why the error occurred makes you faster and more confident. Here are common errors new Python users face 👇 SyntaxError Missing colon, bracket, indentation issue. Python is strict about structure. NameError Using a variable that hasn’t been defined yet. TypeError Trying to combine incompatible types. Example: adding a number to text. IndexError Trying to access a position that doesn’t exist in a list or dataframe. KeyError Trying to access a column or dictionary key that isn’t present. AttributeError Calling a method that doesn’t exist for that object. ValueError Correct type, but inappropriate value (e.g., invalid input). ImportError / ModuleNotFoundError Python can’t find the library you’re trying to use. Shift your mindset from “Why is this breaking?” to “What is Python trying to tell me?” Errors are actually structured hints, if we observe carefully, we learn how that particular language works. What other errors confused you when you started? #Excel_Python #LearnersWorld
To view or add a comment, sign in
-
Adding Items to Python Dictionaries Made Simple Dictionaries in Python are versatile data structures that store key-value pairs. They are particularly useful for organizing and accessing data efficiently. In the given code, we start with an empty dictionary and a function to add items to it. The `add_item` function defines inputs for a key and a value, which are inserted into the dictionary using the syntax `my_dict[key] = value`. This method automatically creates a new entry if the key does not exist or updates the value if the key is already present. As shown, we sequentially add entries to our dictionary: a person's name, age, and city. An important aspect of dictionaries is their dynamic nature; you can freely add or update items without predefining their structure. When we call `print(my_dict)`, we see the aggregated result of our additions. This real-time data organization can be crucial when managing user information, settings, or configuration data in software applications. Quick challenge: How would you modify the `add_item` function to prevent overwriting an existing key? #WhatImReadingToday #Python #PythonProgramming #Dictionaries #PythonTips #Programming
To view or add a comment, sign in
-
-
New Project: Python CLI Test Generator I built a simple command-line tool that automatically generates Python unittest test files for a given Python function using an LLM. Idea Provide a Python file containing a function, and the tool will analyze it and generate a ready-to-run test file automatically. Tools Used • Python ast – to parse and validate the structure of the input file • argparse – to build the command-line interface • unittest – for generating structured test cases • Ollama + qwen3-coder-next – LLM used to generate the tests Simple Pipeline CLI → Validate file with AST → Build prompt → Call LLM → Generate test file The tool outputs a complete unittest file covering possible edge cases for the function. 🔗 GitHub: https://lnkd.in/dXbqUh7e #Python #LLM #AI #Testing #Automation #GenAi
To view or add a comment, sign in
-
Mastering the ‘PrettyTable’ Library: Python Table Formatting In the world of software development, presenting data clearly and concisely is paramount. Whether you're displaying results from a database query, showcasing performance metrics, or simply organizing information for a report, well-formatted tables can significantly enhance readability and understanding. Python offers a plethora of libraries to help you achieve this, and one of the most user-friendly and powerful is PrettyTable…...
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development