|
1 | 1 | ======================================== |
2 | | -Affiliated Package Template Instructions |
| 2 | +Accessing Online Astronomical Data |
3 | 3 | ======================================== |
4 | 4 |
|
5 | | -This package provides a template for packages that are affiliated with the |
6 | | -`Astropy`_ project. This package design mirrors the layout of the main |
7 | | -`Astropy`_ repository, as well as reusing much of the helper code used to |
8 | | -organize `Astropy`_. The instructions below describe how to take this |
9 | | -template and adjust it for your particular affiliated package. |
| 5 | +Astrodata is an affiliated package that contains a collection of classes |
| 6 | +and functions to access online Astronomical data. Each web service has |
| 7 | +its own sub-package. For example, to interface with the IRSA website, |
| 8 | +use the ``irsa`` sub-package: |
10 | 9 |
|
11 | | -Everywhere below that the text ``yourpkg`` is shown, replace it with the name |
12 | | -of your particular package. |
13 | | - |
14 | | -**Note**: The instructions below assume you are using git for version control, |
15 | | -as is used by the Astropy repository. If this is not the case, hopefully it |
16 | | -will be clear from context what to do with your particular VCS. |
17 | | - |
18 | | -* Make sure `Astropy`_ is installed, as the template depends in part on |
19 | | - Astropy to do its setup. |
20 | | - |
21 | | -* You may have already done this if you are looking at this file locally, but |
22 | | - if not, you will need to obtain a copy of the package template. Assuming |
23 | | - you have `git`_ installed, just do:: |
24 | | - |
25 | | - git clone git://github.com/astropy/package-template.git yourpkg |
26 | | - |
27 | | - This will download the latest version of the template from `github`_ and |
28 | | - place it in a directory named ``yourpkg``. |
29 | | - |
30 | | -* Go into the directory you just created, and open the ``setup.py`` file |
31 | | - with your favorite text editor. Follow the steps below to update it for |
32 | | - your new package. |
33 | | - |
34 | | - 1. Change the ``PACKAGENAME`` variable to whatever you decide your package |
35 | | - should be named (for examples' sake, we will call it ``yourpkg``). By |
36 | | - tradition/very strong suggestion, python package names should be all |
37 | | - lower-case. |
38 | | - 2. Change the ``DESCRIPTION`` variable to a short (one or few sentence) |
39 | | - description of your package. |
40 | | - 3. Define a longer description as a string in the ``LONG_DESCRIPTION`` |
41 | | - variable. You may want this to be the docstring of your package itself |
42 | | - as Astropy does. In this case, simple add ``import yourpkg`` somewhere |
43 | | - above, and set ``LONG_DESCRIPTION = yourpkg.__doc__``. Alternatively, |
44 | | - you may omit the description by deleting the variable and deleting the |
45 | | - line where it is used in the ``setup()`` function further down. |
46 | | - 4. Add your name and email address by changing the ``AUTHOR`` and |
47 | | - ``AUTHOR_EMAIL`` variables. |
48 | | - 5. If your affiliated package has a website, change ``URL`` to point to that |
49 | | - site. Otherwise, you can leave it pointing to `Astropy`_ or just |
50 | | - delete it. |
51 | | - 6. Exit out of your text editor |
52 | | - |
53 | | -* Now tell git to remember the changes you just made:: |
54 | | - |
55 | | - git add setup.py |
56 | | - git commit -m "adjusted setup.py for new project yourpkg" |
57 | | - |
58 | | -* Decide what license you want to use to release your source code. If you |
59 | | - don't care and/or are fine with the Astropy license, just edit the file |
60 | | - ``licenses/LICENSE.rst`` with your name (or your collaboration's name) at |
61 | | - the top as the licensees. Otherwise, make sure to replace that file with |
62 | | - whatever license you prefer, and update the ``LICENSE`` variable in |
63 | | - ``setup.py`` to reflect your choice of license. You also may need to |
64 | | - update the comment at the top of ``packagename/__init__.py`` to reflect your |
65 | | - choice of license. Again, tell git about your changes:: |
66 | | - |
67 | | - git add licenses/LICENSE.rst |
68 | | - git add setup.py # if you changed the license and modified setup.py |
69 | | - git commit -m "updated license for new project yourpkg" |
70 | | - |
71 | | -* Take a moment to look over the ``packagename/example_mod.py``, |
72 | | - ``packagename/tests/test_example.py``, ``scripts/script_example``, and |
73 | | - ``packagename/example_c.pyx`` files, as well as the |
74 | | - ``packagename/example_subpkg`` directory. These are examples of a |
75 | | - pure-python module, a test script, an example command-line script, a |
76 | | - `Cython`_ module, and a sub-package, respectively. (`Cython`_ is a way to |
77 | | - compile python-like code to C to make it run faster - see the project's web |
78 | | - site for details). These are provided as examples of standard way to lay |
79 | | - these out. Once you understand these, though, you'll want to delete them |
80 | | - (and later replace with your own):: |
81 | | - |
82 | | - git rm packagename/example_mod.py |
83 | | - git rm scripts/script_example |
84 | | - git rm packagename/example_c.pyx |
85 | | - git rm packagename/tests/test_example.py |
86 | | - git rm -r packagename/example_subpkg |
87 | | - git commit -m "removed examples from package template" |
88 | | - |
89 | | -* Now rename the source code directory to match your project's name:: |
90 | | - |
91 | | - git mv packagename yourpkg |
92 | | - git commit -m "renamed template package source to new project yourpkg" |
93 | | - |
94 | | -* Adjust the information in the documentation to match your new project by |
95 | | - editing the ``docs/conf.py`` file. |
96 | | - |
97 | | - 1. Change the ``project`` variable to your project's name (note that this does |
98 | | - not *need* to be exactly the same as the package name, but that's a |
99 | | - common convention). |
100 | | - 2. Change the following lines:: |
101 | | - |
102 | | - import packagename |
103 | | - # The short X.Y version. |
104 | | - version = packagename.__version__.split('-', 1)[0] |
105 | | - # The full version, including alpha/beta/rc tags. |
106 | | - release = packagename.__version__ |
107 | | - |
108 | | - |
109 | | - to:: |
110 | | - |
111 | | - import yourpkg |
112 | | - # The short X.Y version. |
113 | | - version = yourpkg.__version__.split('-', 1)[0] |
114 | | - # The full version, including alpha/beta/rc tags. |
115 | | - release = yourpkg.__version__ |
116 | | - |
117 | | - where ``yourpkg`` is the name of your package. |
118 | | - |
119 | | - 3. Update the ``copyright`` variable for the current year, and also your name |
120 | | - or the name of your collaboration (e.g.,"2011, John Doe and the |
121 | | - Amazing Package Collaboration.") |
122 | | - 4. If you ever expect to output your docs in LaTeX or as a man page, you'll |
123 | | - also want to update the `latex_documents` and `man_pages` variables to |
124 | | - reflect your project, name, and author list. |
125 | | - |
126 | | -* Pass these changes on to git:: |
127 | | - |
128 | | - git add docs/conf.py |
129 | | - git commit -m "updated documentation for new project yourpkg" |
130 | | - |
131 | | -* Update the names of the documentation files to match your package's name. |
132 | | - First open ``docs/index.rst`` in a text editor and change the text |
133 | | - ``"packagename/index.rst"`` to e.g., ``"yourpkg/index.rst"``. Then do:: |
134 | | - |
135 | | - git add docs/index.rst |
136 | | - git mv docs/packagename docs/yourpkg |
137 | | - git commit -m "Updated docs to reflect new project yourpkg" |
138 | | - |
139 | | -* Adjust the ``MANIFEST.in`` file to reflect your package's name by changing |
140 | | - the line 4 from ``recursive-include packagename *.pyx *.c`` to |
141 | | - ``recursive-include yourpkg *.pyx *.c`` and pass this onto git:: |
142 | | - |
143 | | - ... edit MANIFEST.in as described above... |
144 | | - git add MANIFEST.in |
145 | | - git commit -m "updated MANIFEST.in for new project yourpkg" |
146 | | - |
147 | | -* Edit this file (``README.rst``) and delete all of this content, and replace it |
148 | | - with a short description of your affiliated package. Inform git:: |
149 | | - |
150 | | - git add README.rst |
151 | | - git commit -m "replaced README for new project yourpkg" |
152 | | - |
153 | | -* (This step assumes your affiliated package is hosted as part of the astropy |
154 | | - organization on Github. If it's instead hosted somewhere else, just adjust |
155 | | - the URL in the instructions below to match wherever your repository lives) |
156 | | - Now you will want to tell git that it should be pushing and pulling updates |
157 | | - to the repository of *your* project, rather than the package template:: |
158 | | - |
159 | | - git remote rename origin template |
160 | | - git remote add upstream git@github.com:astropy/yourpkg.git |
161 | | - |
162 | | - Now that it is pointing to the correct master, you should push everything up |
163 | | - to your project and make sure that your local master is tied to your project |
164 | | - rather than the template. You'll only be able to do this if your github |
165 | | - repository is empty (if not, add the ``-f`` option to the ``push`` |
166 | | - command - that will overwrite whatever is there):: |
167 | | - |
168 | | - git push upstream master |
169 | | - git branch master --set-upstream upstream/master |
170 | | - |
171 | | -* (optional) If you are adopting the standard workflow used by `Astropy`_ with |
172 | | - github, you will also want to set up a fork of the repo on your own account, |
173 | | - by going to the Github page https://github.com/astropy/yourpkg and clicking |
174 | | - the "fork" button on the upper right. Then run the following commands:: |
175 | | - |
176 | | - git remote add origin git@github.com:yourgithubusername/yourpkg.git |
177 | | - git branch master --set-upstream origin/master |
178 | | - |
179 | | - Now you can push, pull, and branch whatever you want in your local fork |
180 | | - without affecting the official version, but when you want to push something |
181 | | - up to the main repository, just switch to the appropriate branch and do |
182 | | - ``git push upstream master``. |
183 | | - |
184 | | -* You're now ready to start doing actual work on your affiliated package. You |
185 | | - will probably want to read over the developer guidelines of the Astropy |
186 | | - documentation, and if you are hosting your code in GitHub, you might also |
187 | | - want to read the `Github help <http://help.github.com/>`_ to ensure you know |
188 | | - how to push your code to GitHub and some recommended workflows that work for |
189 | | - the core Astropy project. |
190 | | - |
191 | | -* Once you have started work on the affiliated package, you should register |
192 | | - your package with the Astropy affiliated package registry. Instructions for |
193 | | - doing this will be provided on the `Astropy`_ website. |
194 | | - |
195 | | -* Good luck with your code and your science! |
196 | | - |
197 | | -.. _Astropy: http://www.astropy.org/ |
198 | | -.. _git: http://git-scm.com/ |
199 | | -.. _github: http://github.com |
200 | | -.. _Cython: http://cython.org/ |
| 10 | + from astrodata import irsa |
0 commit comments