All Projects → tkat0 → Cookiecutter Pycharm Remote Docker

tkat0 / Cookiecutter Pycharm Remote Docker

Licence: apache-2.0
PyCharm project template for development in remote docker environment

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Cookiecutter Pycharm Remote Docker

Cookiecutter Django Vue
Cookiecutter Django Vue is a template for Django-Vue projects.
Stars: ✭ 462 (+1084.62%)
Mutual labels:  cookiecutter
Full Stack Fastapi Postgresql
Full stack, modern web application generator. Using FastAPI, PostgreSQL as database, Docker, automatic HTTPS and more.
Stars: ✭ 7,635 (+19476.92%)
Mutual labels:  cookiecutter
Cookiecutter
DEPRECIATED! Please use nf-core/tools instead
Stars: ✭ 18 (-53.85%)
Mutual labels:  cookiecutter
Template Python
A template for new Python libraries.
Stars: ✭ 479 (+1128.21%)
Mutual labels:  cookiecutter
Cookiecutter Flask Restful
Flask cookiecutter template for builing APIs with flask-restful, including JWT auth, cli, tests, swagger, docker and more
Stars: ✭ 556 (+1325.64%)
Mutual labels:  cookiecutter
Intellij Jvm Options Explained
Common JVM options used with Intellij and what they do
Stars: ✭ 636 (+1530.77%)
Mutual labels:  pycharm
Intellij Plugin Save Actions
Supports configurable, Eclipse like, save actions, including "organize imports", "reformat code" and "rearrange code".
Stars: ✭ 440 (+1028.21%)
Mutual labels:  pycharm
Idea One Dark Theme
One Dark theme for IntelliJ IDEA, PhpStorm, PyCharm, RubyMine, WebStorm
Stars: ✭ 971 (+2389.74%)
Mutual labels:  pycharm
Translatorx
JetBrains 系列软件汉化包 关键字: Android Studio 3.5 汉化包 CLion 2019.3 汉化包 DataGrip 2019.3 汉化包 GoLand 2019.3 汉化包 IntelliJ IDEA 2019.3 汉化包 PhpStorm 2019.3 汉化包 PyCharm 2019.3 汉化包 Rider 2019.3 汉化包 RubyMine 2019.3 汉化包 WebStorm 2019.3 汉化包
Stars: ✭ 4,856 (+12351.28%)
Mutual labels:  pycharm
Runconfigurationasaction
Provides a way to use IntelliJ run configurations as buttons
Stars: ✭ 17 (-56.41%)
Mutual labels:  pycharm
Fastapi React
🚀 Cookiecutter Template for FastAPI + React Projects. Using PostgreSQL, SQLAlchemy, and Docker
Stars: ✭ 501 (+1184.62%)
Mutual labels:  cookiecutter
Lets Plot
An open-source plotting library for statistical data.
Stars: ✭ 531 (+1261.54%)
Mutual labels:  pycharm
Mastering Pycharm Course
Course demos and handouts for Talk Python's Mastering PyCharm course
Stars: ✭ 700 (+1694.87%)
Mutual labels:  pycharm
Cookiecutter Data Science
A logical, reasonably standardized, but flexible project structure for doing and sharing data science work.
Stars: ✭ 5,271 (+13415.38%)
Mutual labels:  cookiecutter
Cookiecutter Pylibrary
Enhanced cookiecutter template for Python libraries.
Stars: ✭ 862 (+2110.26%)
Mutual labels:  cookiecutter
Full Stack
Full stack, modern web application generator. Using Flask, PostgreSQL DB, Docker, Swagger, automatic HTTPS and more.
Stars: ✭ 451 (+1056.41%)
Mutual labels:  cookiecutter
Django Rest Framework Tutorial
Django-REST-framework 基本教學 - 從無到有 DRF-Beginners-Guide 📝
Stars: ✭ 630 (+1515.38%)
Mutual labels:  pycharm
Cookiecutter Flask Pythonic
Pythonic starter boilerplate for Flask
Stars: ✭ 37 (-5.13%)
Mutual labels:  cookiecutter
Jetbrains Helper
Jetbrains helper
Stars: ✭ 33 (-15.38%)
Mutual labels:  pycharm
Imooc Django
高仿慕课网:py3.5 + Django1.10 + xadmin 搭建的在线课程教育平台
Stars: ✭ 774 (+1884.62%)
Mutual labels:  pycharm

cookiecutter-pycharm-remote-docker

PyCharm project template for development in remote docker environment using Cookiecutter

  • You can simplify PyCharm configurations every time and start development with remote docker quickly.
  • The Run/Debug configuration of Dockerfile, sample python script, unittest and sphinx document is already created.
  • nvidia-docker is supported. It will be useful in a project like Deep Learning and Computer Vision.

日本語README

Requirements

  • Cookiecutter >= 1.4 (install cookiecutter)
  • PyCharm Professional >= 2018.2
    • Docker-based interpreters is supported only in PyCharm Professional

