Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 0c5dd4308977e2f9b6d118fc8053bc5c666359b4
Author: hhw <[email protected]>
Date:   Thu Jan 23 17:40:47 2025 +0800

    update pythonlibs: pip/conda...

commit a3687ebd5ac7e58bbd9be80bdadec5a0b24d53a7
Author: hhw <[email protected]>
Date:   Wed Jan 22 21:59:04 2025 +0800

    1.update LearnDrones; 2. update Misc: Links, DebuggingBook, Markdown, Github, PythonLibs etc.

commit d850dea
Author: hhw <[email protected]>
Date:   Fri Jan 17 22:00:19 2025 +0800

    1. update git.md; 2. add learn 20th cpc national congress

commit 3e234d0
Author: hhw <[email protected]>
Date:   Tue Jan 14 00:24:51 2025 +0800

    bedtime commit, update MDsim, Links, Markdown

commit e2c7b01
Author: hhw <[email protected]>
Date:   Mon Jan 13 01:41:35 2025 +0800

    bedtime commit

delete LearnConda
  • Loading branch information
houhuawei23 committed Jan 23, 2025
1 parent 10dd65b commit 0a56b6b
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 94 deletions.
79 changes: 0 additions & 79 deletions Learn/LearnConda/ChangeBaseEnv.md

This file was deleted.

14 changes: 0 additions & 14 deletions Learn/LearnConda/Conda.md

This file was deleted.

15 changes: 15 additions & 0 deletions Misc/00_Misc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Misc

- code2prompt
- batcat: replacement of `cat`
- eza: replacemetn of `ls`
- starship: The minimal, blazing-fast, and infinitely customizable prompt for any shell!
- genact: A nonsense activity generator
- czkawka: Multi functional app to find duplicates, empty folders, similar images etc.
- Yazi - ⚡️ Blazing Fast Terminal File Manager
- `cargo install --locked yazi-fm yazi-cli`
- need: Überzug++ is a command line utility written in C++ which allows to draw images on terminals by using X11/wayland child windows, sixels, kitty and iterm2..
- [quick-start](https://yazi-rs.github.io/docs/quick-start)
- superfile: Pretty fancy and modern terminal file manager
- cmd-wrapped: A CLI to view your shell history stats, with support for zsh, bash, fish, and atuin.
- `cargo install cmd-wrapped`
129 changes: 128 additions & 1 deletion PythonLibs/PythonLibs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,134 @@

## Misc

- pypi tuna source: `https://pypi.tuna.tsinghua.edu.cn/simple`
- [tuna help](https://mirrors.tuna.tsinghua.edu.cn/help/pypi/)
- anaconda:
- [tuna help](https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/)

## Misc

### Pip

```bash
# all install pkgs
pip freeze > requirements.txt
# only pkgs used in project
pip install pipreqs
pipreqs path/to/your/project

pip install -r requirements.txt
```

### [Conda](https://anaconda.org/anaconda/conda)

- OS-agnostic, system-level binary package and environment manager.
- 与操作系统无关的系统级二进制包和环境管理器。

- [github: conda](https://github.com/conda/conda)
- [docs](https://docs.conda.io/en/latest/)

Conda is an open source package management system and environment management system for installing multiple versions of software packages and their dependencies and switching easily between them. It works on Linux, OS X and Windows, and was created for Python programs but can package and distribute any software.

Conda 是一个开源包管理系统和环境管理系统,用于安装多个版本的软件包及其依赖项,并在它们之间轻松切换。它适用于 Linux、OS X 和 Windows,是为 Python 程序创建的,但可以打包和分发任何软件。

```bash
# list/update/install/remove/search

conda list
conda list numpy

conda update --all

conda install numpy

# create env
conda create -n env_name list_of_packages

# list envs
conda env list

# activate/deactivate
conda activate/deactivate env_name

# check config info
conda config --show

# change source
conda config --set custom_channels.auto https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
# export
conda env export > environment.yml

# close auto activate
conda config --set auto_activate_base false
```

```bash
# add to tuna source
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

# recover default source
conda config --remove-key channels
```

conda 设置环境变量 [doc](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#saving-environment-variables)

```bash
cd $CONDA_PREFIX
mkdir -p ./etc/conda/activate.d
mkdir -p ./etc/conda/deactivate.d
touch ./etc/conda/activate.d/env_vars.sh
touch ./etc/conda/deactivate.d/env_vars.sh
```

#### [Miniconda](https://docs.anaconda.com/miniconda/)

Miniconda 是 Anaconda Distribution 的免费微型安装,其中仅包括 conda、Python、它们都依赖的包以及少量其他有用的包。

如果您需要更多软件包,请使用命令 `conda install` 从 Anaconda 的公共存储库中默认可用的数千个软件包中安装,或者从 `conda-forge``bioconda` 等其他 channels 进行安装。

### ipython

```bash
# in vscode, ipython extension need ipykernel (manual install):
conda install -n {your_env_name} ipykernel --update-deps --force-reinstall
```

### Module Dependency Check

- `pipdeptree`
- [`pydeps`](https://github.com/thebjorn/pydeps): Python Module Dependency graphs
- `pydeps xxx.py`

```bash
# show all packages installed
pip list
conda list

# show package details
pip show numpy
conda list numpy

# upgrade package
pip install --upgrade pyarrow
# rebuild dependencies
pip uninstall pyarrow
pip install pyarrow --no-binary pyarrow # Force recompile

# use pipdeptree to visualize the dep tree
pip install pipdeptree
pipdeptree # show all dependencies
pipdeptree --packages pyarrow # only show pyarrow
pipdeptree --reverse --packages pyarrow # show who dep on pyarrow


```

### [Pylint](https://pylint.pycqa.org/en/latest/index.html): Static Code Analyser

Additional tools in pylint
Expand All @@ -20,4 +148,3 @@ pyreverse marko
01_Misc dot -Tsvg classes.dot > classes.svg
01_Misc dot -Tsvg packages.dot > packages.svg
```

0 comments on commit 0a56b6b

Please sign in to comment.