Posts

Showing posts with the label Git

Build, Test, and Publish a Python Package to PyPI

Image
Before you push a release to the Python Package Index, it pays to build and test it locally so you catch problems before your users do. This guide walks through the full workflow: setting up an isolated environment, installing your package in editable mode, running the test suite, building the distribution, validating the metadata, uploading with Twine, and tagging the release in Git. (If you are starting from scratch and need to structure the package itself first, see How To Create A Python Package .) Build, Test & Publish a PyPI Package venv create + activate → Install deps + pip -e . → Test pytest -v → Build python -m build → Check twine check → Upload twine upload → Tag git tag + push Test locally and validate metadata before you ever upload to PyPI. 1. Set up an isolated environment Install the Python version you need. If your package depends on TensorFlow, use Python 3.11, since the newest releases are not always supported right away. O...

Delete files from Git repo and history

Image
Follow these steps to delete single or multiple files from your Git repository and prune it from history. You should also add the file(s) to .gitignore (Step 5) to avoid committing the same files to your repo again in the future. git  clone <repo-path> git  rm  file1 file2 git  filter-repo --force --invert-paths --path file1 git  filter-repo --force --invert-paths --path file2 nano   .gitignore   git  add  . git  commit -m  "deleted file1 file2" git  remote add origin <repo-path> git  remote -v git  push origin --force --all git  push origin --force --tags

[How To] Install Pyfhel in macOS

Image
  Tested on Intel-based (x86_64) MacBook, not tested on M1/M2 (ARM) Apple Clang does not support  -fopenmp  and  -libseal , use GCC or CLANG % git clone --recursive https://github.com/ibarrond/Pyfhel 2.a) create  requirements.txt  file "setuptools<=60.9", "wheel", "cython>=3.0.0a9", "numpy>=1.20", "cmake>=3.15", "toml>=0.10" 2.b)  % pip3 install -r requirements.txt edit  pyproject.toml Line #111 [ Afhel ] extra_compile_args {Darwin = ["-std=c++17","-O3","-fopenmp"]}, extra_link_args {Darwin = ["-fopenmp","-dynamiclib"]}, Repeat the above for [ CYTHON EXTENSIONS ]

[How To] Run MinimaxComp_degrees in macOS

Image
MinimaxComp_degrees This algorithm finds optimized degrees for comparison/max/ReLU algorithms using minimax composite polynomial on the RNS-CKKS scheme, which was proposed in https://ieeexplore.ieee.org/document/9517029 and https://eprint.iacr.org/2021/1215 . How to run on macOS using the Apple Clang compiler: 1. % brew install NTL 2. % export LIBRARY_PATH=/usr/local/lib 3. % git clone  https://github.com/eslee3209/MinimaxComp_degrees 4. % cd MinimaxComp_degrees 5. % cmake -S . -B build 6. % cd build 7. % make 8. % ./degrees Output: ------------------------------------ alpha: 20 epsilon: 0.2002716064453125e-4 mintime: 162 depth: 22 0.39825903512705770933e-4 7 13 15 15 59   This guide runs MinimaxComp_degrees on macOS, an algorithm that finds optimized polynomial degrees for comparison, max, and ReLU operations under the RNS-CKKS homomorphic encryption scheme, based on the referenced research. CKKS can only evaluate polynomials on encrypted data, so non-polyn...

[How To] Run HELR (Homomorphic Encryption Logistic Regression) in macOS

