PyCon Taiwan
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # 這樣的開發環境沒問題嗎? - Tzu-ping Chung {%hackmd DR5p-QuLTwylJM8bYjJp1Q %} 投影片:https://speakerdeck.com/uranusjr/zhe-yang-de-kai-fa-huan-jing-mei-wen-ti-ma 跟90%會眾表示你們的開發環境有問題。 anaconda 不在今天的議程中,~~請不要浪費時間聽這場~~。 目標會眾環境: pip/easy_install + emacs + terminal ~~可以用jupyter寫django嗎?🙃~~ --- [The law of leaky abstractions](https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-abstractions/): 沒有包裝是完美的 本議程是很多來自 django girls 的經驗。 - pipenv核心貢獻者 (今天主題關聯) --- 這樣裝備沒有問題嗎? ~~大丈夫萌大奶~~モンダイナイ ``` Intepreters (eg. Python) -> Tools (eg. virtualenv) -> Dependencies (eg. Django) -> Application (Your stuff) ``` # bottom up 來看 ## Application 沒啥好講的跳過 ## Dependencies: virtaulenv(python3內建) ```shell $ python3 -m venv --prompt="project" .venv $ . .venv/bin/activate (project) $ pip install -r requirements.txt ``` ### 講師提及的 Dependencies 問題1: 套件版本控制 ``` # 抽象依賴:環境主要需要的套件(最少量資訊原則) requests[security] flask gunicorn==19.4.5 v.s. # 實體依賴:環境所有需要的套件 concrete dependency enum34==1.1.2 requests==2.9.1 Flask==0.10.1 six==1.10.0 ``` abstract dependency: easier to upgrade, but hard to realize what/which version will be installed concrete dependency: you have to figure out dependency yourself pyOpenSSL 安全性更新為例:抽象依賴比較好些 ### 講師提及的 Dependencies 問題2: 環境PATH virtualenv會直接改PATH。 [Virtualenv's bin/activate is Doing It Wrong](https://gist.github.com/datagrok/2199506) ## 推銷 pipenv / pipenv-cli ### 跟使用者的開法工序衝突 -> 作者正在模組化 ~~sudo pip install pipenv~~ 🤔🤔🤔🤔🤔 how to install pipenv in virtual environment? (chicken/egg) ```shell $ mkdir -p ~/.local/bin ~/.local/venvs $ python3 -m venv ~/.local/venvs/pipenv $ ~/.local/venvs/pipenv/bin/pip install pipenv $ ln -s ~/.local/venvs/pipenv/bin/pipenv ~/.local/bin ``` actually pipsi did that ,但因爲 pipsi 作者好像失去興趣進行更新了,所以推薦使用以上 script Rules of Thumb 1. Do not use sudo Ever 2. always use virtual environment 3. Use --user if desperate ## 要怎麼裝 python 1. 各位的電腦有幾個python? mac內建:2.6, 2.7, 3.3~3.5 ubuntu內建:3.6 Don't use OS built-in python ### Linux ubuntu: 1. use "deadsnakes" PPA 2. 自己編 3. try not to use apt install python 4. be careful with the package manager (every package manager installs lib in different path) ### MAC 1. ❎ **Do not use** system python 2. ❎ **Do not use** homebrew python 3. ✅ must compile your own ### Compile Your Python 1. install some build dependencies 2. pyenv install `<version>` 3. Use - `python-build 3.6.5 ~/.local/pythons/3.6` - `ln -s ~/.local/pythons/3.6 ~/.local/bin` ### Windows 1. No global Python to worry about (ha, look at you!) 2. No support from pyenv 3. Building is *drastically* more difficult (PythonUp works for Windows too!) http://vstinner.readthedocs.io/cpython_windows.html ## Tradeoff: 核心開發者社群議題:要有好用的作業系統內建python,還是系統內應該要沒有python? ## Summary * don’t use homebrew python * prefer self-compiling if possible * always use virtual environments * you can call scripts in venv directly * avoid “activate” scripts * pipfile / pipenv abstrats them * don’t use setup.py to develop a package ###### tags: `pycontw2018`

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully