-
Notifications
You must be signed in to change notification settings - Fork 280
package import, installation, and data download policy - should we make a decision to install a package/make a local copy of data without the user asking? #144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
อันนี้น่าจะแก้ไขปัญหาเวลาติดตั้งโมดูลได้นะครับ จะได้ลบโค้ดติดตั้ง auto เองทิ้งครับ https://setuptools.readthedocs.io/en/latest/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies |
ถ้าย้ายโมดูลที่ต้องติดตั้งเพิ่มมาไว้ใน setup.py น่าจะได้ไหมครับ @bact |
น่าสนใจครับ ระหว่างรัน
ตอนติดตั้ง
|
ผมคิดว่าคนที่ใช้ในฝั่งผู้ใช้งานทางเว็บจากเซิฟเวอร์จะไม่รู้ว่าถูกเปลี่ยนไปใช้โค้ดส่วนอื่นที่เป็น fallback อาจจะทำให้เกิดการสับสนผลลัพธ์ต่างกันได้ครับ |
ผมลองเพิ่ม extras_require ตามนี้นะครับ
เวลาติดตั้ง ก็ใช้
เช่น
ก็จะติดตั้ง pyicu กับ artagger ให้ด้วย เพิ่มเติมจากใน requirements.txt ตรงนี้จะช่วยให้ผู้ใช้ควบคุมการติดตั้ง package ได้ - ทดสอบใน #153 ใช้การได้อยู่ครับ แต่เรื่อง data ที่ดาวน์โหลดอัตโนมัติ (เช่น thainer, thai2rom) ยังมีอยู่ครับ |
ปัญหานึงที่พบ เมื่อลองติดตั้งทุก package เพื่อที่จะ test ก็คือ ตัว CI ทั้ง Travis และ AppVeyor จะรัน job ไม่จบ เนื่องจาก job มันยาว ติดตั้งหลาย package จนเกินเวลาที่มันยอมให้ใช้ ตรงนี้ในการใช้งานจริงคงไม่เป็นปัญหา แต่จะเป็นปัญหาสำหรับการพัฒนา/ทำ test |
ผมคิดว่า ถ้าไม่คิดปัญหาเรื่องลิขสิทธิ์และสัญญาอนุญาต โมเดลอย่าง thainer, thai2rom, thai2vec ตรงนี้มีผลกับเวลาที่ใช้ในการ build เพื่อ test ในระบบ CI บน github ด้วย เพราะทุกครั้งที่ build ก็ต้องโหลดใหม่ทุกครั้ง เสียเวลาเพิ่มขึ้นมาก (ก่อนหน้านี้ไม่รู้สึกนัก เพราะ test coverage ยังไปไม่ถึงฟังก์ชันที่ใช้ข้อมูลเหล่านั้น พอตอนนี้ test ไปถึงแล้ว ทำให้แต่ละ build ใช้เวลาเป็นสิบนาที) |
ทาง @wannaphongcom มีความเห็นว่า โมเดลบางตัว 1) มีขนาดใหญ่ และ 2) มีการปรับปรุงต่อเนื่อง ทำให้อาจไม่สะดวกที่จะถูกติดตั้งมาแต่แรก ประเด็น (1) น่าจะไม่มีปัญหา ถ้าเราให้ผู้ใช้เลือกได้ว่าจะติดตั้งหรือไม่ ประเด็น (2) อาจจะพอลดจำนวนการดาวน์โหลดได้ ถ้ามีการดาวน์โหลดข้อมูลมาตรฐาน (ไม่จำเป็นต้องเป็นรุ่นใหม่ล่าสุด) ในตอนติดตั้งแพคเกจ - ทำให้ตอน test ตอนพัฒนา ก็ยังใช้โมเดลตัวเก่า (ที่มากับแพคเกจ) รันโปรแกรมได้อยู่ (ส่วนใครจะไปดาวน์โหลดรุ่นใหม่ล่าสุดเองก็ทำเพิ่มเติมได้) -- ตรงนี้อาจใช้วิธีแก้ไข setup.py ให้มีการดาวน์โหลดข้อมูลที่จำเป็น 1 ครั้งตอนติดตั้ง |
|
Will close this as parts of the problem (on extra lib imports) are solved. Will open new issue specifically on the external data loading. |
Uh oh!
There was an error while loading. Please reload this page.
Background
Currently (version 1.7.x), some pythainlp modules will install a package/packages automatically if it's not yet installed.
For example:
The mechanism may convenient and suitable for use case inside a Jupyter notebook, but may not be ideal for other use cases' environment, like running in a system that's need more control over which package should be in presented in the system.
Proposal
Remove the automatic installation.
Just import the package and let it fails if the package doesn't currently exist in the system.
Rational
The difference here is transparency.
Running code in Jupyter notebook, the user can see the code and see what's currently happening on the cell's output window.
Running code on a server, for example, it is not that visible for the user.
Files/modules that will be affected
The text was updated successfully, but these errors were encountered: