{"id":19099934,"url":"https://github.com/kdcllc/CSharpToPythonLearning","last_synced_at":"2025-04-18T17:32:23.506Z","repository":{"id":188092401,"uuid":"678044436","full_name":"kdcllc/CSharpToPythonLearning","owner":"kdcllc","description":"C# Developer's Exciting Journey into Python World 🐍","archived":false,"fork":false,"pushed_at":"2024-08-02T18:51:46.000Z","size":223,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-03T21:29:50.677Z","etag":null,"topics":["csharp","pip","poetry-python","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kdcllc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["kdcllc"],"custom":["https://www.buymeacoffee.com/vyve0og"]}},"created_at":"2023-08-13T13:59:24.000Z","updated_at":"2024-08-02T18:51:48.000Z","dependencies_parsed_at":"2024-08-02T21:29:52.304Z","dependency_job_id":"a8b52a47-4f24-46af-804d-76ddb32ecdb1","html_url":"https://github.com/kdcllc/CSharpToPythonLearning","commit_stats":null,"previous_names":["kdcllc/csharp2python","kdcllc/csharptopythonlearning"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcllc%2FCSharpToPythonLearning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcllc%2FCSharpToPythonLearning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcllc%2FCSharpToPythonLearning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kdcllc%2FCSharpToPythonLearning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kdcllc","download_url":"https://codeload.github.com/kdcllc/CSharpToPythonLearning/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223783108,"owners_count":17201903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","pip","poetry-python","python","python3"],"created_at":"2024-11-09T03:52:23.918Z","updated_at":"2024-11-09T03:52:44.338Z","avatar_url":"https://github.com/kdcllc.png","language":"Jupyter Notebook","funding_links":["https://github.com/sponsors/kdcllc","https://www.buymeacoffee.com/vyve0og"],"categories":["python3","csharp"],"sub_categories":[],"readme":"# C# Developer's Exciting Journey into Python World 🐍\n\n![I stand with Israel](./images/IStandWithIsrael.png)\n\nEmbark on an exhilarating voyage as a C# developer diving headfirst into the captivating realm of Python! This GitHub repository chronicles the adventures, challenges, and triumphs of a seasoned C# developer as they navigate the exciting landscape of Python programming. From mastering Python's elegant syntax to exploring its rich ecosystem of libraries and frameworks, follow along as we uncover the synergies between these two powerful languages. Whether you're a fellow developer looking to expand your horizons or a curious learner eager to understand the nuances of Python from a C# perspective, this repository offers insightful code examples, tutorials, and resources to make your transition smooth and enjoyable. Join us on this transformative journey, where the familiarity of C# meets the versatility of Python, creating a holistic skill set that's bound to shape the future of your development endeavors. 🚀🐍 Let's code, learn, and grow together!\n## Hire me\n\nPlease send [email](mailto:kingdavidconsulting@gmail.com) if you consider to **hire me**.\n\n[![buymeacoffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/vyve0og)\n\n## Give a Star! :star\n\nIf you like or are using this project to learn or start your solution, please give it a star. Thanks!\n\n## Key Differences and Similarities Between C# and Python\n\n- **Syntax**: Python's syntax is more concise and readable compared to C#. Indentation is significant in Python.\n- **Type System**: Python is dynamically typed, whereas C# is statically typed.\n- **Memory Management**: Both languages use garbage collection, but Python's memory management is more automated.\n- **Libraries and Frameworks**: Python has a rich ecosystem of libraries for data science, web development, and more.\n\n## Advanced Topics\n\n- **Performance Optimization**: Strategies for profiling and optimizing Python code.\n- **Concurrency**: Using `asyncio`, threading, and multiprocessing in Python.\n- **Integration**: Interfacing Python with C# and other languages.\n\n## Tooling and Best Practices\n\n- **Virtual Environments**: Use `venv` or `virtualenv` to manage dependencies.\n- **Package Management**: Use `pip` for installing packages and `pipenv` or `poetry` for managing dependencies.\n- **Code Quality**: Tools like `flake8`, `pylint`, and `black` for linting and formatting.\n- **Testing**: Frameworks like `unittest`, `pytest`, and `nose` for writing tests.\n\n## VSCode Python Extensions\n\n- [Python extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=ms-python.python)\n  - Provides rich support for the Python language, including features like IntelliSense, linting, debugging, and more.\n- [Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance)\n  - A performant, feature-rich language server for Python in VSCode, offering fast IntelliSense and type checking.\n- [Ruff extension for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff)\n  - A fast Python linter, written in Rust, that integrates seamlessly with VSCode.\n- [Import sorting extension for Visual Studio Code using isort](https://marketplace.visualstudio.com/items?itemName=ms-python.isort)\n  - Automatically sorts Python imports according to PEP8 standards.\n- [IntelliCode](https://marketplace.visualstudio.com/items?itemName=VisualStudioExptTeam.vscodeintellicode)\n  - AI-assisted code completions and recommendations based on best practices from open-source projects.\n- [Error Lens](https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens)\n  - Highlights errors and warnings directly in the code, making them more visible.\n- [Indent-Rainbow](https://marketplace.visualstudio.com/items?itemName=oderwat.indent-rainbow)\n  - Adds color to indentation levels, making it easier to read and understand code structure.\n- [Mypy extension](https://marketplace.visualstudio.com/items?itemName=ms-python.mypy-type-checker)\n  - Integrates Mypy type checking into VSCode, helping to catch type errors early.\n- [Django extension](https://marketplace.visualstudio.com/items?itemName=batisteo.vscode-django)\n  - Provides support for Django development, including features like template debugging and model completion.\n- [Jinja extension](https://marketplace.visualstudio.com/items?itemName=wholroyd.jinja)\n  - Adds syntax highlighting and other features for Jinja templates.\n\n### Additional Helpful Extensions\n\n- [Python Docstring Generator](https://marketplace.visualstudio.com/items?itemName=njpwerner.autodocstring)\n  - Automatically generates docstrings for your Python functions and classes.\n- [Python Test Explorer](https://marketplace.visualstudio.com/items?itemName=LittleFoxTeam.vscode-python-test-adapter)\n  - A test explorer for running and debugging Python tests in VSCode.\n- [Python Environment Manager](https://marketplace.visualstudio.com/items?itemName=donjayamanne.python-environment-manager)\n  - Helps manage Python environments and virtual environments within VSCode.\n- [Python Snippets](https://marketplace.visualstudio.com/items?itemName=frhtylcn.pythonsnippets)\n  - Provides a collection of useful Python code snippets to speed up development.\n\n## Linux Ubuntu DevBox Setup\n\nUbuntu 22.04 comes with Python `3.10.12`.\n\n### How to Install and Manage Other Versions of Python Interpreters\n\nThe default Python interpreter is located at `/usr/bin/python3`.\n\n#### Display All Installed Dependencies\n\nTo list all installed Python dependencies, use the following command:\n\n```bash\napt list --installed | grep python\n```\n\n### Installing Multiple Versions of Python and Switching Between Them\n\n[`pyenv`](https://github.com/pyenv/pyenv) is a utility for managing multiple Python versions, similar to [`nvm`](https://github.com/nvm-sh/nvm) for Node.js.\n\nAn alternative method is to use `apt`:\n\n```bash\nsudo add-apt-repository ppa:deadsnakes/ppa\nsudo apt-get update\nsudo apt-get install python3.5\n```\n\n### Install [pyenv](https://github.com/pyenv/pyenv)\n\n#### Install Dependencies\n\nThis script installs the necessary dependencies and clones the `pyenv` repository.\n\n```bash\n# Prerequisites\nsudo apt install libedit-dev\nsudo apt uninstall python3-pip\nsudo apt-get install build-essential zlib1g-dev libffi-dev libssl-dev libbz2-dev libreadline-dev libsqlite3-dev liblzma-dev\nsudo apt-get install python-tk python3-tk tk-dev\n```\n\n#### Install `pyenv`\n\n```bash\ncurl https://pyenv.run | bash\n```\n\n#### Update `~/.bashrc` File\n\nAdd the following lines to the end of your `~/.bashrc` file to initialize `pyenv`:\n\n```bash\nexport PYENV_ROOT=\"$HOME/.pyenv\"\n[[ -d $PYENV_ROOT/bin ]] \u0026\u0026 export PATH=\"$PYENV_ROOT/bin:$PATH\"\neval \"$(pyenv init -)\"\n\n# Build Location\nexport TMPDIR=\"$HOME/.pyenv-tmp\"\n\n# Load Virtualenv\n# Load pyenv-virtualenv automatically by adding\n# the following to ~/.bashrc:\neval \"$(pyenv virtualenv-init -)\"\n```\n\n#### Install the Latest Version of Python\n\n```bash\npyenv install --list | grep \" 3\\.[12]\"\n\n# Downloads and builds the specified version\npyenv install 3.12.3\n\n# List installed versions\npyenv versions\n\n# Set global Python version\npyenv global 3.12.3\n```\n\n![env](images/pyenv-python-version.png)\n\n[pyenv-virtualenv](https://github.com/pyenv/pyenv-virtualenv)\n\n### Install Aider or Poetry Virtual Environments\n\nOnce you have multiple Python versions running, you may need to set up global dependencies for your projects.\n\n#### Aider\n\n[aider](https://github.com/paul-gauthier/aider) is a tool for managing virtual environments.\n\n```bash\n# Create an environment\npyenv virtualenv 3.12.3 aider\n\n# Display newly created environment\npyenv versions\n\n# Activate the environment\npyenv activate aider\n\n# Deactivate the environment\npyenv deactivate\n\n# Install aider\npip install aider-chat\n\n# Display the number of installed packages\npip freeze | wc -l\n```\n\nBy default, auto-commit changes are enabled. To override the default, add the following line to your `~/.bashrc` file:\n\n```bash\nexport AIDER_AUTO_COMMITS=0\n```\n\nTo add this automatically from a bash command, you can use the following script:\n\n```bash\necho 'export AIDER_AUTO_COMMITS=0' \u003e\u003e ~/.bashrc\nsource ~/.bashrc\n```\n\n```bash\n#OLLAMA_API_BASE=http://localhost:11434/\n\n# https://aider.chat/docs/llms.html#azure\n# aider --model azure/gpt-4-32k --no-auto-commits\n\nAZURE_API_KEY=\nAZURE_API_VERSION=\nAZURE_API_BASE=\n\n\n# https://github.com/paul-gauthier/aider/issues/596\n\n# https://aider.chat/docs/llms.html#ollama\n# export OLLAMA_API_BASE=http://127.0.0.1:11434\n# aider --model ollama/mistral:latest\n# aider --model ollama/codellama:7b --no-auto-commits\n```\n#### Poetry\n\n[Poetry](https://python-poetry.org/) is another tool for dependency management and packaging in Python.\n\n```bash\n# Create an environment\npyenv virtualenv 3.12.3 poetry\n\n# Display newly created environment\npyenv versions\n\n# Activate the environment\npyenv activate poetry\n\n# Deactivate the environment\npyenv deactivate\n\n# Install Poetry\ncurl -sSL https://install.python-poetry.org | python -\n\n# Configure Poetry to create virtual environments inside the project directory\npoetry config virtualenvs.in-project true\n\n# Create a new Poetry project\npoetry new my-project\n\n# Navigate to the project directory\ncd my-project\n\n# Add dependencies\npoetry add requests\n\n# Activate the virtual environment\npoetry shell\n\n# Deactivate the virtual environment\nexit\n```\n\n### Additional Useful Commands\n\n#### Updating Python Packages\n\nTo update all installed Python packages, use the following command:\n\n```bash\npip list --outdated | grep -v '^\\-e' | cut -d ' ' -f1 | xargs -n1 pip install -U\n```\n\n#### Uninstalling Python Packages\n\nTo uninstall a Python package, use the following command:\n\n```bash\npip uninstall \u003cpackage_name\u003e\n```\n\n#### Creating and Managing Virtual Environments with `venv`\n\nTo create a virtual environment using `venv`, use the following command:\n\n```bash\npython3 -m venv myenv\n```\n\nTo activate the virtual environment:\n\n```bash\nsource myenv/bin/activate\n```\n\nTo deactivate the virtual environment:\n\n```bash\ndeactivate\n```\n\n#### Checking Python Version\n\nTo check the current Python version, use the following command:\n\n```bash\npython --version\n```\n\n#### Basic Git Commands\n\nTo initialize a new Git repository:\n\n```bash\ngit init\n```\n\nTo clone an existing repository:\n\n```bash\ngit clone \u003crepository_url\u003e\n```\n\nTo check the status of your repository:\n\n```bash\ngit status\n```\n\nTo add changes to the staging area:\n\n```bash\ngit add \u003cfile_name\u003e\n```\n\nTo commit changes:\n\n```bash\ngit commit -m \"Your commit message\"\n```\n\nTo push changes to a remote repository:\n\n```bash\ngit push origin \u003cbranch_name\u003e\n```\n\n## Resources\n\n- [CPython internals - Interpreter and source code overview](https://www.youtube.com/watch?v=LhadeL7_EIU\u0026list=PLzV58Zm8FuBL6OAv1Yu6AwXZrnsFbbR0S)\n- [Language syntax specific practices](./practices)\n- [VSCode python specific extensions](vscode-python-extensions.md)\n- [Python3 dependencies and package management](./deps-management)\n- [Python3 and databases](./databases)\n- [Python3 and Azure Development](./azure/)\n\n\n\n## Questions\n\n1. **How do I choose the right Python version for my project?**\n\n    - Understanding which Python version suits your project's requirements is crucial. Are you using Python 2.x or Python 3.x? How do you make the choice?\n2. **What are virtual environments, and why should I use them?**\n\n    - Exploring the concept of virtual environments to isolate project dependencies and avoid version conflicts. How do you create and manage virtual environments in Python?\n3. **How can I effectively manage project dependencies?**\n\n    - Discussing package management tools like pip and exploring methods for defining and maintaining project dependencies.\n4. **What's the best way to handle configuration settings in Python projects?**\n\n    - Strategies for managing configuration settings, such as using configuration files or environment variables.\n5. **How do I write clean and maintainable code in Python?**\n\n    - Best practices for Python code formatting, naming conventions, and code organization to enhance readability and maintainability.\n6. **What's the role of documentation in Python development?**\n\n    - The importance of documentation, including docstrings, comments, and generating documentation for your code using tools like Sphinx.\n7. **How do I implement error handling and debugging in Python?**\n\n    - Techniques for handling exceptions, logging, and debugging to ensure robust and bug-free code.\n8. **What are Pythonic coding practices, and why are they essential?**\n\n    - Understanding Pythonic coding principles, which emphasize readability and simplicity. How to write idiomatic Python code?\n9. **What are the different testing frameworks available for Python, and how do I write effective tests?**\n\n    - Exploring testing frameworks like unittest, pytest, and nose, and learning how to create comprehensive test suites.\n10. **How do I integrate version control into my Python project?**\n\n    - Setting up and using version control systems like Git to track changes, collaborate with a team, and manage project history.\n11. **How can I optimize the performance of my Python application?**\n\n    - Strategies for profiling and optimizing Python code, including identifying bottlenecks and implementing performance enhancements.\n12. **What are the security considerations when developing with Python?**\n\n    - Addressing security concerns such as input validation, handling sensitive data, and protecting against common vulnerabilities.\n13. **How do I handle data storage and databases in Python projects?**\n\n    - Discussing options for working with databases, including using SQLite, PostgreSQL, or other database systems, as well as ORM (Object-Relational Mapping) libraries.\n14. **What steps are involved in deploying a Python application to a production environment?**\n\n    - The process of preparing and deploying a Python application to a production server, including considerations for scalability and reliability.\n15. **How can I keep my Python project up-to-date and maintainable over time?**\n\n    - Strategies for continuous integration and continuous deployment (CI/CD), code review, and long-term project maintenance.\n\nThese questions cover various aspects of the software development process with Python, helping programmers gain a comprehensive understanding of how to create robust, maintainable, and efficient Python applications.\n\n## Additional Resources\n\n- [`python` documentation](https://docs.python.org/3/)\n- [`pip` documentation](https://pip.pypa.io/en/stable/)\n- [`setuptools` documentation](https://setuptools.pypa.io/en/latest/userguide/quickstart.html)\n- [`pyenv` documentation](https://github.com/pyenv/pyenv)\n- [Programming For Everybody](https://online.dr-chuck.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdcllc%2FCSharpToPythonLearning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdcllc%2FCSharpToPythonLearning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdcllc%2FCSharpToPythonLearning/lists"}