Programming/Python: Difference between revisions

From Dev Wiki
Jump to navigation Jump to search
(Add package section)
(Correct word)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{ Note | Common File Extensions: {{ ic|.py}} }}
[https://www.python.org/ Python] is a high-level, object-oriented programming language.
[https://www.python.org/ Python] is a high-level, object-oriented programming language.


The language has "dynamic semantics" and thus encourages rapid application development. It also heavily emphasizes code readability, which results in a language that emphasizes whitespace with very simple (but powerful) syntax.
The language has "dynamic semantics" and thus encourages rapid application development. It also heavily emphasizes code readability, which results in a language that emphasizes whitespace with very simple (but powerful) syntax.




Line 15: Line 19:
== Testing ==
== Testing ==
* [[Python/Testing]]
* [[Python/Testing]]
== Managing Packages ==
* [[Python/Managing Packages]]




Line 59: Line 67:
[https://github.com/hhatto/autopep8 AutoPep8]
[https://github.com/hhatto/autopep8 AutoPep8]
  autopep8                                  # Auto-formats files for pep8 recommendations. Exceptions in `setup.cfg`.
  autopep8                                  # Auto-formats files for pep8 recommendations. Exceptions in `setup.cfg`.


[https://flake8.pycqa.org/en/latest/ Flake8]
[https://flake8.pycqa.org/en/latest/ Flake8]

Latest revision as of 07:52, 21 February 2023

Note: Common File Extensions: .py


Python is a high-level, object-oriented programming language.

The language has "dynamic semantics" and thus encourages rapid application development. It also heavily emphasizes code readability, which results in a language that emphasizes whitespace with very simple (but powerful) syntax.


Setup


Syntax


Testing


Managing Packages


Related Packages and Libraries

See also Django Packages and Libraries .


Dependency & Environment Management

ToDo: Document and research actual differences and benefits/drawbacks between these two.

PipEnv - Project dependency manager for Python projects.

[Poetry] - Project dependency manager for Python projects.


Unit Testing

Pytest - Recommended tool to run Python tests.

pytest                          # Base Pytest package.
pytest-asyncio                  # Additional Pytest logic for asyncio support.
pytest-django                   # Additional Pytest logic for Django support.
pytest-subtests                 # Additional Pytest logic for improved subtest support.
pytest-xdist                    # Additional Pytest features, such as multithreading and looping.


CodeCoverage

coverage                        # Output for checking testing coverage data.


Web Development

Flask - Good for quick projects, but if building a fully qualified site, consider Django instead.

Flask                           # A lightweight web framework.


Django - A Python-based web framework, equivalent to Php's Laravel.

django                          # A Python-based web framework.


Syntax Checking

AutoPep8

autopep8                                   # Auto-formats files for pep8 recommendations. Exceptions in `setup.cfg`.


Flake8

flake8                                     # Wrapper for autopep8 that allows extra configuration, etc.


Black

black                                      # An opinionated code formater.


Pylint

pylint                                     # Linter for Python syntax. Must be run in console via "pylint" command.
pylint-django                              # Improves code analysis for Django projects.
pylint-plugin-utils                        # Additional pylint functionality for things like Django and Celery.


Utility & Other

Faker

Faker                           # Easy generation of random values for various common data types.