-
Notifications
You must be signed in to change notification settings - Fork 74
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
Simplify namespaces #387
Comments
The purpose of namespaces is to protect ourselves from name conflicts in code that we don't control. We control all of nupic C++ code therefore only one namespace is needed. So, in my opinion anything more than |
So, in my opinion anything more than namespace nupic is an unnecessary
complication.
I see namespaces also as organizational feature. Ie IDE would offer only
code from imported ns,
Or see the usecases with networkapi, extras, etc
Still, some cleanup should be done ✅
…--
Marek Otahal :o)
|
Hmmm, never saw an IDE that does that. It would be nice to identify the official API boundary but namespaces don't do that for us unless we drastically change the layout of our classes. Not worth it. Much more effective to just identify the API boundary with documentation. |
adding #389 (comment)
We should validate this is true. If so, it must happen before v1.0, it'll also cause API breakage, although very simple to fix. |
This has been validated: https://discourse.numenta.org/t/python-3-pypi-community-fork-namespace/5819 This is going to be a big PR.
|
yes, but likely won't happen. I don't think we need to worry much, the conflict resolution will be very simple for any open PRs.
Do we go just with the substitution of nupic->htm, or we also proceed with the proposed simplification above?
👍
I'm not a fan of another repo renaming, but if needed be... Do other community projects use nupic.XXX, or htm.XXX? Eventually, htm.core sounds good to me.
Thanks for asking this, @dkeeney 👍 |
Most of the work is just a mass replace of nupic to htm. As for the simplification, you know I am not a fan of layers of namespaces unless there is a real need for it. Anyone using our API would have to add all of the |
that's why I've proposed the simplification. But true that I would be some more spacific that just 1 namespace "htm".
https://cppdepend.com/blog/?p=336
|
Modularity is a good thing but that is achieved by controlling who calls what. I don't see how namespaces would prevent algorithm code from calling NetworkAPI entry points without also hiding them from the user. What I would like is for our users to only need to know one namespace, and that should be |
I dont think that testing needs its own namespace, since the unit tests are not linked with the library, and there are no header files for the unit tests. The unit tests are effectively an application instead of a part of the library. This also applies to the python bindings, which the user can not link with since they have no headr files and are not included in the nupic library. |
I like the idea of simplifying namespaces, but i agree with dkeeney that the file system should be the main organizational feature, since it shows up in every include statement. Furthermore, I think that the namespaces should mirror the file system. Also, we should not hide things from the users, esp. not the connections class. |
When I finish PR #490 I will be ready to switch "nupic" namespace to "htm". This will include changing the file directory names as well....every place there is a "nupic" we change it to "htm". This will break the API big-time but this seems to be Matt's intent.
Give this some thought over the next few days. |
|
Yes, I will take care of this. |
Here are some of my thoughts about this ...
The namespace
I'd like to merge the folders "src/nupic/math/" and "src/nupic/types/" into folder "src/nupic/utils/". There does not seem to be a real distinction between a type, utility, and math.
UPDATE: Math directory was merged into utils. I'd like to clean up the python namespace too. I don't want the user to need to search through the bindings, and it's very easy to add a link from a pure python module to the bindings.
|
I would like to fold ntypes into engine so that all networkAPI files are together. |
Our nupic.cpp repository has diverged sufficiently from the Numenta's nupic.core repository that being a clone of their repository is no longer useful. Since we are making a major change to remove The advantage of doing so will be to remove the git history baggage that has accumulated. |
+1 good idea. Since you bring up this issue I checked the size of the repo: |
When PR #490 is merged to master, the next big project is to replace So, let me know when you are ready to start on this and each of us can all grab a snapshot of the nupic.cpp at the same time and start our part of this conversion.
Let me know what you think about this plan. |
Actually I think an admin can rename an existing repository. |
But do we want to keep the old history? |
No, I dont think the git history is useful. But, I want to keep the currently open issues and PR's. Maybe there is some way to squash all of the commits into one big commit, and then do a force-push to the repo? I'd try it on a test fork first... |
squashing would be a good way to do it. Yes, the open issues we want to keep. The open PR's maybe not so much. |
We probably want to keep an official snapshot of the current repository because once we start this namespace name change the NetworkAPI will no longer be API compatible. |
One thing I would like to do before we change the namespaces is to combine the |
no, what would be an advantage? This gives still some "visibility" and makes it easier to merge/review patches around.
possibly. although it adds another confusion for a switching user.
I'm ok do do whatever with Math, Math.hpp is now just dummy file, can be removed.
I like the idea of networkapi namespace, and everything needed for NetworkAPI under one folder and common namespace (this was suggestion of #183 )
I don't think this is a good idea, this repo is still a logical successor of nupic.core, what advantage would this change bring? It would break any existing forks and make PRs more difficult.
ok, but honestly, who today cares of downloading 300MB? And it's a one time event (clone) TL;DR I tried to catch up with the ongoing discussion. Can we keep this task low, "just" rename nupic namespace to htm (or what?) and do the discussed merges of ns, ... and leave the other for separate tasks? |
Yes, I agree that the nupic namespace change PR should have nothing other than the renaming of everything These other things should be separate PR's. |
Well, ok but I don't see the point of keeping it a fork of nupic.core if all of the names are intentionally different. As a side note..., is there a way to fix this so the default repository is htm_comminity repository rather than Numenta's repository when I create a new branch. If I forget to change it my pr ends up in nupic.core rather than nupic.cpp. |
Hi Breznak, Im glad your back.
Currently it contains the definition for I will submit a PR to move that to "nupic/types/Types.hpp" and delete the file Math.hpp |
maybe have Epsilon in Connections.hpp? but Types is also OK for constants |
Would you like me to add the networkapi namespace to engine and ntypes now or wait until after the nupic to htm rename? |
You should probably go ahead and do it now. Renaming the namespace & repo can be the last thing we do before we release it. I don't think there will ever be a convenient time when there are no open PRs, so it should not hold up other necessary tasks. In the next day or two I will submit PR's to remove the following namespaces, unless there are any objections:
All of these things will be dumped into namespace EDIT, also remove
|
Hmmm, if all of these are being dumped into namespace nupic, then I should leave all of networkAPI in the nupic namespace also. |
For the nupic to htm name switch I am proposing the following script be ran from the top directory:
I am doing a trial run now to see if this builds correctly. But before we can run this for real, all currently open projects should be completed and merged to master. Git might be able to figure out the file name changes but this avoids problems if there should be conflicts in PR's started before the name switch. |
There is one more name switch related thing....In the top of every source file is the copyright notice, starting with |
I missed one rename in the proposed script: |
I don't think this would work, we don't want, need to replace all NuPIC (implementation, "community") for HTM (theory), just the |
Yes I think that is the point. If I understand correctly, what @rhyolight is looking for is a complete break. |
hmm..is that the case? i think NuPIC stands for Numenta's (community) & platform for intelligent computing (HTM): "Numenta Platform for Intelligent Computing is an implementation of Hierarchical Temporal Memory (HTM), a theory of intelligence based strictly on the neuroscience of the neocortex" ie the whole time I was talking about nupic namespace (?) |
No, NuPIC does not include 'community'. It might have been the intent at one time but as I understand it, they now want the nupic name to be exclusive for Numenta's use. And they have the right to ask for that. Anyway, the script as I wrote it does not change |
@dkeeney, Also, so that we don't forget:
|
Ok, I will create the PR to do the C++ code. |
Resolved in many PR's. Great work guys! |
I'd like to propose the following namespace reorganization in order to simplify its use.
using namespace nupic;
orusing TM = nupic::TemporalMemory;
nupic::networkapi & nupic::algorithms
, because when working with these, you almost never mix the 2 layers, so the interface would be clearer.::extras
(or experimental, advanced,...)? to cleanup some of the numenta's (too public) API? Like SP: "public"::nupic
: compute, get/setXXX,...;[think of what is used in Hotgym example, what a consumer building an app uses];::extras
(getOverlaps, TM::growSynapses, probably Connections... ) [think of what a developer needs for finetuning some algorithm, developing a new alternative implementation, etc ]::internal
for stuff that is dependency, but should not be exposed to public::nupic
? //eg::nupic::networkapi
: TMRegion, while::n::networkapi::internal
: CppRegionImplTL;DR: Q1,2,3 are nit necessary to solve (now), even without them this would be an improvement
The text was updated successfully, but these errors were encountered: