Skip to content

Commit

Permalink
Source update
Browse files Browse the repository at this point in the history
Include data and interactives in /src/
  • Loading branch information
astroDimitrios committed May 1, 2021
1 parent 452f124 commit a889c1f
Show file tree
Hide file tree
Showing 41 changed files with 75 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/astroedu.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: astroedu
Version: 0.0.2a1
Version: 0.0.1a17
Summary: A python package for astronomy educators
Home-page: https://github.com/astroDimitrios/astroedu
Author: Dimitrios Theodorakis
Expand Down Expand Up @@ -46,5 +46,5 @@ Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Requires-Python: >=3.7
Description-Content-Type: text/markdown
36 changes: 35 additions & 1 deletion src/astroedu.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,38 @@ src/astroedu.egg-info/SOURCES.txt
src/astroedu.egg-info/dependency_links.txt
src/astroedu.egg-info/entry_points.txt
src/astroedu.egg-info/requires.txt
src/astroedu.egg-info/top_level.txt
src/astroedu.egg-info/top_level.txt
src/astroedu/data/atmospheres.csv
src/astroedu/data/atmospheres.txt
src/astroedu/data/earth_chem_crust.csv
src/astroedu/data/earth_chem_crust.txt
src/astroedu/data/earth_chem_interior.csv
src/astroedu/data/earth_chem_interior.txt
src/astroedu/data/exobase.csv
src/astroedu/data/exobase.txt
src/astroedu/data/geotherm.csv
src/astroedu/data/geotherm.txt
src/astroedu/data/geotherm_original.csv
src/astroedu/data/geotherm_original.txt
src/astroedu/data/int_std_atm.csv
src/astroedu/data/int_std_atm.txt
src/astroedu/data/jupiter_moons.csv
src/astroedu/data/jupiter_moons.txt
src/astroedu/data/neptune_moons.csv
src/astroedu/data/neptune_moons.txt
src/astroedu/data/planetary_rings.csv
src/astroedu/data/planetary_rings.txt
src/astroedu/data/planets.csv
src/astroedu/data/planets.txt
src/astroedu/data/saturn_moons.csv
src/astroedu/data/saturn_moons.txt
src/astroedu/data/saturn_rings.csv
src/astroedu/data/saturn_rings.txt
src/astroedu/data/structure.csv
src/astroedu/data/structure.txt
src/astroedu/data/uranus_moons.csv
src/astroedu/data/uranus_moons.txt
src/astroedu/interactives/blackbody_curves.ipynb
src/astroedu/interactives/equilibrium_temperature.ipynb
src/astroedu/interactives/stefan_boltzman_law.ipynb
src/astroedu/interactives/wiens_law.ipynb
2 changes: 1 addition & 1 deletion src/astroedu.egg-info/entry_points.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[console_scripts]
astroedu = astroedu:startup
astroedu = astroedu.__main__:main

13 changes: 7 additions & 6 deletions src/astroedu.egg-info/requires.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
subprocess
numpy
matplotlib
pandas
jupyterlab
ipywidgets
numpy>=1.10.0
matplotlib>=3.4.0
pandas>=1.2
jupyterlab>=3.0.0
ipywidgets>=7.6.0
fire>=0.4.0
importlib-resources>=5.1.2
11 changes: 7 additions & 4 deletions src/astroedu/__build__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
from configparser import ConfigParser
from os import path
from site import getusersitepackages
from importlib.util import find_spec

def get_astroedu_path():
return find_spec('astroedu').submodule_search_locations[0]

def build_path_config():
install_path = getusersitepackages() + '/astroedu/'
astroedu_path = get_astroedu_path()
documents_path = path.expanduser('~/Documents')

config = ConfigParser()
config['astroedu-config'] = {'astroedu_path':install_path, 'docs_path':documents_path}
config['astroedu-config'] = {'install_path':astroedu_path, 'docs_path':documents_path}

f = open('config.ini', 'w')
f = open(astroedu_path+'/config.ini', 'w')
config.write(f)
f.close()
44 changes: 23 additions & 21 deletions src/astroedu/__main__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
from configparser import ConfigParser
from os import path
import subprocess
from importlib_resources import files, is_resource
from importlib.util import find_spec
from configparser import ConfigParser
import fire

from astroedu.__build__ import get_astroedu_path

def load_astroedu_path():
from site import getusersitepackages
return getusersitepackages() + '/astroedu/'
def main():
fire.Fire(startup)

def load_astroedu_config():
if not path.exists(config_file_name):
if not is_resource('astroedu', 'config.ini'):
raise FileExistsError('No config.ini file found. Did you forget to run: \n astroedu build')
config = ConfigParser()
config.read(config_file_name)
config.read(config_file_path)
return config['astroedu-config']

commands = ['interactive']
astroedu_path = load_astroedu_path()
config_file_name = 'config.ini'
commands = ['build', 'interactive']
astroedu_path = get_astroedu_path()
config_file_name = '/config.ini'
config_file_path = astroedu_path + config_file_name

def startup(*args):
Expand All @@ -32,15 +35,14 @@ def startup(*args):
build_path_config()
elif command == 'interactive':
interactive_name = args[1]
interactive_path = astroedu_path+'interactives/'+interactive_name+'.ipynb'
interactive_path = './interactives/'+interactive_name+'.ipynb'
if not path.exists(interactive_path):
raise FileExistsError(f'No interactive named {interactive_name}.')
call = ['jupyter', 'lab']
call_args = list(args[2:]) if len(args) > 2 else []
run_interactive = call + [interactive_path] + call_args
print(f'Loading interactive {interactive_name}!')
subprocess.run(run_interactive)
if not is_resource('astroedu.interactives', interactive_name+'.ipynb'):
raise FileExistsError(f'No interactive named {interactive_name} found.')
with files('astroedu').joinpath('interactives', interactive_name+'.ipynb') as p:
call = ['jupyter', 'lab']
call_args = list(args[2:]) if len(args) > 2 else []
run_interactive = call + [str(p)] + call_args
print(f'Loading interactive {interactive_name}!')
subprocess.run(run_interactive)

# if __name__ == '__main__':
# startup('interactive', 'wiens_law', '--port', '9999')
if __name__ == '__main__':
fire.Fire(startup)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit a889c1f

Please sign in to comment.