Kicad_common.json and portability/sharability

For dealing with clients, in some cases it seems like you may not need libraries at all (after all, symbols/footprints are stored as copies in the design files).

But still, for all these cases, I don’t think the right answer is for you to continually reconfigure KiCad’s built-in libraries (by changing environment variables around). The right answer in my opinion is to convert these projects to use project-specific libraries if you need to edit the libraries, or simply ignore the issue if you don’t need to edit the libraries.

It seems like you have a system worked out that works for you, but you also started this thread because you are running into friction. My message is just that I think you are running into friction because you’re trying to work in a way that is not really supported or advised.

The difference is, I don’t refer to these libraries in projects and I don’t set up environment variables pointing to them.

Why do you need to download them? Either you don’t need to modify the library symbols, or you can modify them in-place, or you can export the symbols/footprints from the design files into a new library and modify that. You don’t need to have a complete copy of someone else’s libraries in order to work on designs that they made.

Wasn’t that a v6 change? I recall this not always being the case. Do they also store 3d models?

If every client I had was just a one-off project, I’d agree with you, but I don’t want to fix their libraries with every project I do for them, so I’d rather I just fixed them for them, so next time they come to me they have the updated ones. Git makes this super easy, but not everyone uses it. If they don’t then I just download the whole thing and send it back to them.

I realize that, but what I propose with a project-specific config file that can be sourced is the way its done in any other development framework I’ve used. I can only speak for the platforms I develop on, but the problems we’re discussing here are (some of) the reasons why C developers use CMake, python developers use virtualenv, and Android devs use Gradle. This is a major motivator for Docker and Singularity as well. Isolating dependencies to a specific project rather than having everything system-wide is a very important part of repeatable development. Having the ability to treat KiCAD development with the same level of repeatability/stability is a HUGE advantage over the industry standard alternatives (Altium, etc.). The text based source files (as opposed to binary like Altium) in KiCAD and the ability to use it with git is one of the major reasons I use it.

Then how do you use them?

Yes, it was a V6 change, but we’re now halfway through V7 so not a super recent change at this point. No, 3D models are not included yet, but 3D models can be referenced through relative paths at least. In the future it will be possible to store 3D models inside boards, so that no libraries will be required for portable 3D model viewing/exporting.

KiCad already supports project-specific library configs, though. Using these, you can have an isolated, project-specific configuration, and if these project-specific library tables are pointing at footprint libraries that use relative-pathed 3D models, you also can have portable 3D models without requiring environment variables to be set up. The only thing it doesn’t support is project-specific overrides of the global libraries, which is what you see to be looking for.

If we are talking about making edits to the KiCad official libraries, I just open the read/write copies in the library editor.

For repeat clients, why not take the time to set them up with a custom library setup that only includes any library parts that are actually customized for them, rather than a library based on the KiCad standard library that ends up being 6GB?

1 Like

No, but Murphy’s Law still tells me I’ll still have a few projects that use < v6 :D. I started this workflow sometime back in v4 from what I recall, so I’ll keep my backward compatibility for now.

Good to know! I think this is all great, for its own reasons, but for the reasons I mentioned before I don’t like the idea that I’m working on a copy of someone’s work rather than contributing to bettering their libraries. This kind of mindset is what really turned me away from Altium and the like where you’re exporting projects to share, and hundreds of duplicate copies are floating all over the place.

I think I’m confused. Can you walk me through when you’d do this and for what? You’re not modifying the official libraries? If not, and you have another copy somewhere, don’t you have to reference it somehow via a environmental variable defined in kicad_common.json?

Because they don’t pay me to fix ALL their customized parts, nor do I have the time. :slight_smile: If a project I’m working on uses say 50 parts, and only 3 need revisions, its a big stretch to ask me to review every customized part when I can just fix three, contribute to their revisions, and keep moving. They might have hundreds or thousands of customized parts. Its the difference between me understanding the entire KiCAD source vs adding a new part to a existing library. Its quite a bit difference, and I definitely am nowhere close to understanding all of the former :smiley:

Say I wanted to modify something in the official library Connector. I’d make a clone of the git repository, start a new branch, and then add the Connector library with a different nickname to my global library table. I wouldn’t bother setting up an environment variable prefix for the path to this library, since I only need this on one machine, so the full path to the copy of the library would sit in my global library table. No variables involved. I would not place this modified symbol into a design; I’d only use it for proposing a change to the official library. If I wanted to place it into a design, I’d first copy it into a project-specific symbol library, or into a private shared library (i.e. one that is used across many projects, but is not based on the upstream KiCad official library repo)

Anyway, for your particular workflow, I have no further suggestions if you don’t want to change your workflow. If you want to be editing the client’s libraries, rather than editing a copy of them, and that client has improperly configured KiCad so that their working (editable) libraries are the global KiCad stock libraries, there is no good way to handle that other than advising the client that they should fix their setup.

In an ideal world, yes this would be the perfect workflow and everyone of my clients would use git and just fetch the updates :smiley: , and I wish I could take the time to meet the standards for every custom part I make, but I rarely have time for this (yes a weak excuse). Also PRs can take months/years sometimes, so waiting to use it isn’t always an option.

To each their own. If that works well for you, then great. It too closely resembles what I didn’t like about the Altium way of doing things though. So what happens when your changes get merged into the official library repo? Do you keep track of them all and go back and reference the official repo versions or keep using the ones in your project-specific library or private shared library? You now have two diverging copies to maintain, and that divergence only grows with each project. Sounds tedious and messy to me, but maybe you have a good system of dealing with all this.

Since I haven’t tried to edit them in quite some time, I’m curious what are the write permissions on the core libraries these days? Are they installed with read-only by default? Was this always the case? Maybe I’m just dealing with something that less and less people will do on accident nowadays?

They should be read-only by default, but this wasn’t always the case on all platforms.

1 Like

This thread is long I didn’t read it all but…

I use to work with multiple computers/OS with the same project. I never have to configure an environment variable for Kicad. I also work with others and also using git.

The core (read-only) library is the default for everyone. They should just have the initial library setup using the Default Kicad Libraries.

After that, I also use custom libraries per project.
Here, the only rule I have is that this library has to be inside the project, so the project will be always pre-configured to find those libraries. This library folder inside of the project can be the library itself, but it can also be a copy of the library folder, a git submodule, or a symlink to the real path library path. It doesn’t matter which one it is, this will always work. Also, the project has to have the fp-lib-table and the sym-lib-table with references to the libs that are inside the project.

This works everywhere and also on every OS including Windows.

If the real lib is outside the project, you have to share 2 things (the project and the lib) if needed (since the lib is not always needed once Kicad files are enough, except for the 3d models, I guess) and then you have to recreate the symlink if it was not created relative to the project path, and also if the used lib path doesn’t exist.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.