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