Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e43b68f

Browse files
Merge pull request #97 from leapfrogtechnology/python-uptodate
just some timely update to guideline with additional tools
2 parents 2cc0205 + b39237d commit e43b68f

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

‎docs/python/environment-and-dependency.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ sidebar_label: Environment Isolation and Dependency Management
1515
- [venv](https://docs.python.org/3/tutorial/venv.html). _Inbuilt_ `python -m venv`
1616
* Use `pip` for installing packages if not using `poetry`.
1717

18-
18+
:::info
19+
Docker based containerized python can be used as well. Official images [here](https://hub.docker.com/_/python). It is better to use virtualenvs in docker as well rather than root based user.
20+
:::
1921

2022
### Dependency Management:
2123

‎docs/python/general.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ It is recommended to upgrade the package dependency whenever possible although v
1111
:::
1212

1313
* See [tools](tools.md) that can be used in development environment setup to ease your coding process.
14-
* Always use `python3` and try to stay above version `3.7`. **Latest stable** is always recommended.
14+
* Always use `python3`. **Latest stable** is always recommended. Ensure version is no older than 2 versions back. i.e. if current stable is `3.11` then use atleast `3.9`.
1515
* Indentation should always be **space** and width should always be **4**.
1616
* File size and functionality:
1717
- break files into modules if you feel they have multiple functionalities.
@@ -41,7 +41,7 @@ It is recommended to upgrade the package dependency whenever possible although v
4141
WHEN break DOESNOT HAPPEN
4242
```
4343
* Use `pathlib` for path related use case rather than `os.path`
44-
* Use type annotation or type hints when possible for type safe code. `mypy` like checker can be used.
44+
* Use type annotation or type hints for type safe code especially for newer projects. Look into [tools](tools.md) for inference checker.
4545
* `Docker` can be used for deployment. Use `python` images for [`docker`](https://hub.docker.com/_/python).
4646
* Use `generators` and `yield` instead of data structures for high streams of data.
4747
* Use `itertools`, `functools` for utilities and `collections` for data structures when needed.

‎docs/python/tools.md‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ These can be used with dependency Management
2424
### Linters:
2525
* [flake8](https://flake8.pycqa.org/en/latest/) with [plugins](https://github.com/DmytroLitvinov/awesome-flake8-extensions)
2626
* Alternative: [pylint](https://www.pylint.org)
27+
* Alternative: [ruff](https://beta.ruff.rs/docs/)
2728
* [bandit](https://bandit.readthedocs.io/en/latest/) to find common security issues. This can be used with `flake8` as a [plugin](https://pypi.org/project/flake8-bandit/)
2829

2930
### Formatters:
@@ -32,6 +33,13 @@ These can be used with dependency Management
3233
- Alternative: [yapf](https://pypi.org/project/yapf/)
3334
* [isort](https://timothycrosley.github.io/isort/) for sorting only imports in codes. This is OPTIONAL.
3435
- Alternative: [reorder-python-imports](https://github.com/asottile/reorder_python_imports) another way of sorting imports.
36+
37+
38+
### Type Inference
39+
* [mypy](http://mypy-lang.org/index.html) optional static type coding with python through annotations. from Dropbox but most famous in community.
40+
- Alternative: [pyright](https://github.com/microsoft/pyright#readme) from Microsoft. Usually available in VSCode
41+
- Alternative: [pyre](https://pyre-check.org/) from Facebook.
42+
- Alternative: [pytype](https://google.github.io/pytype/) from Google.
3543

3644
### Testing:
3745
* [pytest](https://pytest.org) with [plugins](https://docs.pytest.org/en/7.0.x/reference/plugin_list.html)
@@ -45,7 +53,8 @@ These can be used with dependency Management
4553
* [factory_boy](https://factoryboy.readthedocs.io/en/stable/index.html) for fixture generation.
4654
* [coverage](https://coverage.readthedocs.io/en/coverage-5.1/) for checking code coverage of tests.
4755
* [interrogate](https://interrogate.readthedocs.io/en/latest/) for docstring coverage check.
48-
* [mypy](http://mypy-lang.org/index.html) optional static type coding with python through annotations.
56+
57+
4958

5059
### Readings and References:
5160
* [Design Patterns](https://python-patterns.guide/)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /