Skip to main content

Functions and scripts to demonstrate Python development tips.

Project description

Creating virtual environment and install

With Anaconda (recommended). After installing Anaconda or Miniconda (light version), create a new environment:

# create new environment, press enter to accept
conda create -n project_env python=3.9

# view available environments
conda info --envs

# activate environment
conda activate project_env

# instal package locally
(project_env) pip install -e .

# deactivate environment
(project_env) conda deactivate

For machines really light on memory (e.g. Raspberry Pi) use Virtualenv:

# install library if not already
pip install virtualenv

# create virtual environment (creates folder called project_env)
python3 -m venv project_env

# activate virtual environment
source project_env/bin/activate

# instal package locally
(project_env) pip install -e .

# deactivate virtual environment
(project_env) deactivate

Code formatting

Through pre-commit hooks:

# inside virtual environment
(project_env) pip install pre-commit
(project_env) pip install black

# Install git hooks
(project_env) pre-commit install
# pre-commit installed at .git/hooks/pre-commit

Releasing package to PyPi

This is done through twine:

# inside virtual environment
(project_env) pip install twine

# build package
(project_env) python setup.py sdist bdist_wheel

# upload to test pypi
(project_env) twine upload --repository testpypi dist/*

# upload to pypi
(project_env) twine upload dist/*

# Create package and upload to Pypi $ python setup.py sdist $ python -m twine upload dist/pyFFS-X.X.X.tar.gz

TODO

  • matplotlib in dev install

  • profiling to compare RFFT and FFT

  • unit test to check that they are equal when signal is real

  • example file with hydra

  • pypi

  • manifest file to not include file in package

  • GitHub actions

  • documentation if time

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydevtips-0.0.1.tar.gz (3.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page