Giter Club home page Giter Club logo

dev_snippets's Introduction

Build Status

dev_snippets

  • serialization:

    • Generic serialization of a Python object to a string, with filtering on null value
    • Deserialize a python dict (<-> serialized string json.load, see test_json_to_object_to_json in test_model) to a python class
    • In src/model.py we are checking if we could have simplified the code proposed in this same class
    • Usage run tests in tests folder, it is described in run tests section.
  • decorators:

    • Understand decorators
  • mulithread:

    • Show advantage of using parallel map to parallelize http calls
  • misc

  • systemd:

    • Show usage of system
  • pipeline

    • Show usage of pipeline

Run python tests

They are in test folder. We can configure Pycharm or use Docker

Pycharm

Configuring Pycharm (in same menu can install without pipenv if issues):

  • Press Ctrl+Alt+S to open the project Settings/Preferences
  • In the Settings/Preferences dialog Ctrl+Alt+S, select Project | Project Interpreter.
  • Click the The Configure project interpreter icon and select Add.
  • In the left-hand pane of this dialog, click Pipenv Environment.
  • test OK

Docker

cd <project> # serialization
docker build .

Note on python import

from serialization.model import Model

In pycharm initial setup it proposed

from serialization.serialization import Model

But it would not work with docker (even if copy serialization top folder, cf. multithread where we did it).

Sometimes Pycharm complains by adding yellow in import line, in other project work with moudle, Pycharm behavior is strange

For instance, multithread client:

from chrono.chrono import with_chrono # <- work in docker, work with pycharm but flagged as red
from multithread.chrono.chrono import with_chrono #  <- does not work in docker, work with pycharm

In pycharm ensure template in unittest is correct (close to run > arrow), edit configuration so that we use script path and not module name. And working directory is C:\[...]\dev_snippets\serialization same as docker one. And add content and source root to Python path. Similar in multithread readme.

Docker may require to update pipfile.

Build all snippets with compose (for CI)

# at project root
docker-compose up #(--build)

Activate the repo here: https://travis-ci.org/account/repositories

Remove file from history

# https://myopswork.com/how-remove-files-completely-from-git-repository-history-47ed3e0c4c35
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch README.md" HEAD

See also repo mgmt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.