-
Notifications
You must be signed in to change notification settings - Fork 2
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
Packaging #5
base: master
Are you sure you want to change the base?
Packaging #5
Conversation
A quick test that the console is running:
A more comprehensive test is to run the walking ant:
Also, "full-parsley-grammar.txt" was intended for documentation purposes, so belongs under docs/ not semantic_db/ |
Okay thanks, I'll move it there now, I thought it was configuration for parsley as I hadn't looked into the file and parsley at all. |
It occurred to me that there might be issues with moving sdb-console to semantic-db/main.py, and being able to invoke from anywhere. Where would the graph-examples, sw-examples and console history go? Also, in the old github repo we had a bunch of scripts that also used the code.py backend. See: https://github.com/GarryMorrison/Feynman-knowledge-engine/tree/master/create-sw-file-tools |
We could store the users history in the home directory of the user, the same way Do tell me what you think and whether you have any suggestions. |
I don't like the idea of putting console history in the home dir like .bash_history does. Eg, I'm mostly on cygwin, and putting them in home dir would be a long way from where I work on the console. In my opinion, graph-examples, and sw-examples should be in essentially the same spot. Something else to consider is that the console has a 'cd' function, that changes the default location for loading and saving sw files. So I'm not certain about what to do. Options:
And if we did (2), I would probably get lazy and write a wrapper:
which kind of defeats the purpose. Would it be too ugly to do:
create-sw-files tools are indeed for converting other data formats to sw. Not that I have written any in a long time. |
I actually really like the idea of moving them to a resources folder (we could shorten it to What we could do alternatively, for |
To be honest, I only moved |
If we use 'resources' I think we should spell the full word, since 'res' isn't clear what it means.
At a stretch, console-history could be considered an example? But yeah, we should probably ship with an empty console history, unless we want to include some toy illustrative examples in there? Also, currently console history is save only, so you need to be on the command line to look things up. Going forward, maybe we can get the console to load the last x lines from it, and pre-populate the console history. That should be pretty easy to implement. |
As for sdb-console.py vs main.py I am currently torn. I need some time to think and work out my preference. |
Regarding the console history as examples, how feasible do you think it is to be able to run a script using the console like so: python3 sdb-console.py some-example-script That way we could shift from the examples being in the console history, to the examples being in a shell script. Now I haven't looked into these specific examples, so I don't know how suitable they would be as scripts, but do let me know what you think. |
yeah, I like that idea! Also, we should allow multiple scripts to be run at once (note that the order matters).
And we have two options at the completion of the scripts. Either return to the command line, or remain in the console. I currently think it should be the console. That shouldn't be too hard to implement. I'll take a look tomorrow. It is approaching my bed time right now. So we will have these options at invoke time:
So run scripts in info mode, debug mode, or silent mode respectively. Not sure if going forward we want other command line options.... |
Alright lovely, we could put the scripts in |
Okay, I'm gonna use this PR (Pull Request) to get packaging setup. I'll open another PR for code organisation, separation, refactoring etc. |
What I can't seems to decide right now, is whether I should put INSTALL.md under docs, or whether I should leave it outside for visibility / discoverability. What do you think I should do? |
The file is still under __main__.py, and currently, the hardcoded paths for the examples have not been corrected. These will be corrected in a future commit
Gonna turn in for tonight, hopefully I'll be able to finish this PR tomorrow morning before work. |
I think INSTALL.md should be outside for visibility, along with its brothers LICENSE and README. |
Also, 'semantic_db' vs 'semantic-db' for our directory name. I kind of prefer dash over underscore. What do you think? |
Also, in install instructions for graphviz, I think you should mention you need to manually add the graphviz binary to your path. I know a pain right! |
Well the pythonic way seems to be underscores for package names according to PEP8, but honestly, I feel a dash would be better, although I didn't want to bring it up. So it's your choice, you can either do it pythonically or (IMO) a bit more elegantly. Ohh yeah graphviz, I'll get that done in a bit. Aren't there any python only alternatives to graphviz? Or is there too much code to make porting feasible? |
Also @GarryMorrison, have you decided on whether we're keeping |
Can we specify examples/ and docs/ using pip?
And if not specified, then don't install examples and or docs. Yup, looks possible, using --install-option:
|
Could we separate the examples from the code? That way we can have a git repository for the examples and/or docs, that the user could clone wherever he wants, and we don't have to write and maintain a more complicated setup system (We have to consider uninstalling the files, which will necessitate inelegant code). |
Update with upstream changes
Not my preference. I'm still in favour of the --install-option approach. And as for uninstalling, if someone chose to install examples/docs and they decided the location (they can of course use something other than $PWD), then they should be fine with manually deleting those directories if/when they uninstall. If you really want we can include an UNINSTALL file. I don't see how manually deleting the examples/docs is any different than if we had separate repo for examples/docs. We just need to spend a little effort on writing the appropriate setup.py. |
Okay fine, I'll throw something together for this. |
thanks :) |
Okay this looks impossible to me, I'll explain why. I also tried conda, flit and pbr, and since all of them are based on setuptools, they have the same or similar limitations. |
well, that's annoying. Hrmm... seems to work for me:
Or am I missing something key here? |
Wait a second, do you mean you just run that and it installs examples and docs to the PWD? |
Check your email. I updated the setup.py, and in testing on my linux box it seems to do what we want. |
now we can specify install directories for examples and docs at pip install time.
at some stage we need to tidy up the print statements inside setup.py too. |
I can tidy them up for you, but I've hit a snag. The way pypi works, it tries to automatically build wheels for all packages uploaded to it, and when I manually build a wheel and try to pip install it, it doesn't recognize |
So do you want to go with wheels? or do you want to go with install time directory creation? |
I don't know how pypi works, or wheels for that matter. Though would be kind of useless without examples..... |
We can do that if you want, I have no problems with it really. The way I've seen other projects do it though is to have a separate git repo for examples, or just leave examples in the root directory really. The way you have it set up currently works as a mixed approach. I'll clean up the prints now. One more thing, the examples/sw directory is important because currently, thats where sw files are loaded from. I think we should reimplement |
As for examples/sw/ dir and loading, my thoughts was we put a config file in .sdb/config in users home dir. And we save the sw/ graph/ dirs given to setup.py in that config file. And if we don't have a config file, or those directories are not specified in it, we default to files in the current directory. And we have a bunch of other settings in the shell that would benefit from a config file. Like history length, where/if we save shell history etc. Hrm... maybe you are right. Maybe current dir is way to go. It does mean things like 'ls' and 'cd' in the shell become kind of pointless. And it will also mean our .sw .dot and .png will be all in the same directory. Maybe that is not an issue either? Hrm... we have a web-load function, so why not a web-files function in the shell?
We just need to be sure there are no security issues from loading remote sw files. |
We can still separate files into directories and do a |
now just needs testing
Wait a second, can you explain to me what exactly create_index is supposed to do? Cause when I run, it just creates an index.html with "Some sample sw files." for me. |
You invoke with:
And it spits out an index.html and a sw-index.txt file that you upload to your host along with your sw files. See here for example:
sw-index.txt is the backend web-files uses, if that doesn't exist it looks for .sw and .swc links in the html page instead. |
Ahh alright, so it's for the server side of things for web load, right? |
|
Alright, so is there anything else left for us to do before we merge? (I'll resolve the merge conflicts soon, besides that I mean) |
Maybe we should finish config-file branch first, agree on that, merge that in. Then look at merging this one in? As for pypi I will have to go create an account and so on. |
Alright fine, I'm working on the |
This reverts commit 55b076e. Accidentally commited to the wrong branch
Packaging:
semantic_db