• Welcome to the new COTI server. We've moved the Citizens to a new server. Please let us know in the COTI Website issue forum if you find any problems.
  • We, the systems administration staff, apologize for this unexpected outage of the boards. We have resolved the root cause of the problem and there should be no further disruptions.

New py_tools repo

Plugged the py_tools repo into Travis-CI. Just needed me to remember YAML syntax and google a bit. The ".travis.yml" file goes in the base of your repo and should be generic unless you need stuff in "requirements.txt". It even uses different versions of python to test.

I'm fixing to do major surgery on the Character class and wanted to have some CI stuff in the mix. That was also why I asked if anyone else wanted to do a team thing. We have a lot of CharGen type programs in the repo but most seem a one person thing.
 
I just committed an update to the readme.md. I was using Github Desktop for the first time and following the guide. I was expecting to be able to create a pull request in Github, but can't see my change to do so, instead I can see it as a commit so I may have messed up, sorry.

I've used Git a bit and even have my open project up, but use it infrequently enough that I forget how it works.

I hit Issue #1 with the unicode strings in names. I'm quite happy to switch to Python 3 when working on this project though.

I have world name generator code in StarBase I'd be willing to extract and add to py_tools as a utility if you're interested.

Simon Hibbs
 
Last edited:
I hit Issue #1 with the unicode strings in names. I'm quite happy to switch to Python 3 when working on this project though.

Unicode in Python 2 is... an interesting challenge. You have three choices: Assume everything is ascii (the default) and catch the unicode errors and reject that input.

Assume everything is unicode. I ended up doing this for the Trade Code processing. This means using codecs.open() to read and write files, inserting a "u" before all your internal strings to ensure they're unicode. And if you're using some third-party libraries, they may not have done all the work and you may be forced to work around them as well.

Or move to Python 3, which assumes everything is unicode by default and works out of the box that way.
 
Last edited:
Reopened the issue, I need to either purge the Unicode names from the names.db or deal with it in the code.

Can't say much on the pull request. Yes, we should, but I'm not sure if it's worth the bother just yet. We do need to figure it out though. I'm okay with the changes you made.
 
One of the big questions, if we did a project, would be Python 2 or 3. Both have value. "Modern" stuff is 2 but there's no base OS that supports it without an add-on. So we'd have to ensure a user has python 3 installed. And then which Python 3?

One reason compiled programs are useful. :)
 
I've got no problems requiring an install for using bare scripts, mainly because I don't think anyone should be doing application development or running application scripts using the OS installed Python, even if there is one.

OS installed python is an internal concern of the operating system. It's primary purpose is to run admin and utility scripts that are part of the OS, e.g. on many Linux distros the package management system uses Python. But many Python user applications require the installation of Python packages that don't come with the base OS. I just think it's risky system management to install those into the OS. What if one of them clashes with an OS installed library, or your app requires a different package version to the OS? It's asking for trouble.

For testing and little scripts like this that don't depend on any non-stdlib libraries it's not a big deal, but in general I would recommend installing your own Python package in userspace and using that.

Simon Hibbs
 
Last edited:
OK I've put together the world name generator. I forked the repo, copied it to my computer using Github Desktop, added my scripts and changes, pushed to my repo then created a pull request.

I think I got it right this time.

EDIT: I'm quite pleased with Github Desktop. I've only used the command line before and it was ok, but I had to look up how to do everything every time. Having it partially automated is pretty nice.

Simon Hibbs
 
OK I think I'm doing this right. I forked the repo, copied it to my computer using Github Desktop, added my scripts and changes, pushed to my repo then created a pull request.

I think I got it right this time.

Simon Hibbs

Cool. Today is my wife's birthday so I may get delayed in reviewing. I need to figure out how to handle the pull request myself; you're the first one! Thanks!
 
OK I've put together the world name generator. I forked the repo, copied it to my computer using Github Desktop, added my scripts and changes, pushed to my repo then created a pull request.

I think I got it right this time.

EDIT: I'm quite pleased with Github Desktop. I've only used the command line before and it was ok, but I had to look up how to do everything every time. Having it partially automated is pretty nice.

Simon Hibbs

I'm not sure I got it right. I tried to do a clone and pull request off yours but it sent me back to the main. Can you see the changes?
 
No the pull request is still active. You should just need to merge it into Master using either Merge Pull Request or Create a Merge Commit.

