"𝗕𝘂𝗱𝗴𝗲𝘁: 37500.0 INR - 75000.0 INR 𝗧𝗶𝘁𝗹𝗲: asPy - Assamese Python Transpiler Project Name: asPy — Assamese → Python Transpiler & VS Code Extension Objective: Build a functional VS Code extension enabling Assamese programming by transpiling Assamese code into Python and executing it seamlessly within VS Code. Project Overview The asPy project aims to make programming accessible in Indian regional languages—starting with Assamese. The solution must allow users to: Write code in Assamese in .aspy files inside VS Code. Click “Run” to: Transpile Assamese → Python. Execute the Python code in a controlled environment. Display both transpiled Python and program output inside VS Code. The extension should work offline, bundle the Python transpiler engine, and provide cross-platform support (Windows primary, Linux/macOS secondary). Scope of Work Core Components ComponentDescriptionTranspiler Engine (Python)Converts Assamese keywords & identifiers to Python equivalents using a JSON mapping. Executes code in a sandbox. (Already designed in MVP)VS Code Extension (TypeScript)Provides UI, command registration, syntax highlighting, and communication with the transpiler backend.Backend BridgeThe extension launches a bundled Python process (runner_cli.py) that handles transpilation and execution.Syntax HighlightingTextMate grammar to highlight Assamese keywords and built-ins.Output Panel / WebviewDisplays transpiled Python and program output side by side. Functional Requirements a. Language Handling File extension: .aspy Syntax highlighting for Assamese keywords (from mapping.json). Supports Assamese digits ০–৯ and transliterated functions. b. Commands & Features CommandActionaspy.runRuns current file; shows transpiled Python + output.aspy.showPythonShows transpiled Python only.aspy.newSampleInserts a “Hello World” Assamese template. c. Settings KeyTypeDefaultDescriptionaspy.pythonPathstringautoCustom Python interpreter path.aspy.mappingPathstringinternalPath to keyword mapping file.aspy.maxExecMillisnumber3000Max runtime per execution (ms). d. Output Opens a new VS Code panel or webview showing: ### Transpiled Python <code> ### Output <result> Handles runtime errors gracefully (show traceback in red). e. Security Executes in restricted sandbox (safe builtins only). Enforces timeout and memory safety (limit execution time to avoid infinite loops). Technical Stack LayerTechnologyBackendPython 3.10+FrontendTypeScript (VS Code Extension API)Editor FrameworkVS CodePackagingvsce (Visual Studio Code Extension Manager)JSON MappingAssamese → Python keyword dictionary Deliverables VS Code Extension Package (aspy-x.y.vsix) Installable extension with bundled backend. Includes syntax highlighting and run commands. ..." #VSCodeExtension #Transpiler #Assamese #Python #ProgrammingLanguage #Localization #DeveloperTools #CodeEditor #IndianLanguages #Accessibility → https://lnkd.in/dBTg_2y9
Nikolay M.’s Post
More Relevant Posts
-
🚀 Supercharge Your Python Environments with uv — The Fastest Tool You Haven’t Tried Yet ⚡ If you’re still using the traditional combo of python -m venv → source .venv/bin/activate → pip install ... …then it’s time to meet uv, the game-changer from the team behind Ruff and Rye. Written in Rust, uv is designed to be blazing fast, lightweight, and fully compatible with standard Python environments — but far more powerful. 💪 💡 What is uv? uv is a modern Python package and environment manager that replaces: 🧱 venv / virtualenv (environment creation) 📦 pip (package installation) 🧩 pip-tools (dependency locking) 🐍 pyenv (Python version management) ⚙️ pipx (tool isolation) All rolled into one ultra-fast CLI. ⚡ Why Developers Love It ✅ Speed – Creates virtual environments up to 80× faster than venv, installs packages 5–10× quicker than pip. ✅ Unified Workflow – Manage Python versions, virtualenvs, dependencies, and tools in one place. ✅ Built-in Caching – Reuses wheels across projects, so re-installs are nearly instant. ✅ Reproducible Environments – uv pip compile + uv pip sync ensure perfect dependency locking. ✅ Tool Isolation – Run utilities like pytest or black directly via uvx — no need to install them globally. 🧠 Real Example Traditional Setup python -m venv .venv source .venv/bin/activate pip install -r requirements.txt With uv uv venv uv pip install -r requirements.txt Same workflow. 10× faster. Cleaner. Reproducible. Once you try it, there’s no going back. 🚀 🔧 Installation curl -LsSf https://lnkd.in/gd_ZNARA | sh # or brew install uv Then: uv --version That’s it — ready to build faster environments than ever. 🧩 Pro Tip Run isolated tools without polluting your environment: uvx black . uvx pytest uvx mypy 🏁 Final Thoughts uv isn’t just another Python utility — it’s the next evolution in Python environment management. If you manage multiple Python projects, switch between versions, or maintain CI/CD pipelines — give uv a try. You’ll wonder how you lived without it. 💬 Over to You Have you tried uv yet? Would you switch from venv + pip to a unified tool like this? Let’s discuss! 🔥 Follow me for more on UV and Sql Agents discussions . Stay tuned ! #Python #DataEngineering #DataScience #VirtualEnvironments #DevOps #Astral #uv #Rust #OpenSource #Databricks #Snowflake #EngineeringTools
To view or add a comment, sign in
-
🔍 Python's Hidden Gem: Short-Circuit Evaluation with Operand Return Ever wondered why Python's "or" and "and" operators are more powerful than they seem? Unlike Java or C++, they don't just return True/False – they return the actual values! Short-circuit evaluation means that logical operators like and and or stop evaluating as soon as the result of the expression is known. In Python, these operators don’t just return True or False; they actually return the operand that determined the result — that’s what is meant by operand return. Python's logical operators ("or" and "and") return one of the actual operands, not necessarily True or False. The "or" Operator - - Returns the first truthy value it encounters - If all values are false, returns the last value The "and" Operator in Python - - Returns the first false value it encounters - If all values are truthy, returns the last value ``` # OR examples print(None or [1, 2, 3]) # [1, 2, 3] - returns first truthy print("hello" or "world") # "hello" - returns first truthy print(False or 0 or [] or {}) # {} - all falsy, returns last print(42 or False) # 42 - returns first truthy # AND examples print([1, 2] and "text") # "text" - all truthy, returns last print("text" and None) # None - returns first falsy print(5 and 10 and 20) # 20 - all truthy, returns last print(0 and [1, 2, 3]) # 0 - returns first falsy # Check if user exists AND has valid credentials OR is admin user = get_user(username) access_granted = (user and user.password == password) or is_admin # Returns: user object if password matches, False if not, or True if admin ``` False Values in Python (the complete list) : False None 0 (integer zero) 0.0 (float zero) 0j (complex zero) "" (empty string) [ ] (empty list) ( ) (empty tuple) { } (empty dict) set( ) (empty set) range(0) (empty range) Truth Values in Python (everything else!) : True Any non-zero number: 1, -1, 3.14, 2+3j Any non-empty string: "hello", "0", " " (even a space!) Any non-empty collection: [1, 2], (1,), {"a": 1} Any object or instance (by default) Functions, classes, modules ⚡ Why This Matters: - Reduces code complexity - Eliminates nested if-else pyramids - Makes default value handling elegant - Improves code readability dramatically #Python #CleanCode #CodingTips #SoftwareDevelopment
To view or add a comment, sign in
-
-
🎃 Python Optimization Tip: Building Strings the Right Way It's Halloween, so freeCodeCamp provided the **SpOoKy~CaSe** coding challenge! This task required complex string manipulation, including case-insensitivity, custom separator replacement, and conditional, alternating capitalization. The goal was to convert `hello_world` to `HeLlO~wOrLd`. 👻 The Pythonic Solution My final code is efficient and easy to read, tackling the requirements in two clear steps: 1. **Preprocessing:** Use built-in `str.lower()` and `str.replace()` to handle case and separators (`_` and `-` become `~`). 2. **Casing Logic:** Iterate through the string, using a counter that **only increments on letters** to correctly apply the alternating capitalization pattern. ```python def spookify(boo: str) -> str: # 1. Preprocess the string boo_chars = boo.lower().replace('-', '~').replace('_', '~') count_alpha = 0 output_boo = [] # <-- Key for performance! for char in boo_chars: if char.isalpha(): count_alpha += 1 if count_alpha % 2 != 0: output_boo.append(char.upper()) else: output_boo.append(char) else: output_boo.append(char) return ''.join(output_boo) ``` Lesson Learned: `+=` vs. `.append()` The most important takeaway here is **performance** when building strings inside a loop. * **Avoid Repeated String Concatenation (`+=`):** In Python, strings are **immutable**. When you use `output_boo += char`, Python must create a brand **new string object** in memory every single time. This O(N^2) process can be a huge performance hit for large inputs. * **The Optimal Method (`.append()` + `.join()`):** By contrast, using a **list** (`output_boo = []`) and calling `.append()` is an O(1) operation. The final `''.join(output_boo)` is a single, efficient operation to stitch the parts together. This ensures the entire solution remains O(N) time complexity. Always prioritize building output with a list and `join()` over repeated string concatenation! Happy coding! #Python #CodingChallenge #SoftwareEngineering #Performance #Optimization #Halloween
To view or add a comment, sign in
-
#AI #ML #Post8🧠 Invoke Python from C# using Python.Runtime ✅️Python.Runtime is the core library of Python.NET, a bridge between C# (.NET) and Python. It allows your C# code to embed the Python interpreter, run Python code, and interact with Python objects just like native C# objects. Think of it as a “translator” between C# and Python. --- ⚙️ Installation You can install it via NuGet: ✅️dotnet add package Python.Runtime --- 🧩 Key Components of Python.Runtime Let’s break down the main classes and methods you’ll use: 1. PythonEngine This is the core interface for controlling the embedded Python interpreter. Common methods: ✅️PythonEngine.Initialize() Starts the Python interpreter ✅️PythonEngine.Shutdown() Stops the interpreter and frees resources ✅️PythonEngine.Exec(string code) Executes a block of Python code ✅️PythonEngine.RunString(string code) Runs a single Python expression and returns the result ✅️PythonEngine.ImportModule("module_name") Imports a Python module --- 2. Py.GIL() In Python, the Global Interpreter Lock (GIL) ensures only one thread executes Python bytecode at a time. ✅ Example: using (Py.GIL()) { // Interact with Python here } When the using block ends, the GIL is automatically released. --- 3. PyObject A wrapper around Python objects. You can use PyObject to reference, call, or convert Python data. --- 4. Py.Import() Used to import Python modules from C# just like import in Python. --- 🧠 Example: Calling a Python function from C# Let’s say you have this Python file (myscript.py): # myscript.py def multiply(a, b): return a * b Here’s the C# code that uses Python.Runtime to call it: using System; using Python.Runtime; class Program { static void Main() { // Initialize Python interpreter PythonEngine.Initialize(); using (Py.GIL()) { // Import your Python script (make sure it's in the same folder or on sys.path) dynamic script = Py.Import("myscript"); // Call the function dynamic result = script.multiply(5, 10); Console.WriteLine($"Result from Python: {result}"); } PythonEngine.Shutdown(); } } --- ⚙️ How It Works Internally 1. PythonEngine.Initialize() loads the Python C API into your .NET process. 2. The embedded interpreter behaves exactly like a normal Python runtime (you can import any installed package). 3. Objects are wrapped as PyObject so you can use them in C#. 4. Python.NET automatically converts between basic .NET and Python types: int ↔ int double ↔ float string ↔ str List<T> ↔ list --- 💡 Tips & Notes ✅️Python must be installed on your system (and PYTHONHOME or PYTHONPATH should be correctly set if needed). ✅️You can specify a specific Python version with: Environment.SetEnvironmentVariable("PYTHONNET_PYDLL", @"C:\Python311\python311.dll");
To view or add a comment, sign in
-
-
if __name__ == '__main__': ???? Ever wondered why so many Python scripts start with if __name__ == '__main__':? This common idiom is crucial for writing clean, reusable Python code! It allows you to define code that only runs when the script is executed directly, and not when it's imported as a module into another program. This keeps your modules modular and prevents unintended side effects when you're just trying to use their functions. BUT => How will I know when to use it and when not? Here is a intuition for it : You'll know when to use if __name__ == '__main__': based on whether the code you're writing is meant to be run as a standalone program OR if it's primarily designed to be imported and used by other Python scripts as a module. • Use it when: You have code that should only run when the file is executed directly. This often includes: ‣ Application entry points: Setting up and running your main program logic (e.g., a command-line interface, starting a web server, or the main flow of your calculator program from the video). ‣ Testing/Demonstration code: Small examples or tests that show how your module's functions work, but shouldn't run every time someone imports your module. ‣ Input/Output operations: Prompts for user input, print statements for direct interaction, or file operations that are specific to the script's main execution. • Don't use it when: ‣ The code is meant to be reusable functions, classes, or variables that you want always available when the file is imported. These are the building blocks of your module. ‣ You have code that needs to run every time the module is loaded, regardless of whether it's run directly or imported (e.g., setting up global configurations, defining constants). Think of it like this: if __name__ == '__main__': is like the "on switch" for your program's main functionality, but only if you're turning that specific program on. If another program is just borrowing parts of it (importing), you don't want the "on switch" to activate. Just clearing a basic thing for myself and others :) Ratto mat, samjo bhaiyo!
To view or add a comment, sign in
-
Day 32 — Python: Modules & User-Defined Modules 🐍 Introduction to Modules What is a Module? A module is a Python file (.py) containing functions, classes, and variables. Modules help organize code into logical sections. Modules let you reuse code across multiple programs. Modules make code more readable and maintainable. Modules support collaborative development. Types of Modules in Python User-Defined Modules — created by you. Built-in Modules — provided by Python (e.g., math, os). (Covered separately.) External Modules — third-party packages installed via pip. This post focuses on user-defined modules and how to use them. Importing Modules in Python — common ways a. Import entire module: import my_module print(my_module.function_name()) b. Import specific items: from my_module import function_name print(function_name()) c. Import with an alias: import my_module as mm print(mm.function_name()) d. Avoid: from my_module import * # can cause name conflicts User-Defined Modules — step-by-step Step 1 — Create the module file my_module.py: def greet(name): return f"Hello, {name}!" pi = 3.14159 Step 2 — Use the module in another file (main.py): import my_module print(my_module.greet("Alice")) print("Value of Pi:", my_module.pi) Import specific function: from my_module import greet print(greet("Bob")) Using an alias: import my_module as m print(m.greet("Charlie")) Python module search path When importing, Python searches: Current directory Directories in sys.path To view or modify: import sys print(sys.path) sys.path.append("C:/path/to/your/modules") # add custom path Using if name == "main" Use this to prevent code from running on import. inside my_module.py def greet(name): return f"Hello, {name}!" if name == "main": print(greet("Alice")) # runs only when file executed directly Run: python my_module.py → executes the block. If imported, the block is ignored. 7) Installing & using external modules Install with pip: pip install requests Example usage: import requests response = requests.get("https://www.example.com") print(response.status_code) ✨ Tip: Start organizing larger projects into packages (folders with init.py) for better structure. 💬 What module will you package into a module next? Share below! ⬇️ #Python #DaysOfCode #PythonModules #CodingJourney
To view or add a comment, sign in
-
🐍 Pythonic Idioms: A Core Driver of Python’s Popularity Python’s rise to dominance in the programming world isn’t just about its versatility—it’s about its philosophy. At the heart of this philosophy lies the concept of Pythonic idioms: elegant, readable, and concise coding patterns that make Python code feel natural and intuitive. 📜 A Brief History Python was created by Guido van Rossum in the late 1980s and released in 1991. From the beginning, it emphasized simplicity and readability. This ethos was later captured in the Zen of Python by Tim Peters—a collection of 19 guiding principles that define what it means to write “Pythonic” code. Some favorites: Beautiful is better than ugly Simple is better than complex Readability counts These principles laid the foundation for Pythonic idioms, which evolved as best practices within the community. 🎯 Why Pythonic Idioms Matter Pythonic idioms were introduced to: Promote clarity and readability Encourage consistency across codebases Improve performance and efficiency Reduce errors and complexity They serve as a shared language among Python developers, making collaboration smoother and code more maintainable. ✅ Benefits of Pythonic Idioms Readable & Maintainable: Easier to understand and debug. Concise: Express logic in fewer lines. Performant: Often faster than verbose alternatives. Community-Driven: Reinforced by PEP 8 and Python’s culture. 🧰 Examples of Pythonic Idioms Here are some idioms that every Python developer should know: # List Comprehension squares = [x**2 for x in range(10)] # Dictionary Comprehension expensive = {k: v for k, v in prices.items() if v > 0.4} # Enumerate for i, item in enumerate(['a', 'b', 'c']): print(i, item) # Zip for name, age in zip(names, ages): print(f"{name} is {age} years old") # Truthiness if items: print("List is not empty") # EAFP try: value = my_dict['key'] except KeyError: value = None # Context Manager with open('file.txt') as f: content = f.read() # Throwaway Variable for _, value in enumerate(data): process(value) # Safe Dictionary Access value = my_dict.get('key', default_value) # Conditional Expression status = "active" if is_enabled else "inactive" 📈 Impact on Python’s Popularity Research shows that Pythonic idioms: Boost developer productivity Improve code comprehension Drive adoption across industries Serve as a hallmark of expert-level Python They’re not just stylistic—they’re strategic. 🏁 Final Thoughts Pythonic idioms are a big reason why Python is loved by beginners and experts alike. They make code elegant, maintainable, and powerful. Whether you're just starting out or refining your craft, embracing Pythonic idioms will elevate your coding style and help you think more clearly about your solutions. 💬 What’s your favorite Pythonic idiom? 👇 Share it in the comments and let’s celebrate clean code! #Python #CleanCode #SoftwareEngineering #Pythonic #CodingTips #DeveloperExperience #ZenOfPython #ProgrammingPhilosophy
To view or add a comment, sign in
-
-
What Happens with Pydantic in Python? Pydantic is one of the most popular Python libraries primarily used for data validation and settings management. It uses Python's standard type hints to enforce data correctness at runtime. The main function of Pydantic is to ensure that the data entering your Python application is structured and typed exactly as you expect it to be. 1. Data Validation at Runtime When you define a class that inherits from pydantic.BaseModel, you are creating a data schema. Pydantic then uses your standard Python type hints (str, int, list, etc.) to create validation rules. What it does: When you try to create an instance of that Pydantic Model, it checks every piece of data. If the data does not match the specified type (e.g., trying to pass a string "abc" into a field that expects an integer), Pydantic immediately raises a ValidationError. Benefit: This prevents incorrect or unexpected data types from causing difficult-to-trace bugs deeper in your application. 2. Automatic Type Coercion (Casting) Pydantic is not overly strict and can often "coerce" (automatically convert) data into the correct type if the conversion is safe and reasonable. Example: If you define a field as an int but receive the string "123", Pydantic will often safely convert the string to the integer 123 before storing it. Benefit: This makes your application more resilient when dealing with input from external sources like JSON APIs, where numbers might sometimes be transmitted as strings. 3. Data Serialization and Documentation Pydantic models are easily convertible to and from standard Python data types (like dictionaries) and formats like JSON. Serialization: It can turn your complex Python object back into a dictionary or JSON string, ready to be sent over a network. Documentation: Pydantic models can automatically generate a JSON Schema, which is a standardized way to describe the structure of your data. This is crucial for frameworks like FastAPI, which use it to auto-generate interactive API documentation (Swagger UI/OpenAPI). Summary In short, Pydantic takes the guesswork out of handling data. It acts as a powerful guardian at the boundary of your application, validating incoming data and ensuring that everything your internal code works with is clean, correct, and predictable.
To view or add a comment, sign in
-
Building a Generic CRUD Base Class for Scalable Python Backends One common pain point in backend development is writing the same CRUD (Create, Read, Update, Delete) logic again and again for each data model. https://lnkd.in/ev4Dq3zB #python #fastapi #crud #mongo #generic
To view or add a comment, sign in
More from this author
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