Git Product home page Git Product logo

pykan's Introduction

pyKAN

PyKAN is a pure python alternative client for the CKAN utility to manage modules for Kerbal Space Program. It uses the original upstream CKAN data and repos directly and does not fragment the module repositories, it merely provides an alternate client to consume this data to manage, install and update modules.

All the logic is kept in libraries - so that writing a new interface is easy.

Version 0.1.0

Installation:

  1. Clone or Download the repository.
  2. Change to the directory where you downloaded
  3. Make sure you have python-requests and python-appdirs installed. The program will tell you if it cannot find these modules.
  4. ./pyKAN --help
  5. python pyKAN --help #On windows

Current features:

  1. Global settings holding list of known KSP installation directories
  2. Per KSPDir settings on top of that
  3. Fetch repository data from CKAN
  4. Ability to install incompatible mods. Settings contain minKSPversion and maxKSPversion per install. By default these are set to the KSP version. User can override to, for example, allow mods that are maxed at 1.0.0 to install in 1.1.0.
  5. List available modules. Module listing comes with numerous optional filters which can be combined in arbitrary combinations. Includes text-search, module version and KSP version compatibility. The same filters will be available for selecting mods to install.
  6. Detect manually installed mods
  7. Import list of modules installed by CKAN
  8. List installed modules, indicating how they were installed.
  9. Install modules (optional override support for manual mods) with optional download-retries
  10. Uninstall modules
  11. Upgrade modules
  12. Python3 - in master branch only.

Changes

0.1.0

  1. The installed modules listing is now also sorted alphabetically.
  2. Fixed a bug where calling upgrade would reinstall the same version as was there before
  3. Disabled strict mode JSON to deal with the bad json in .version files.
  4. Handling of 'file' mode install sections now work correctly.
  5. Fixed install destination for mods like firespittercore
  6. Use appdirs module to place main configuration file in a platform neutral manner

0.0.1-beta2

  1. Python3 support
  2. Lots of small bugfixes
  3. Improved mod installer, mod upgrades and mod uninstalls
  4. List_module now sorts alphabetically

0.0.1-beta1

  1. Initial public release