https://help.github.com/articles/merging-a-pull-request/

I'm sure there are good reasons why it's all so complicated :)

Currently I have a world generation script as a standalone project under Makhidkarun. I'd be quite happy to update it to Py3 and roll it into py_tools. Golan has one too though, I'll take a look.

Simon Hibbs
 
Last edited:
Check the comments in the PR, I modified the code. It still does what you designed but with argparse vice getopt. Some IRC people suggested argparse and once I figured it out I converted my code as well.
 
Check the comments in the PR, I modified the code. It still does what you designed but with argparse vice getopt. Some IRC people suggested argparse and once I figured it out I converted my code as well.

Argparse is fine, I just wanted to keep consistent with your scripts. I merged it but can't see your changes, only mine.

Sent my direct contact details by pm.

Simon
 
I used getopt 'cause I didn't know any better. :)

Just pushed a fix for the occasional "Blow up because of a UTF-8 string." Give it a test. The fix was easy once one of the smart folks showed me how. Works for Py2 and Py3.
 
Added character_tools.modify_upp() and tests. Nothing uses it yet, I need to work on the class design. Of course, I'm learning class design so this might take a bit. :)
 
Added character_tools.modify_upp() and tests. Nothing uses it yet, I need to work on the class design. Of course, I'm learning class design so this might take a bit. :)


Addendum: Also, note that as more folks use this the branching and merging ideas seem more useful. As do tests. Lots of tests!
 
Not quite sure why my brain decided O23O was a good time to wake up, but it did. Please forgive the text and code based on lack of sleep.

I started pulling the dragons from mongo and realized I had stored the UPP two different ways; as a list of ints and as a string of [0-9A-F]. Others store it as a dict.

Strings print better. Lists are positional, but don't rely on species names. Don't Vargr use Charisma or something like that where humans use Social Status? A dict requires keys and is unsorted.

Do we want to move to representing the UPP the same way? Also, the UWP will need the same decision.

Further, UWP, ships, and even biologics can break the Hexidecimal limits. Do we use pseudo-Hex and do something like convert from ASCII? If so, do we keep the letters "I" and "O" even though they are visually close to 1 and 0? Did you notice I used uppercase "O" in the time above? :CoW:

More coffee. A little more code. Then a nap. I'm working on the dragon_to_char branch, pulling stuff from MongoDB into my Character class and seeing how it works.
 
...
Further, UWP, ships, and even biologics can break the Hexidecimal limits. Do we use pseudo-Hex and do something like convert from ASCII? If so, do we keep the letters "I" and "O" even though they are visually close to 1 and 0? Did you notice I used uppercase "O" in the time above? :CoW:

I've front-burnered some pseudohex stuff I had back-burnered and added it at https://github.com/makhidkarun/ehex. It does 0-9A-Z (excluding I and O), allows for comparisons, and does addition/subtraction (within the limits - pseudo-hex has to be in the range 0 to 33). It has unit tests, the readme has some examples. I've tried to make it as low-overhead as possible. Maybe useful for UWPs etc?
 
Very cool! I'll look into that when my brain wakes up.

At the moment I've worked to add skills to the options. The more_skill_options branch uses files spacer_skills.txt and mercenary_skills.txt to give NPCs more options. There are duplicates of the skills to weight things like GunCbt for Army and Marine type characters, etc.

Eventually these skill lists will be put into classes for each career. Haven't gotten there yet.
 
Branch more_skill_options changes lib/character_tools.py to check for files with skills before defaulting to the same short lists.

Branch dragon_to_char focuses on pulling from a MongoDB datastore but also changes Character.__str__ to Character.display() due to UTF-8 printing issues.

Both pass what tests I have.
 
I've front-burnered some pseudohex stuff I had back-burnered and added it at https://github.com/makhidkarun/ehex. It does 0-9A-Z (excluding I and O), allows for comparisons, and does addition/subtraction (within the limits - pseudo-hex has to be in the range 0 to 33). It has unit tests, the readme has some examples. I've tried to make it as low-overhead as possible. Maybe useful for UWPs etc?

Coffee is slow to kick in this morning. I can run the README commands in idle but can't seem to get the tests to run with pytest or py.test. I'm pretty sure it's operator error but I'm in the main ehex directory pulled from github. Also tried from the tests directory, the ehex directory, and a virtualenv.

Since I'm a virutalenv newb, how do I test your code without installing it?
 
Back
Top