-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from BGIResearch/dev
Dev
- Loading branch information
Showing
34 changed files
with
1,605 additions
and
2,514 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,51 @@ | ||
Installation | ||
============ | ||
|
||
install from pypi | ||
Pre-built installation (recommended) | ||
------------------------------------ | ||
|
||
.. code:: bash | ||
pip install stereopy | ||
or install from github | ||
Source installation | ||
-------------------------------------------- | ||
|
||
To install stereopy from source, you need: | ||
|
||
- HDF5 1.8.4 or newer with development headers | ||
- A C compiler | ||
|
||
On Unix platforms, you also need pkg-config unless you explicitly specify a path for HDF5 as described below. | ||
|
||
You can specify build options for stereopy as environment variables when you build it from source: | ||
|
||
.. code:: bash | ||
git clone https://github.com/BGIResearch/stereopy.git | ||
cd stereopy | ||
python setup.py install | ||
HDF5_DIR=/path/to/hdf5 python setup.py install | ||
The supported build options are: | ||
|
||
- To specify where to find HDF5, use one of these options: | ||
- HDF5_LIBDIR and HDF5_INCLUDEDIR: the directory containing the compiled HDF5 libraries and the directory containing the C header files, respectively. | ||
- HDF5_DIR: a shortcut for common installations, a directory with lib and include subdirectories containing compiled libraries and C headers. | ||
- HDF5_PKGCONFIG_NAME: A name to query pkg-config for. If none of these options are specified, stereopy will query pkg-config by default for hdf5, or hdf5-openmpi if building with MPI support. | ||
|
||
Source installation on OSX/MacOS | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
HDF5 and Python are most likely in your package manager (e.g. Homebrew, Macports, or Fink). Be sure to install the development headers, as sometimes they are not included in the main package. | ||
|
||
XCode comes with a C compiler (clang), and your package manager will likely have other C compilers for you to install. | ||
|
||
Source installation on Linux/Other Unix | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
HDF5 and Python are most likely in your package manager. A C compiler almost definitely is, usually there is some kind of metapackage to install the default build tools, e.g. build-essential, which should be sufficient for our needs. Make sure that that you have the development headers, as they are usually not installed by default. They can usually be found in python-dev or similar and libhdf5-dev or similar. | ||
|
||
Source installation on Windows | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Installing from source on Windows is a much more difficult prospect than installing from source on other OSs, as not only are you likely to need to compile HDF5 from source, everything must be built with the correct version of Visual Studio. Additional patches are also needed to HDF5 to get HDF5 and Python to work together. |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
Contributing guide | ||
~~~~~~~~~~~~~~~~~~ | ||
|
||
Contents | ||
======== | ||
- `Contributing code`_ | ||
- `Code style`_ | ||
- `Project structure`_ | ||
- `Writing documentation`_ | ||
- `Making a release`_ | ||
- `Testing`_ | ||
|
||
Contributing code | ||
----------------- | ||
1. Clone the Stereopy source from github:: | ||
|
||
git clone https://github.com/BGIResearch/stereopy.git | ||
2. Create a new branch for your PR and checkout to the new branch:: | ||
|
||
git checkout -b new_branch_name | ||
|
||
3. Add the new feature or fit the bugs in your codebase. | ||
4. After all tests passing, update the related documentation, such as release note, example and so on. | ||
5. Make a Pull Requests back to the dev branch, We will review the submitted code, and the merge to the main branch after there is no problem. | ||
|
||
Code style | ||
---------- | ||
1. Coding requirements comply with pep8 specification. | ||
2. The file naming adopts lowercase and underscore uniformly; the name of the class adopts the camel case naming method. | ||
|
||
eg: file name: dim_reduce.py; class name: DimReduce | ||
|
||
3. Variable naming should be in lower case and should be as meaningful as possible, avoiding unintentional naming. | ||
4. The comment information should be perfect, and each file, function, and class should write its comment information. | ||
We recommend using restructured Text as the docstring format of comment information. | ||
|
||
Project structure | ||
----------------- | ||
The stereopy project: | ||
|
||
- `stereo <stereo>`_: the root of the package. | ||
|
||
- `stereo/core <stereo/core>`_: the core code of stereo, which contains the base class and data structure of stereopy. | ||
- `stereo/algorithm <stereo/algorithm>`_: the algorithm module, main analysis and implementation algorithms, which | ||
deals with methodology realization. | ||
- `stereo/image <stereo/image>`_: the image module, which deals with the tissue image related analysis, such as cell | ||
segmentation, etc. | ||
- `stereo/io <stereo/io>`_: the io module, which deals with the reading, writing and format conversion of different | ||
data structure, between our StereoExpData and AnnData, etc. | ||
- `stereo/plots <stereo/plots>`_: the plotting module, which contains all the plotting functions for visualization. | ||
- `stereo/utils <stereo/utils>`_: Some common processing scripts. | ||
- `stereo/tests <stereo/tests>`_: the Tests module, which contains all the test scripts. | ||
|
||
Writing documentation | ||
--------------------- | ||
We use Sphinx to auto-generate documentation in multiple formats. Sphinx is built of reStructured text and, when using | ||
sphinx most of what you type is reStructured text. | ||
|
||
Installing Sphinx:: | ||
|
||
pip install sphinx | ||
|
||
pio install sphinx_rtd_theme | ||
|
||
pip install recommonmark # surpport md | ||
|
||
Make a doc directory, and start sphinx:: | ||
|
||
cd stereo | ||
|
||
mkdir docs | ||
|
||
# start sphinx | ||
sphinx-quickstart | ||
|
||
Modify the config file: | ||
In doc/source directory is now a python file called conf.py. This is the file that controls the basics of how | ||
sphinx runs when you run a build. For more information about the file, see the official | ||
`Sphinx <https://www.sphinx-doc.org/en/master/usage/configuration.html>`_ document. | ||
|
||
Write the Tutorials/example what you need to update: | ||
Tutorials and examples are hosted on a separate repository called | ||
`Tutorials <https://github.com/BGIResearch/stereopy/tree/main/docs/source/Tutorials>`_. | ||
|
||
Make and build html:: | ||
|
||
make clean | ||
|
||
make html | ||
|
||
open index.html | ||
|
||
docstrings format | ||
````````````````` | ||
We use the reStructured text style for writing docstrings. If you’re unfamiliar with the reStructuredText (rst) format, | ||
see the `link <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_. | ||
|
||
Making a release | ||
---------------- | ||
This part is to tell developers how to publish stereopy to PyPi. | ||
|
||
Checking the environment:: | ||
|
||
# First, install twine | ||
pip install twine | ||
|
||
# make a build | ||
python setup.py sdist bdist_wheel | ||
|
||
# check the build | ||
twine check dist/* | ||
|
||
Making release:: | ||
|
||
# Tag the version info | ||
git tag {version} | ||
|
||
# Build distributions and wheel | ||
python setup.py sdist bdist_wheel | ||
|
||
# Check whether the compilation result can be installed successfully | ||
# eg: pip install dist/stereopy-{version}-py3-none-any.whl | ||
|
||
# push the tag to github | ||
git push origin {version} | ||
|
||
# Upload wheel and code distribution to PyPi | ||
twine upload dist/* | ||
|
||
After any release has been made, create a new release notes file for the next feature and bugfix release. | ||
|
||
Testing | ||
------- | ||
For each functional module, a corresponding test script should be created to ensure that the developed function | ||
is normal. All our test files are unified in the `tests <stereo/tests>`_ directory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,15 +15,15 @@ | |
|
||
setup( | ||
name='stereopy', | ||
version='0.2.1', | ||
version='0.2.2', | ||
setup_requires=['setuptools_scm', 'numpy', 'panel', 'pytest', 'quilt3', 'scipy', 'phenograph'], | ||
description='Spatial transcriptomic analysis in python.', | ||
long_description=Path('README.md').read_text('utf-8'), | ||
long_description_content_type="text/markdown", | ||
url='https://github.com/BGIResearch/stereopy', | ||
author='BGIResearch', | ||
author_email='[email protected]', | ||
python_requires='>=3.6', | ||
python_requires='>=3.7', | ||
install_requires=[ | ||
l.strip() for l in Path('requirements.txt').read_text('utf-8').splitlines() | ||
], | ||
|
@@ -45,3 +45,12 @@ | |
'Topic :: Scientific/Engineering :: Visualization', | ||
], | ||
) | ||
|
||
try: | ||
import os | ||
print('install hotspot from git, command: pip install git+https://github.com/yoseflab/Hotspot.git') | ||
os.system('pip install git+https://github.com/yoseflab/Hotspot.git') | ||
# os.system('pip install pyscenic~=0.11.2 --ignore-installed pyarrow') | ||
except Exception as e: | ||
print('Hotspot is not install successly, please check.') | ||
print(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.