Getting Started

Configure the Docker daemon connection settings

In order to connect to remote docker api from PyCharm, you first need to enable remote api of dockerd. This setting is set only once on the remote machine.

Please see the following article and set it up.

(Optional) Configuring for using nvidia-docker

If you want to use nvidia-docker, change the default value of docker runtime by making the following settings.

$ sudo vi /etc/docker/daemon.json
$ cat /etc/docker/daemon.json
{
    "default-runtime": "nvidia",
    "runtimes": {
        "nvidia": {
            "path": "nvidia-container-runtime",
            "runtimeArgs": []
        }
    }
}
$ sudo systemctl daemon-reload
$ sudo service docker restart
$ docker info | grep -i runtime
Runtimes: nvidia runc
Default Runtime: nvidia #=> OK !

Next, register the remote docker api in PyCharm.

  • Add new Docker configuration (e.g. Docker-remote) and set as follows.
    • This name is used later.

See Also

Generate Project

Please run cookiecutter [email protected]:tkat0/cookiecutter-pycharm-remote-docker.git

By answering some questions, project directory are automatically generated.

# Create a project from cookiecutter-pycharm-remote-docker template
$ cookiecutter [email protected]:tkat0/cookiecutter-pycharm-remote-docker.git
full_name [Your Name]: tkat0
email [Your email]: [email protected]"
project_name [project_name]: sample-project
project_slug [sample_project]:
project_short_description []: sample project
version [0.1.0]:
timezone [Asia/Tokyo]:
python_version [3.6.0]:
remote_host [remote machine ip-addr or host-name]: 192.168.0.2
remote_docker_name [Docker-remote]:
remote_uid [remote user id (result of "ssh 192.168.0.2 id -u")]:1003
remote_work_dir [remote working directory. (e.g. /home/your-name/PycharmProjects/)]:/home/tkato/PycharmProjects/
Select use_nvidia_docker:
1 - no
2 - yes
Choose from 1, 2 [1]: 2
  • python_version: python version installed with pyenv.
  • timezone: This is set to match the timezone of host and container in the remote server.
  • remote_docker_name: You should set the same name set in PyCharm in the previous section (e.g. Docker-remote).
  • remote_uid: This is set to match the file permissions of host and container in the remote server.

To change the default value, you can create a config yaml file.

# to overwrite configuration, you create config.yml
# see. https://cookiecutter.readthedocs.io/en/latest/advanced/user_config.html
$ vi ~/config.yml
$ cat ~/config.yml
default_context:
    full_name: "tkat0"
    email: "[email protected]"
    timezone: "Asia/Tokyo"
    python_version: "3.4.0"
    remote_host: "192.168.0.2"
    remote_uid: "1003"
    remote_work_dir: "/home/tkato/PycharmProjects/"
$ cookiecutter --config-file ~/config.yml [email protected]:tkat0/cookiecutter-pycharm-remote-docker.git
full_name [tkat0]:
email [[email protected]]:
project_name [project_name]:
project_slug [project_name]:
project_short_description []:
version [0.1.0]:
timezone [Asia/Tokyo]:
python_version [3.4.0]:
remote_host [192.168.0.2]:
remote_docker_name [Docker-remote]:
remote_uid [1003]:
remote_work_dir [/home/tkato/PycharmProjects/]:

Finaly, open this project directory with PyCharm.

PyCharm Settings

Configuring Synchronization with remote server

  • Open Preferences > Build, Execution, Deployment > Deployment and find remote server.
  • Enter User name and Password, click Test Connection button and confirm that you can connect.

  • To Upload repository to remote server, select project root directory, right click and click Deployment > Upload to remote

By default, changed files automatically upload. If you don't like it, open Build, Execution, Deployment > Deployment > Options and set Upload changed files automatically to the default server to Never

Build docker image on remote server

The build configuration has already been created.

  • Update docker/Dockerfile and requirements*.txt if necessary.
  • Run docker build and docker build on remote server

  • Build success

Configuring Docker as remote interpreter

  • Open Preferences > Project: {your-project-name} > Project Interpreter, click ⚙️ button and click Add.

  • Open Add Python Interpreter and enter as follows.

  • Confirm that the remote package can be load.

See Also

Run, debug and test on remote server

The sample Run/Debug Configurations are already created so you can Run/Debug immediately.

  • Run main.py

  • Run test all

  • Set breakpoint
  • Debug test all

Please copy these settings and use it for you 🎉

Build Document

Sphinx document templates and build configuration are also included. You can build Sphinx from PyCharm.

To view the document, build a web server on the remote server.

$ ssh {remote-host}
$ cd {path-to-remote-work-dir}/docs/build/html
$ python3 -m http.server 8000

Of course, you can download it by locally using Deployment function.

Login Docker Container

You can login to container on PyCharm.

Acknowledgement

I learnt a lot from the following projects when create this repository.

License

Apache 2.0 License (see LICENSE file).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].