Skip to content
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

Create a PyPI package #8

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
optool
env/
optool.dSYM
optool.egg-info
penmp
Expand All @@ -20,7 +20,6 @@ __pycache__
auto/
*.html
*.tex
*.tex
*.aux
*.log
*.dvi
Expand All @@ -31,4 +30,6 @@ tmp.py
optool.pdf
optool_sd.dat
optool_lam.dat
plotsd.py
plotsd.py
*.swp
dist
55 changes: 28 additions & 27 deletions CONTENT
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
List of files in the optool distribution
========================================

CONTENT This file
INSTALL Brief installation instructions (also in UserGuide)
LICENSE License information
Makefile Makefile to aid compilation and installation
README.org Short introduction, source for githup site
UserGuide.org The User guide, an Emacs Org-mode file
UserGuide.pdf PDF version of UserGuide.org
code4reading Directory with code snippets to read optool output
codemeta.jason Matadata for optool
lnk_data Directory with refractive index data
maint Directory with scripts aiding maintenance
optool.f90 Main code file for optool
optool_guts.f90 Code that does the grunt work for computing opacities
optool_fractal.f90 Code implementing modified mean field theory
optool_geofractal.f90 Code computing geometric aggregate cross sections
optool_manual.f90 The Manual extracted from UserGuide.org, baked into f90
optool_refind.f90 Refractive index data as fortran code
optool Binary program, only present after running "make"
optool.py Python module for working with optool
setup.py Code for python module installation
optool2tex Perl program to turn optool command into LaTeX text
optool-complete Code for shell-completion of switches and arguments
optool.bib BibTeX file with all relevant references
CONTENT This file
INSTALL Brief installation instructions (also in UserGuide)
LICENSE License information
README.org Short introduction, source for github site
UserGuide.org The User guide, an Emacs Org-mode file
UserGuide.pdf PDF version of UserGuide.org
codemeta.jason Metadata for optool
pyproject.toml Code for python module installation
src/optool/Makefile Makefile to aid compilation and installation
src/optool/__init__.py Python file for initializing the module
src/optool/code4reading Directory with code snippets to read optool output
src/optool/lnk_data Directory with refractive index data
src/optool/maint Directory with scripts aiding maintenance
src/optool/optool.f90 Main code file for optool
src/optool/optool_guts.f90 Code that does the grunt work for computing opacities
src/optool/optool_fractal.f90 Code implementing modified mean field theory
src/optool/optool_geofractal.f90 Code computing geometric aggregate cross sections
src/optool/optool_manual.f90 The Manual extracted from UserGuide.org, baked into f90
src/optool/optool_refind.f90 Refractive index data as fortran code
src/optool/optool Binary program, only present after running "make"
src/optool/optool.py Python module for working with optool
src/optool/optool2tex Perl program to turn optool command into LaTeX text
src/optool/optool-complete Code for shell-completion of switches and arguments
src/optool/optool.bib BibTeX file with all relevant references


In directory maint
In directory src/optool/maint
==================
RELEASE Description of how to produce a release
all_k.pdf Plot of k values, made with plotall.py, used in manual
Expand All @@ -41,7 +42,7 @@ run_examples Script running all examples from the manual
selftest.pl Perl program to run a bunch of tests with optool


In directory code4reading
In directory src/optool/code4reading
=========================
Makefile Makefile to compile the fortran snippets
README Information about how to use the snippets
Expand All @@ -51,12 +52,12 @@ readfits.f90 Fortran program to read FITS output
readfits.py Python program to read FITS output


In directory lnk_data
In directory src/optool/lnk_data
=====================
lnk-help.txt The help screen shown by optool -c
retired Directory with retired datasets

The refractive index datasets in the lnk_data directory
The refractive index datasets in the src/optool/lnk_data directory
-------------------------------------------------------
astrosil-Draine2003.lnk astronomical silicate
c-gra-Draine2003.lnk graphite (crystalline)
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
recursive-include src/optool *
26 changes: 26 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[build-system]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "astro-optool"
version = "1.9.5"
# dynamic = ["version"]
dependencies = [
"numpy >= 1.18",
"matplotlib >= 2.0",
]
requires-python = ">= 3.7"
authors = [
{name = "Carsten Dominik", email = "[email protected]"},
{name = "Michiel Min", email = "[email protected]"},
{name = "Ryo Tazaki", email = "[email protected]"},
]
description = "Optool"
readme = {file = "README.org", content-type = "text/plain"}
license = {file = "LICENSE"}
keywords = ["astrophysics"]

[project.urls]
Issues = "https://github.com/cdominik/optool/issues"
Repository = "https://github.com/cdominik/optool"
10 changes: 0 additions & 10 deletions setup.py

This file was deleted.

File renamed without changes.
27 changes: 27 additions & 0 deletions src/optool/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os
import pathlib
import shutil
import subprocess
from .optool import *


MODULE_PATH = pathlib.Path(__file__).parent.resolve()
OPTOOL = shutil.which(f"{MODULE_PATH}/optool")


def make_optool(options=None):
os.chdir(MODULE_PATH)
cmd = ["make",]
if options is not None:
cmd.append(options)
subprocess.Popen(cmd).wait()


if OPTOOL is None:
q = input(
"Cannot find 'optool' executable, shall I try to compile it using "
"default options (make clean; make multi)? (y/n)"
)
if q.lower() == "y":
make_optool(options="clean")
make_optool(options="multi")
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.
Loading