Image
HELR is a software project for performing a logistic regression training on encrypted data (Secure Logistic Regression based on Homomorphic Encryption: Design and Evaluation ( https://medinform.jmir.org/2018/2/e19/ )). Step 1: brew install GMP Step 2: brew install NTL Step 3: git clone  https://github.com/K-miran/HELR.git Step 4: cd HELR

[Solved] Install matplotlib / basemap in macOS

Image
I have been trying to import the basemap module in my python script using " from mpl_toolkits.basemap import Basemap " but with no luck! I ran into issues while installing basemap with pip. Excerpt from the error:    Installing build dependencies ... error    error :  subprocess-exited-with-error       ×   pip subprocess to install build dependencies  did not run successfully.    │  exit code:  1    ╰─>   [552 lines of output]         Ignoring numpy: markers 'python_version >= "3.10"' don't match your environment         Ignoring numpy: markers 'python_version == "2.6" or (python_version >= "3.2" and python_version <= "3.3")' don't match your environment         Ignoring cython: markers 'python_version == "3.2"' don't match your environment ... ...             note: This error ...

NTRU in python3

Image
NTRU: NTRU – Nth Degree Truncated Polynomial Ring Units (or R = Z[X] / ( X^N-1 )) NTRU is the first public-key cryptosystem not based on factorization or discrete logarithmic problems. NTRU is a lattice-based alternative to RSA and ECC and is based on the shortest vector problem in a lattice. NTRU is an open-source public-key cryptosystem that uses lattice-based cryptography to encrypt and decrypt data. It consists of two algorithms: NTRUEncrypt, which is used for encryption, and NTRUSign, which is used for digital signatures. Unlike other popular public-key cryptosystems, it is resistant to attacks using Shor's algorithm. NTRUEncrypt was patented, but it was placed in the public domain in 2017. NTRUSign is patented, but it can be used by software under the GPL. Example in Python3: % python3 --version Python 3.9.1 % pip3 install --user sympy % pip3 install --user numpy % pip3 install --user docopt

Install git-lfs in MacOS

Image
Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise. 1. Download git-lfs from  https://git-lfs.github.com/ 2. Extract tarball: $ tar zxvf git-lfs-darwin-amd64-v2.10.0.tar.gz   3. Run install script: $ sudo ./install.sh 4. Allow git-lfs app from Menu > System Preferences > Security & Privacy > allow git-lfs 5. Intsall git-lfs from git: $ git lfs install This guide installs Git Large File Storage on macOS. Git LFS replaces large files such as audio, video, datasets, and graphics with small text pointers in the repository, while the real content lives on a remote store. Keeping big binaries out of the main history keeps clones fast and the repo manageable. After installing, you run git lfs install once and then track the file types you want it to handle.

Install git on NetBSD 8.1

Image
I am running NetBSD 8.1 on Virtualbox. Use the following commands to install and configure git on NetBSD if it was not pre-installed. $ export PKG_PATH=" http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/amd64/8.1/All/ " $ su # echo $PKG_PATH # pkg_add -v pkgin # pkg_add -v git # exit $ git $ git config --global user.email "devharsh@live.in" $ git config --global user.name "Devharsh Trivedi" $ git config --global http.sslVerify false 

Install TensorFlow 1.8 on Raspberry Pi 3 Model B+ [Complete Instruction Manual 2018]

Image
sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade sudo apt-get install python-pip python-dev wget https://www.piwheels.org/simple/tensorflow/tensorflow-1.8.0-cp27-none-linux_armv7l.whl sudo pip install tensorflow-1.8.0-cp27-none-linux_armv7l.whl sudo pip uninstall mock sudo pip install mock /* Test program HelloTensor.py */ sudo pip install pillow sudo pip install lxml sudo pip install jupyter sudo pip install matplotlib sudo pip install protobuf git clone https://github.com/tensorflow/models.git cd models cd research protoc object_detection/protos/*.proto --python_out=. export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim /* If Protobuf is throwing errors: sudo apt-get install autoconf automake libtool curl make g++ unzip wget https://github.com/google/protobuf/releases/download/v3.6.0/protobuf-cpp-3.6.0.tar.gz tar -xvf protobuf-cpp-3.2.0.tar.gz cd protobuf-3.2.0 ./autogen.sh ./configure make make check sudo make install sudo ldconfig */...

Active Directory login in GitBlit

Image
What is Git? Git is a version control system that is used for software development and other version control tasks. As a distributed revision control system it is aimed at speed, data integrity, and support for distributed, non-linear workflows. Git was created by Linus Torvalds in 2005 for the development of the Linux kernel, with other kernel developers contributing to its initial development. Read more about Git: https://en.wikipedia.org/wiki/Git_(software) What is GitBlit? Gitblit is an open-source, pure Java stack for managing, viewing, and serving Git repositories. It's designed primarily as a tool for small workgroups who want to host centralized repositories. Read more about GitBlit: http://gitblit.com/