An all-in-one toolkit package to easy my Python work in my PhD.
Project description
PyhDToolkit: An all-in-one toolkit package for Python work in my PhD.
This repository is a package gathering a number of Python utilities for my work.
Installation
This code is compatible with Python 3.6+
.
If for some reason you have a need for it, you can simply install it in your virtual enrivonment with:
pip install pyhdtoolkit
If you intend to make some hotfix changes to the site-package, you can use pip's --editable
flag and get the last released version (from master) with:
pip install --editable git+https://github.com/fsoubelet/PyhDToolkit.git@master#egg=pyhdtoolkit
If you intend on making actual changes, then you should clone this repository through VCS, and install it into a virtual environment.
With git
, this would be:
git clone https://github.com/fsoubelet/PyhDToolkit.git
cd PyhDToolkit
make
Testing
Tests are currently a work in progress, but testing builds are ensured after each commit through Travis-CI.
You can run tests locally with:
make tests
Standards, Tools and VCS
This repository respects the reStructuredText
docstring format, uses Black as a code formatter with a default enforced line length of 120 characters, and Pylint as a linter.
You can format the code with:
make format
You can lint the code with (which will format the code first):
make lint
VCS is done through git and follows the Gitflow workflow.
As a consequence, make sure to always install from master
.
Miscellaneous
Feel free to explore the Makefile
.
You will get an idea of what functionality is available to you by running:
make help
Environment
This repository currently comes with an environment.yml
file to reproduce a fully compatible conda environment.
You can install this environment and add it to your ipython kernel by running:
make condaenv
Container
A Dockerfile is included if you want to build a container image from source.
You can do so, building with the name simenv
(and tag latest
), with the command:
make docker-build
Alternatively, you can directly pull a pre-built image from Dockerhub with:
make docker-pull
You can then run your container in interactive mode, and use the already activated conda environment for your work.
It is highly advised to run with --init
for zombie processes protection, see Tini for details.
Assuming you pulled the provided image from Dockerhub, the command is then (remove the --rm
flag if you wish to preserve it after running):
docker run -it --rm --init fsoubelet/simenv
If you want to do some exploration through a jupyter
interface then you need to tell your container to install it first, as it is not bundled in the image, then add the custom environment kernelspec.
The following command will take care of all this:
docker run -it --rm --init -p 8888:8888 fsoubelet/simenv /bin/bash -c "/opt/conda/bin/conda install -c conda-forge jupyterlab -y --quiet > /dev/null && mkdir /opt/notebooks && /opt/conda/envs/PHD/bin/ipython kernel install --user --name=PHD && /opt/conda/bin/jupyter lab --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser --allow-root"
You can then copy the provided token and head to localhost:8888
on your local machine.
There, you will have access to a kernel named PHD
with all the goodies of this repository (and more).
Beware though, none of your changes / work will be saved in the image, and re-launching it gets you a clean state everytime.
To save a file from the container (say a plot, or saved data), you can use the docker cp
command (while the container is active).
A generic use case is: docker cp <ContainerID>:/path/to/container/file /path/to/local/copy
and an example would be : docker cp fsoubelet/simenv:/some_plot_output.jpg .
License
Copyright © 2019-2020 Felix Soubelet. MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyhdtoolkit-0.3.0.tar.gz
.
File metadata
- Download URL: pyhdtoolkit-0.3.0.tar.gz
- Upload date:
- Size: 44.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2.post20191201 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c37e4a85b8b2c168576b863a7391066f7a222b2859b544cf29474ca7822e022 |
|
MD5 | 1a18a735a7d1c3107e13399c04577033 |
|
BLAKE2b-256 | 1d2e5fa048f1698758f5100b079e789e1b26e847db4d523673b9e7a9af9d9da8 |
File details
Details for the file pyhdtoolkit-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: pyhdtoolkit-0.3.0-py3-none-any.whl
- Upload date:
- Size: 52.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2.post20191201 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad6168b75ca87d17ed4da0784599e4ace105b28b2a365a96e1310f6e99d44e9d |
|
MD5 | bec1f889c2de6b993fb463ce5dd75179 |
|
BLAKE2b-256 | b607b0041b04b0e81ab3ced5e220a1c11649ecfaf901207bb8b5eca04ce2c57d |