-
Notifications
You must be signed in to change notification settings - Fork 97
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
Source file organization / hierarchy #77
Comments
Hi @hildogjr,
I think that this approach will speed-up very much the process to add new distributors/softwares and results in an overall improvement of the code readability and understanding. Thanks in advance, |
@glcerone , I like I am not expert in python class and overloading, I know the general methodology for class, hierarchy and so on. I am working in this issue and you will live the most organized as possible to the community improve it. |
I pushed a new branch called The current problems with this are:
You can take a look. It's one way of reorganizing. It gives you an object-oriented approach because each distributor module is an object with encapsulated data and a consistent interface. |
The pickle_module branch is now working correctly. You can take a look at it and see how it compares to your ideas. You can add new distributors by adding a new subdirectory to the distributors directory and KiCost will access it automatically. |
I will test soon this. It did some improvements in the user experience, like warning (by coloring the cells) if the user to buy enough parts to the board quantity or not in stock of all distributor. I request a merge in the |
|
Yes, I'm getting the same error. For some reason, the setup.py is not installing the distributors directory. I'm working on it. |
Is it necessary that the A like "macro" as proposed in the answer 265 in https://stackoverflow.com/questions/1057431/loading-all-modules-in-a-folder-in-python. (To test this branch I just copied the need |
The distributor folder should be installed by setup.py as a submodule inside the kicost folder. (This is similar to what used to be done for the rs, digikey, mouser... folders.) The distributors folder and its sub-folders all have the init.py files. The installation appears correct when I install from my local directory, but not when I install from Github. |
I neglected to add the init.py file to the distributors directory. It should work now. |
Hi, |
Actually, if you compare all the corresponding functions in the digikey.py and farnell.py (for example), they are significantly different. You may be able to forge some common functions that can be customized with a few tags, but I have doubts. And I'm not sure if the effort would deliver any noticeable value to the user. Of more value to the users (I think) would be things like:
I don't have any experience at items 2 & 3 so I don't know the level of effort required to do them. |
Worked fine now, good job, just one correction that, in may opinion, is missing. This code:
in the main I think this have to go out of the main file and, in same way, be imported ( And the definitions About (2) and (3), would be new files in the What you think about leave the |
IMO, all that format information ought to be moved into each distributor and they can install it into the distributors data structure when the distributor module is imported. Then the function in KiCost can loop through the distributors data and apply the formatting to the spreadsheet. Yes, moving Altium to an eda_tools directory sounds like a good idea. (Python naming conventions are that modules and packages have short, lower-case names with underscores.) I guess if we do that with Altium, we will eventually have to move KiCad-specific functions to a similar directory in eda_tools, but not now. |
The pickle_module branch seems to be working as well as the master branch. I'll merge it into the master branch if that's OK with you. Then I'll move the format information into the distributor modules. |
@xesscorp , I agree (I tested too). |
I merged pickle_module into master and pushed it to Github. pickle_module is still there, but I'll remove it, eventually. |
Nice, @xesscorp. |
You're right. I've now moved the web-scraping imports and definitions into the distributor modules. SEPRTR and some other things have been removed from the distributor modules. |
I could add |
New step in the hierarchy organization @diorcety, @xesscorp (to merge with the GUI). Now:
The 1 was modified moving the |
Hi @xesscorp / @diorcety and the other of the group. Congratulations by the code organization and comments, easy to understand.
I have one propose of file (modules) organization / hierarchy that will make more easy to add other distributor (issue #76 ) and software with XML BoM (as Eagle ...).
I think in the main code directory have to be two folders
distributors
(withlocal.py
,farnel.py
,rs.py
, ...) andsoftwares
( withaltium.py
andkicad.py
, yes, moving theget_part_groups
and other function related with KiCad's xml BoM inside).In the module
import
directive we may use:To use was a generic name preceded with the module name:
See that this create more easy standard to create new module of sites and software and to people here contribute. And possible to create a external flag when kicost is called `kicost -i file.xml --distributors farnell rs" allowing create a personalized spread sheet with only the distributor that the user want.
I hope you understand. I did not do this in my pull request because is deep modification in the code structure (and all files to change the functions name) and I trying to solve the more important issues first, and this would make my code not merge with yours.
The text was updated successfully, but these errors were encountered: