Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

source_suffix = ['.rst', '.md']

extensions = ['myst_parser','sphinx.ext.autodoc', 'sphinx.ext.autosummary','sphinx_copybutton']
extensions = ['myst_parser','sphinx.ext.autodoc', 'sphinx.ext.autosummary','sphinx_copybutton','sphinx_contributors']

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
Expand Down
15 changes: 15 additions & 0 deletions doc/contributors.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Contributors
============

We would like to express our sincere gratitude to the following
contributors who have made valuable contributions


.. contributors:: python-world/Newsletter
:avatars:
:contributions:
:order: DESC

Thank you for your dedication and for enriching the Python community
with your valuable insights, code snippets, and contributions! Happy
coding! 🐍✨
6 changes: 5 additions & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ Python-world Newsletter
.. toctree::
:maxdepth: 2

modules
contributors
modules



4 changes: 3 additions & 1 deletion doc/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
:maxdepth: 4

newsletters/index.2023
newsletters/index.2022
newsletters/index.2022

.. contributors:: sphinx-doc/sphinx
270 changes: 270 additions & 0 deletions doc/newsletters/2023/WEEK_29.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@

# Week 29 - Jully 2023

## Introduction and Highlights


Welcome to the latest edition of the Python-World Newsletter! We bring
you the most exciting updates and insightful content from the Python
community. In this week’s edition, we have some incredible code
snippets, community spotlights, upcoming events, useful resources, and
more. Let’s dive in!

## Code Snippets

### 1. 💼 Simplifying Python Classes with Dataclasses.

Python dataclasses are a fantastic addition to the Python standard library that simplifies the creation of classes for storing data. 🏰💾 With just a few lines of code, you can define classes that come with built-in methods for easy attribute initialization, comparison, and more. 🎁💻

**🌟 Key Features of Python Dataclasses:**

✅ Automatic attribute initialization - Say goodbye to writing tedious `__init__` methods!

✅ Concise and clean class definitions using decorators.

✅ Built-in methods for equality comparison, representation, and more.

✅ Customizable field defaults and ordering.

✅ Full integration with Python's standard library.


**📝 Simple Examples to Get Started:**

```python
from dataclasses import dataclass

@dataclass
class Point:
x: int
y: int

# Creating instances
p1 = Point(1, 2)
p2 = Point(3, 4)

# Accessing attributes
print(f"Point 1: x={p1.x}, y={p1.y}")
print(f"Point 2: x={p2.x}, y={p2.y}")
```

**🚀 Use Cases for Python Dataclasses:**
1. **Configuration Objects**: Use dataclasses to create clean and straightforward configuration objects for your applications. 🛠️🔧
2. **Data Containers**: Dataclasses are perfect for holding and manipulating structured data, such as CSV records or JSON data. 📂🗃️
3. **API Responses**: Parse API responses into dataclass instances, making the data easy to work with and comprehend. 📡💼
4. **Immutable Objects**: By default, dataclasses are immutable, making them suitable for representing read-only data. 🔒🔏
5. **Testing**: Dataclasses can be incredibly useful when writing test cases with complex input data. 🧪🧾

**💡 Pro Tip:**
Don't forget to explore advanced dataclass features like default values, ordering, and post-init processing. Dataclasses are highly customizable to fit your specific needs! 🔍🔧



### 2. 🔦 Exploring Python's Hidden Secrets: The inspect Module

The `inspect` module is your backstage pass to Python's internals. 🎭🎫 It provides functions for introspecting live objects like modules, classes, functions, and more. With `inspect`, you can retrieve information about code objects, inspect callables' signatures, and even perform source code analysis. 🕵️‍♀️📝

**🔍 Key Features of `inspect`:**

✅ Retrieving information about objects and modules at runtime.

✅ Accessing source code and analyzing the structure of Python functions and classes.

✅ Inspecting and manipulating the call signature of functions.

✅ Extracting and examining documentation strings.

✅ Finding the source file and line number of code objects.

**📝 Examples to Get Started:**
```python
import inspect

# Get the source code of a function
def greet(name,age):
return f"Hello, {name}!"

source_code = inspect.getsource(greet)
print('Source code:\n',source_code)

# Inspect a function's signature
signature = inspect.signature(greet)
print("Signature:",signature)



'''
Output
Source code:
def greet(name,age):
return f"Hello, {name}!"

Signature: (name, age)
'''

```

**🚀 Use Cases for `inspect`:**
1. **Debugging and Logging**: Use `inspect` to gather information about the calling frames for powerful debugging and logging capabilities. 🐞📝
2. **Documentation Generation**: Automate the generation of documentation by extracting docstrings and function signatures with `inspect`. 📚📜
3. **Dynamic Function Invocation**: Dynamically call functions with the correct arguments using `inspect` to inspect their signatures. 📞🔧
4. **Code Analysis**: Perform static code analysis and gather insights about your codebase using `inspect` functions. 📊📋
5. **Custom Decorators**: Create custom decorators that can automatically introspect and modify the behavior of decorated functions. 🎭🔮

**💡 Pro Tip:**
Experiment with `inspect` interactively in a Python REPL to get a better feel for its capabilities. 🔄🔬




### 3. 🔧 The Python Package Manager: Unleashing the Power of pip


`pip` is your go-to tool for installing, managing, and distributing Python packages. 🛠️📚 With a vast repository of open-source libraries available on the Python Package Index (PyPI), `pip` makes it a breeze to enhance your Python projects with external functionality. 🌟📦

**🌟 Key Features of `pip`:**

✅ Installing packages with a simple command - `pip install package-name`.

✅ Managing package versions and dependencies effortlessly.

✅ Listing installed packages - `pip list`.

✅ Upgrading packages to the latest versions - `pip install --upgrade package-name`.

✅ Creating virtual environments for isolated package installations.

**📝 Examples to Get Started:**

```python
# Install a package
# Example: Installing the popular requests library
# pip install requests

# Listing installed packages
# pip list

# Upgrading a package
# Example: Upgrading requests to the latest version
# pip install --upgrade requests
```

**🚀 Use Cases for `pip`:**

1. **Library Installation**: Use `pip` to easily install third-party libraries like NumPy, pandas, Django, and more, saving you time and effort. 📚💡
2. **Package Management**: Keep your project's dependencies organized and up to date with `pip`, ensuring smooth collaboration. 📦🔄
3. **Virtual Environments**: Create virtual environments to isolate package installations and avoid version conflicts. 🌐🧪
4. **Continuous Integration**: Utilize `pip` to install project dependencies in CI/CD pipelines for automated testing and deployment. 🚀🔧
5. **Package Distribution**: Share your Python projects with others by distributing them as packages on PyPI using `pip`. 🚀🌟

**💡 Pro Tip:**
Explore `pip`'s extensive options like installing packages from version control repositories or installing specific package versions to suit your project's requirements. 🔄🎛️


### 4. 🎁 Unpacking the Magic of Tuples

Tuples are one of Python's versatile data structures, and unpacking allows you to extract individual elements from a tuple effortlessly. 🎩🌟 It's like unwrapping a present and discovering the treasures within! 🎁💎

**🧳 Packing Tuples for Efficiency:**
Packing, on the other hand, involves creating tuples by grouping elements together. 🎒🌐 It's like packing your essentials for a journey, ensuring everything stays organized and accessible. 🧳🗺️

**📝 Examples to Get Started:**
```python
# Tuple Unpacking
point = (10, 20)
x, y = point
print(f"x: {x}, y: {y}")

# Extended Unpacking
numbers = (1, 2, 3, 4, 5)
first, *middle, last = numbers
print(f"First: {first}, Middle: {middle}, Last: {last}")

# Tuple Packing
person = "John", 30, "Engineer"
print(person)
```

**🚀 Use Cases for Tuple Unpacking and Packing:**
1. **Multiple Return Values**: Unpack tuples to receive multiple return values from functions in one assignment. 📤🔁
2. **Swapping Values**: Swap variable values without using a temporary variable using tuple unpacking. ↔️🔄
3. **Iterating over Multiple Elements**: Unpack tuples while iterating over lists or other iterable data structures. 🔄📑
4. **Function Arguments**: Use tuple packing to pass multiple arguments to a function in a single parameter. 📋🎛️
5. **Namedtuples**: Unpack namedtuples for concise access to individual attributes. 🏷️🗃️

**💡 Pro Tip:**
Remember that both tuple unpacking and packing support extended syntax, allowing you to handle multiple elements at once! 🎯🎯



### 5. ➗ Divmod - Dividing and Modulo Together

`divmod` is a Python built-in function that takes two numbers and returns a pair of values - the result of integer division and the remainder (modulo). 🧮🔢 It's like getting two for the price of one! 💲🎁

**📝 Examples to Get Started:**
```python
# Using divmod
result = divmod(20, 3)
print(f"Result of divmod(20, 3): {result}")

# Using divmod in a loop
quotients = []
remainders = []
for num in range(1, 6):
q, r = divmod(20, num)
quotients.append(q)
remainders.append(r)
print(f"Quotients: {quotients}")
print(f"Remainders: {remainders}")
```

**🚀 Use Cases for `divmod`:**
1. **Time Conversion**: Convert seconds into hours, minutes, and remaining seconds using `divmod`. 🕐🕒
2. **Loop Iterations**: Use `divmod` in loops to efficiently calculate quotients and remainders for a range of numbers. 🔃🔢
3. **Formatting**: Combine `divmod` results to display complex numerical data elegantly. 🎨🔠
4. **Resource Allocation**: Distribute resources evenly among a given number of entities using `divmod`. 💻📊
5. **Currency Handling**: Calculate the number of denominations needed when making change with `divmod`. 💲💸

**💡 Pro Tip:**
Remember that `divmod` can be a powerful tool to optimize certain mathematical operations and simplify your code. 🧮🚀


## Upcoming Events


| Event Name | Date | Location | URL |
|------------------|---------|-----------|---------------------------|
| North Bay Python 2023 | July 29th & 30th | Petaluma, California | [Website](https://dev.events/conferences/north-bay-python-petaluma-6-2023) |
| PyDelhi Conference 2023 | Aug 19th & 20th | Delhi | [Website](https://conference.pydelhi.org/) |
| PyCon 2023 | Sept 29 To Oct 2 | HYDRABAD | [Website](https://in.pycon.org/2023/) |


Stay updated with the latest events and conferences in the Python
community. Mark your calendars and don’t miss out on these exciting
opportunities to learn, network, and engage with fellow Python
enthusiasts!



Contact
-------

Sure! Here's the text formatted in proper Markdown format:

If you have any questions or need further assistance, feel free to reach out to us at [pythonworldhelp@gmail.com](mailto:pythonworldhelp@gmail.com) or join the discussion on our [GitHub Discussions](https://github.com/Python-World/newsletter/discussions) board.


## Contributors


We would like to express our sincere gratitude to the following
contributors who have made valuable contributions to this edition of the
Python-World Newsletter:

- [Ravishankar Chavare](https://github.com/chavarera/)
- [Aahnik Daw](https://github.com/aahnik/)


Thank you for your dedication and for enriching the Python community
with your valuable insights, code snippets, and contributions! Happy
coding! 🐍✨
3 changes: 2 additions & 1 deletion doc/newsletters/index.2023.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
==========
.. toctree::
:maxdepth: 4


2023 Jully - Week 29 <2023/WEEK_29.md>
2023 Jully - Week 28 <2023/WEEK_28.md>
2023 Jully - Week 27 <2023/WEEK_27.md>
2023 June - Week 26 <2023/WEEK_26.rst>
Expand Down
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
sphinx_copybutton
ghp-import
furo
sphinx
myst-parser
ghp-import
myst-parser
sphinx_copybutton
sphinx-contributors