Todo:

  1. PyQT GUI for graphical usage
  2. Manual install by link. User can copy a download link and have the app download and install from within. User could add/edit mod information.
  3. Optimize the O(N) and O(n*x) algorithms.
  4. Improve the argument code for the commandline version. Some of it is a bit cumbersome.
  5. Import of CKAN installed list should also import filelist. Done
  6. Consider using a Linter for your source (I'd recommend flake8)
  7. Consider using the logging module rather than a DEBUG flag
  8. Consider documenting at all levels (package, module, class, function) using a known doc style (Plain, Epytext, restructuredText, Numpy, Google, etc.)
  9. [very optional] Consider using type hints (a.k.a PEP 484) or even the typing module (see also PEP 526) if you switch to python3.

Written By

  1. A.J. Venter (metalpoetza on reddit).
  2. SYZYGY - Python3 support

pykan's People

Contributors

ajventer avatar ajventer-tal avatar bblough avatar fronbow avatar minecraft2048 avatar syzygy-dev333 avatar winsmith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pykan's Issues

(Multi) Switch to permissive license? PyQT

This code is licensed under GPL. This means any derivative HAS to have the same license no matter what. Also, any code that uses your code as a library has to use a GPL license. I was wondering if you could switch to an Apache or BSD-style license. Or possibly this one.

Also: does it have to be PyQT or would Tkinter be acceptable? (I can write a Tkinter GUI fairly easily.)

Version Comparison Broken

To reproduce

>>> from libPyKAN.version import Version
>>> Version("1.2") <= Version("1.2.1")
False

Breaks installing mods only compatible with 1.2 on 1.2.1 install with minKSPversion set to 1.2.

Exception on adding a directory

See below for the command. I'm not sure, but it could be related to the fact that I do not have my KSP installed in a default location. When I run the code in PyKANSettings line by line I end up with a non-existent directory for steamKSPDir.

PS E:\ksp\pyKAN-0.1.0> python .\pyKAN addkspdir --kspdir "E:\KSP\KSP_1.2.1\
python : Traceback (most recent call last)
At line:1 char:1
+ python .\pyKAN addkspdir --kspdir "E:\KSP\KSP_1.2.1\"

  •   + CategoryInfo          : NotSpecified: (Traceback (most recent call last)::String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
    
    File ".\pyKAN", line 341, in <module>
      settings = pykancfg.PyKANSettings(kspdir)
    File "E:\ksp\pyKAN-0.1.0\libPyKAN\pykancfg.py", line 25, in __init__
      steamKSPDir = os.path.join(os.getenv('HOME'),'.local','share','Steam','steamapps','common','Kerbal Space Program')
    File "C:\Python34\lib\ntpath.py", line 108, in join
      result_drive, result_path = splitdrive(path)
    File "C:\Python34\lib\ntpath.py", line 159, in splitdrive
      if len(p) > 1:
    

TypeError: object of type 'NoneType' has no len()`

Always selects steam

Whenever the user does not manually specify a KSPDIR it always uses the steam install - even if this is not the default or not even in the config file.
This behaviour is wrong. Need to fix it.

ValueError: invalid literal for int() with base 10: ''

Add KSP 1.2.1

./pyKAN addkspdir --kspdir "/home/realgecko/Games/Kerbal Space Program"
./pyKAN list_modules --allmods
Using KSP Directory:  /home/realgecko/Games/Kerbal Space Program
Traceback (most recent call last):
  File "./pyKAN", line 359, in <module>
    actions[options.action]['method']()
  File "./pyKAN", line 165, in list_modules
    if modid not in result or Version(result[modid]['version']) < Version(version):
  File "/home/realgecko/Downloads/pyKAN-0.1.0/libPyKAN/version.py", line 102, in __lt__
    return self.__cmp__(other) < 0
  File "/home/realgecko/Downloads/pyKAN-0.1.0/libPyKAN/version.py", line 91, in __cmp__
    if self.numpart(j) <= self.numpart(i):
  File "/home/realgecko/Downloads/pyKAN-0.1.0/libPyKAN/version.py", line 52, in numpart
    return int(''.join(re.findall('\d',s)))
ValueError: invalid literal for int() with base 10: ''

pyKAN list_modules crashes with TypeError

I'm running fresh pyKAN master cloned from this repository, and this happens:

feanor@silmaril ~/D/P/pyKAN> ./pyKAN list_modules 
Using KSP Directory:  /home/feanor/Development/Kerbal Space Program
Traceback (most recent call last):
  File "./pyKAN", line 404, in <module>
    options.func(options)
  File "./pyKAN", line 164, in list_modules
    if modid not in result or Version(result[modid]['version']) < Version(version):
  File "/home/feanor/Development/Programming/pyKAN/libPyKAN/version.py", line 111, in __lt__
    return self.__cmp__(other) < 0
  File "/home/feanor/Development/Programming/pyKAN/libPyKAN/version.py", line 81, in __cmp__
    return -other.__cmp__(self)
  File "/home/feanor/Development/Programming/pyKAN/libPyKAN/version.py", line 104, in __cmp__
    if i > j:
TypeError: '>' not supported between instances of 'int' and 'str'
feanor@silmaril ~/D/P/pyKAN> 

I think that this commit ad4e4f4 is the problem, as you fixed incorrect version comparison by trying to convert it to integers, and for some reason it fails to convert to integer for one of the version numbers

./pyKAN show_settings returns error

./pyKAN show_settings returns the following error:

Traceback (most recent call last):
  File "./pyKAN", line 332, in <module>
    settings = pykancfg.PyKANSettings(kspdir)
  File "~/.local/share/Steam/SteamApps/common/Kerbal Space Program/pyKAN-0.0.1/libPyKAN/pykancfg.py", line 44, in __init__
    self.save()
  File "~/.local/share/Steam/SteamApps/common/Kerbal Space Program/pyKAN-0.0.1/libPyKAN/pykancfg.py", line 69, in save
    util.mkdir_p(os.path.dirname(self.KSPSettingsFile))
AttributeError: 'PyKANSettings' object has no attribute 'KSPSettingsFile'

Is this because I have not assigned a kspdir?

multi feature request: Python 3 support + style + logging + documentation

Hello @ajventer, thank you for your great work :)

I have a couple of requests, they are all optional:

  • Consider using a Linter for your source (I'd recommend flake8)
  • Consider using the logging module rather than a DEBUG flag
  • Consider supporting python 3 (possibly using the six module (available as a standard module on most platforms), and/or using __future__ for basic stuffs)
  • Consider documenting at all levels (package, module, class, function) using a known doc style (Plain, Epytext, restructuredText, Numpy, Google, etc.)
  • [very optional] Consider using type hints (a.k.a PEP 484) or even the typing module (see also PEP 526) if you switch to python3.

That may sound like a lot of nitpicking (notably about the style), but that would make the source code little bit more readable and would probably find some possible defects. Flake8 is by default configured for a hard line break at 80 chars, but you might want to extend that a little bit (e.g. 100).

Thank you o/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.