Skip to content
Commits on Source (4)
repos:
- repo: https://github.com/python/black
rev: stable
hooks:
- id: black
language_version: python3.7
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.7
hooks:
- id: flake8
language: python_venv
......@@ -8,15 +8,14 @@ matrix:
- env: ENV_FILE="ci/travis/35-minimal.yaml"
# Python 2.7 and 3.6 test all supported Pandas versions
- env: ENV_FILE="ci/travis/27-pd020.yaml"
- env: ENV_FILE="ci/travis/27-pd023.yaml"
- env: ENV_FILE="ci/travis/27-latest-defaults.yaml"
# - env: ENV_FILE="ci/travis/27-latest-defaults.yaml"
- env: ENV_FILE="ci/travis/27-latest-conda-forge.yaml"
- env: ENV_FILE="ci/travis/36-pd020.yaml"
- env: ENV_FILE="ci/travis/36-pd022.yaml"
- env: ENV_FILE="ci/travis/36-pd023.yaml"
- env: ENV_FILE="ci/travis/36-pd024.yaml"
- env: ENV_FILE="ci/travis/37-latest-defaults.yaml"
- env: ENV_FILE="ci/travis/37-latest-defaults.yaml" STYLE=true
- env: ENV_FILE="ci/travis/37-latest-conda-forge.yaml"
- env: ENV_FILE="ci/travis/37-dev.yaml" DEV=true
......@@ -26,19 +25,27 @@ install:
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- conda config --set always_yes yes --set changeps1 no
- conda install conda=4.6
- conda update conda
- conda info
# free channel needed for older envs (< py37), see
# https://github.com/conda/conda/issues/8849
- conda config --set restore_free_channel true
# Install dependencies
- conda env create --file="${ENV_FILE}"
- source activate test
- if [ "$DEV" ]; then pip install git+https://github.com/pydata/pandas.git; fi
- if [ "$DEV" ]; then pip install git+https://github.com/matplotlib/matplotlib.git; fi
- if [ "$STYLE" ]; then pip install black flake8; fi
- pip install -e .
- conda list
- python -c "import geopandas; geopandas.show_versions();"
script:
- py.test geopandas --cov geopandas -v --cov-report term-missing
- if [ "$STYLE" ]; then black --check geopandas; fi
- if [ "$STYLE" ]; then flake8 geopandas; fi
after_success:
- codecov
Changes
=======
Version 0.6.0 (September 27, 2019)
----------------------------------
Important note! This will be the last release to support Python 2.7 (#1031)
API changes:
- A refactor of the internals based on the pandas ExtensionArray interface (#1000). The main user visible changes are:
- The `.dtype` of a GeoSeries is now a `'geometry'` dtype (and no longer a numpy `object` dtype).
- The `.values` of a GeoSeries now returns a custom `GeometryArray`, and no longer a numpy array. To get back a numpy array of Shapely scalars, you can convert explicitly using `np.asarray(..)`.
- The `GeoSeries` constructor now raises a warning when passed non-geometry data. Currently the constructor falls back to return a pandas `Series`, but in the future this will raise an error (#1085).
- The missing value handling has been changed to now separate the concepts of missing geometries and empty geometries (#601, 1062). In practice this means that (see [the docs](https://geopandas.readthedocs.io/en/v0.6.0/missing_empty.html) for more details):
- `GeoSeries.isna` now considers only missing values, and if you want to check for empty geometries, you can use `GeoSeries.is_empty` (`GeoDataFrame.isna` already only looked at missing values).
- `GeoSeries.dropna` now actually drops missing values (before it didn't drop either missing or empty geometries)
- `GeoSeries.fillna` only fills missing values (behaviour unchanged).
- `GeoSeries.align` uses missing values instead of empty geometries by default to fill non-matching index entries.
New features and improvements:
- Addition of a `GeoSeries.affine_transform` method, equivalent of Shapely's function (#1008).
- Addition of a `GeoDataFrame.rename_geometry` method to easily rename the active geometry column (#1053).
- Addition of `geopandas.show_versions()` function, which can be used to give an overview of the installed libraries in bug reports (#899).
- The `legend_kwds` keyword of the `plot()` method can now also be used to specify keywords for the color bar (#1102).
- Performance improvement in the `sjoin()` operation by re-using existing spatial index of the input dataframes, if available (#789).
- Updated documentation to work with latest version of geoplot and contextily (#1044, #1088).
- A new ``geopandas.options`` configuration, with currently a single option to control the display precision of the coordinates (``options.display_precision``). The default is now to show less coordinates (3 for projected and 5 for geographic coordinates), but the default can be overridden with the option.
Bug fixes:
- Also try to use `pysal` instead of `mapclassify` if available (#1082).
- The `GeoDataFrame.astype()` method now correctly returns a `GeoDataFrame` if the geometry column is preserved (#1009).
- The `to_crs` method now uses `always_xy=True` to ensure correct lon/lat order handling for pyproj>=2.2.0 (#1122).
- Fixed passing list-like colors in the `plot()` method in case of "multi" geometries (#1119).
- Fixed the coloring of shapes and colorbar when passing a custom `norm` in the `plot()` method (#1091, #1089).
- Fixed `GeoDataFrame.to_file` to preserve VFS file paths (e.g. when a "s3://" path is specified) (#1124).
- Fixed failing case in ``geopandas.sjoin`` with empty geometries (#1138).
In addition, the minimum required versions of some dependencies have been increased: GeoPandas now requirs pandas >=0.23.4 and matplotlib >=2.0.1 (#1002).
Version 0.5.1 (July 11, 2019)
------------------------------
-----------------------------
- Compatibility with latest mapclassify version 2.1.0 (#1025).
......
......@@ -45,10 +45,29 @@ Style
possible (all supported versions will be automatically tested on
Travis CI).
- Follow PEP 8 when possible.
- GeoPandas follows [the PEP 8
standard](http://www.python.org/dev/peps/pep-0008/) and uses
[Black](https://black.readthedocs.io/en/stable/) and
[Flake8](http://flake8.pycqa.org/en/latest/) to ensure a consistent
code format throughout the project.
- Imports should be grouped with standard library imports first,
3rd-party libraries next, and GeoPandas imports third. Within each
grouping, imports should be alphabetized. Always use absolute
imports when possible, and explicit relative imports for local
imports when necessary in tests.
- You can set up [pre-commit hooks](https://pre-commit.com/) to
automatically run `black` and `flake8` when you make a git
commit. This can be done by installing `pre-commit`:
$ python -m pip install pre-commit
From the root of the geopandas repository, you should then install
`pre-commit`:
$ pre-commit install
Then `black` and `flake8` will be run automatically each time you
commit changes. You can skip these checks with `git commit
--no-verify`.
......@@ -55,21 +55,23 @@ Get in touch
Examples
--------
>>> import geopandas
>>> from shapely.geometry import Polygon
>>> p1 = Polygon([(0, 0), (1, 0), (1, 1)])
>>> p2 = Polygon([(0, 0), (1, 0), (1, 1), (0, 1)])
>>> p3 = Polygon([(2, 0), (3, 0), (3, 1), (2, 1)])
>>> g = geopandas.GeoSeries([p1, p2, p3])
>>> g
0 POLYGON ((0.0000000000000000 0.000000000000000...
1 POLYGON ((0.0000000000000000 0.000000000000000...
2 POLYGON ((2.0000000000000000 0.000000000000000...
dtype: object
0 POLYGON ((0 0, 1 0, 1 1, 0 0))
1 POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))
2 POLYGON ((2 0, 3 0, 3 1, 2 1, 2 0))
dtype: geometry
![Example 1](examples/test.png)
Some geographic operations return normal pandas object. The `area` property of a `GeoSeries` will return a `pandas.Series` containing the area of each item in the `GeoSeries`:
>>> print g.area
>>> print(g.area)
0 0.5
1 1.0
2 1.0
......@@ -78,11 +80,10 @@ Some geographic operations return normal pandas object. The `area` property of
Other operations return GeoPandas objects:
>>> g.buffer(0.5)
Out[15]:
0 POLYGON ((-0.3535533905932737 0.35355339059327...
1 POLYGON ((-0.5000000000000000 0.00000000000000...
2 POLYGON ((1.5000000000000000 0.000000000000000...
dtype: object
1 POLYGON ((-0.5 0, -0.5 1, -0.4975923633360985 ...
2 POLYGON ((1.5 0, 1.5 1, 1.502407636663901 1.04...
dtype: geometry
![Example 2](examples/test_buffer.png)
......@@ -95,32 +96,33 @@ GeoPandas also implements alternate constructors that can read any data format r
>>> nybb_path = geopandas.datasets.get_path('nybb')
>>> boros = geopandas.read_file(nybb_path)
>>> boros.set_index('BoroCode', inplace=True)
>>> boros.sort()
>>> boros.sort_index(inplace=True)
>>> boros
BoroName Shape_Area Shape_Leng \
BoroName Shape_Leng Shape_Area \
BoroCode
1 Manhattan 6.364422e+08 358532.956418
2 Bronx 1.186804e+09 464517.890553
3 Brooklyn 1.959432e+09 726568.946340
4 Queens 3.049947e+09 861038.479299
5 Staten Island 1.623853e+09 330385.036974
1 Manhattan 359299.096471 6.364715e+08
2 Bronx 464392.991824 1.186925e+09
3 Brooklyn 741080.523166 1.937479e+09
4 Queens 896344.047763 3.045213e+09
5 Staten Island 330470.010332 1.623820e+09
geometry
BoroCode
1 (POLYGON ((981219.0557861328125000 188655.3157...
2 (POLYGON ((1012821.8057861328125000 229228.264...
3 (POLYGON ((1021176.4790039062500000 151374.796...
4 (POLYGON ((1029606.0765991210937500 156073.814...
5 (POLYGON ((970217.0223999023437500 145643.3322...
1 MULTIPOLYGON (((981219.0557861328 188655.31579...
2 MULTIPOLYGON (((1012821.805786133 229228.26458...
3 MULTIPOLYGON (((1021176.479003906 151374.79699...
4 MULTIPOLYGON (((1029606.076599121 156073.81420...
5 MULTIPOLYGON (((970217.0223999023 145643.33221...
![New York City boroughs](examples/nyc.png)
>>> boros['geometry'].convex_hull
0 POLYGON ((915517.6877458114176989 120121.88125...
1 POLYGON ((1000721.5317993164062500 136681.7761...
2 POLYGON ((988872.8212280273437500 146772.03179...
3 POLYGON ((977855.4451904296875000 188082.32238...
4 POLYGON ((1017949.9776000976562500 225426.8845...
dtype: object
BoroCode
1 POLYGON ((977855.4451904297 188082.3223876953,...
2 POLYGON ((1017949.977600098 225426.8845825195,...
3 POLYGON ((988872.8212280273 146772.0317993164,...
4 POLYGON ((1000721.531799316 136681.776184082, ...
5 POLYGON ((915517.6877458114 120121.8812543372,...
dtype: geometry
![Convex hulls of New York City boroughs](examples/nyc_hull.png)
......@@ -3,10 +3,6 @@
# https://packaging.python.org/en/latest/appveyor/
# https://github.com/rmcgibbo/python-appveyor-conda-example
matrix:
fast_finish: true # immediately finish build once one of the jobs fails.
environment:
matrix:
- PYTHON_VERSION: "2.7"
......@@ -31,13 +27,21 @@ install:
throw "There are newer queued builds for this pull request, failing early." }
# set up environment
- "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%"
- CALL "%MINICONDA%\\Scripts\\activate.bat"
- conda config --set always_yes yes --set show_channel_urls true --set changeps1 no
- conda install conda=4.6
- conda update conda
# this is basically equivalent to what conda init does. It changes the "conda" to
# be a .bat script that sets appropriate PATH entries before conda hits problems.
# This PATH modification only works with conda 4.6+, but it won't hurt other versions.
- set "PATH=%MINICONDA%\condabin:%PATH%"
- conda info -a
# free channel needed for older envs (< py37), see
# https://github.com/conda/conda/issues/8849
- conda config --set restore_free_channel true
- conda env create --file="${ENV_FILE}"
test_script:
- activate test
# this uses condabin/conda.bat because of our PATH modification above
- conda activate test
- conda list
- pytest geopandas -v
......@@ -100,5 +100,5 @@ class Bench:
# TODO
# project, interpolate, translate, rotate, scale, skew, explode
# project, interpolate, affine_transform, translate, rotate, scale, skew, explode
# cx indexer
......@@ -23,6 +23,8 @@ dependencies:
- SQLalchemy
- psycopg2
- libspatialite
# TEMP: workaround until conda-forge fixes the issues with gdal
- zstd
- pip:
- codecov
- geopy
name: test
channels:
- conda-forge
dependencies:
- python=2.7
- six
- numpy # need to list to get this from conda-forge
- gdal
# required
- pandas==0.20.2
- shapely
- fiona
- pyproj
# testing
- pytest
- pytest-cov
- codecov
- mock
# optional
- rtree
- matplotlib==2.0.2
- descartes
- geopy
- SQLalchemy
- psycopg2
- libspatialite
- mapclassify==1.0.1
......@@ -17,7 +17,7 @@ dependencies:
- mock
# optional
- rtree
- matplotlib
- matplotlib==2.0.2
- descartes
#- geopy
- SQLalchemy
......
......@@ -7,7 +7,7 @@ dependencies:
- six
# required
- numpy=1.12
- pandas==0.19.2
- pandas==0.23.4
- shapely=1.5
- fiona=1.7
- pyproj
......@@ -19,10 +19,9 @@ dependencies:
- rtree
- matplotlib
- descartes
- matplotlib=2.0
- mapclassify
- geopy
- SQLalchemy
- psycopg2
- libspatialite
- pip:
- matplotlib==1.5.3
name: test
channels:
- conda-forge
- defaults
dependencies:
- python=3.6
- pip
- six
# required
- pandas==0.20.2
- pandas==0.23.4
- nomkl
- shapely
- gdal=2.3
......@@ -14,13 +15,16 @@ dependencies:
# testing
- pytest
- pytest-cov
- codecov
#- codecov
# optional
- rtree
- matplotlib=2
- descartes
- mapclassify
- geopy
#- geopy
- SQLalchemy
- psycopg2
- libspatialite
- pip:
- geopy
- codecov
......@@ -5,7 +5,7 @@ dependencies:
- python=3.6
- six
# required
- pandas=0.22
- pandas=0.24
- shapely
- fiona=1.7
- pyproj
......
......@@ -2,7 +2,7 @@ name: test
channels:
- defaults
dependencies:
- python=3.7
- python=3.7.3
- six
- cython
# required
......
......@@ -17,8 +17,10 @@ dependencies:
- rtree
- matplotlib
- descartes
- mapclassify
- pysal
- geopy
- SQLalchemy
- psycopg2
- libspatialite
# TEMP: workaround until conda-forge fixes the issues with gdal
- zstd
......@@ -2,7 +2,7 @@ name: test
channels:
- defaults
dependencies:
- python=3.7
- python=3.7.3
- six
# required
- pandas
......
python-geopandas (0.6.0-1) unstable; urgency=medium
* Team upload.
* New upstream release.
-- Bas Couwenberg <sebastic@debian.org> Fri, 27 Sep 2019 19:32:02 +0200
python-geopandas (0.5.1-2) unstable; urgency=medium
* Team upload.
......
......@@ -152,3 +152,8 @@ doctest:
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
@echo "Testing of doctests in the sources finished, look at the " \
"results in $(BUILDDIR)/doctest/output.txt."
dash: html
rm -rf geopandas.docset
doc2dash --name=geopandas _build/html
......@@ -3,25 +3,26 @@ channels:
- conda-forge
dependencies:
- python=3.7
- pandas=0.24.1
- pandas=0.25.0
- shapely=1.6.4
- fiona=1.8.4
- fiona=1.8.6
- pyproj=1.9.6
- rtree=0.8.3
- six=1.12.0
- geopy=1.18.1
- matplotlib=3.0.3
- geopy=1.20.0
- matplotlib=3.1.1
- descartes=1.1.0
- mapclassify=2.0.1
- sphinx=1.8.4
- mapclassify=2.1.1
- sphinx=2.1.2
- sphinx_rtd_theme=0.4.3
- numpydoc=0.8.0
- ipython=7.3.0
- pillow=5.4.1
- mock=2.0.0
- numpydoc=0.9.1
- ipython=7.7.0
- pillow=6.1.0
- mock=3.0.5
- cartopy=0.17.0
- contextily=1.0rc1
- rasterio=1.0.21
- geoplot=0.2.4
- sphinx-gallery=0.2.0
- contextily=1.0rc2
- rasterio=1.0.24
- geoplot=0.3.0
- sphinx-gallery=0.4.0
- jinja2=2.10
- doc2dash
......@@ -32,21 +32,25 @@ In particular, when submitting a pull request:
- Classes, methods, functions, etc. should have docstrings. The first
line of a docstring should be a standalone summary. Parameters and
return values should be ducumented explicitly.
return values should be documented explicitly.
- GeoPandas supports python 2 (2.6+) and python 3 (3.2+) with a single
- GeoPandas supports python 2 (2.7+) and python 3 (3.5+) with a single
code base. Use modern python idioms when possible that are
compatibile with both major versions, and use the
compatible with both major versions, and use the
`six <https://pythonhosted.org/six>`_ library where helpful to smooth
over the differences. Use ``from __future__ import`` statements where
appropriate. Test code locally in both python 2 and python 3 when
possible (all supported versions will be automatically tested on
Travis CI).
- Follow PEP 8 when possible.
- Follow PEP 8 when possible. We use `Black
<https://black.readthedocs.io/en/stable/>`_ and `Flake8
<http://flake8.pycqa.org/en/latest/>`_ to ensure a consistent code
format throughout the project. For more details see
:ref:`below <contributing_style>`.
- Imports should be grouped with standard library imports first,
3rd-party libraries next, and geopandas imports third. Within each
3rd-party libraries next, and GeoPandas imports third. Within each
grouping, imports should be alphabetized. Always use absolute
imports when possible, and explicit relative imports for local
imports when necessary in tests.
......@@ -55,12 +59,12 @@ In particular, when submitting a pull request:
Seven Steps for Contributing
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are seven basic steps to contributing to *geopandas*:
There are seven basic steps to contributing to *GeoPandas*:
1) Fork the *geopandas* git repository
1) Fork the *GeoPandas* git repository
2) Create a development environment
3) Install *geopandas* dependencies
4) Make a ``development`` build of *geopandas*
3) Install *GeoPandas* dependencies
4) Make a ``development`` build of *GeoPandas*
5) Make changes to code and add tests
6) Update the documentation
7) Submit a Pull Request
......@@ -68,10 +72,10 @@ There are seven basic steps to contributing to *geopandas*:
Each of these 7 steps is detailed below.
1) Forking the *geopandas* repository using Git
1) Forking the *GeoPandas* repository using Git
------------------------------------------------
To the new user, working with Git is one of the more daunting aspects of contributing to *geopandas**.
To the new user, working with Git is one of the more daunting aspects of contributing to *GeoPandas**.
It can very quickly become overwhelming, but sticking to the guidelines below will help keep the process
straightforward and mostly trouble free. As always, if you are having difficulties please
feel free to ask for help.
......@@ -89,7 +93,7 @@ Some great resources for learning Git:
* Matthew Brett's `Pydagogue <http://matthew-brett.github.com/pydagogue/>`_.
Getting started with Git
~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~
`GitHub has instructions <http://help.github.com/set-up-git-redirect>`__ for installing git,
setting up your SSH key, and configuring git. All these steps need to be completed before
......@@ -98,9 +102,9 @@ you can work seamlessly between your local repository and GitHub.
.. _contributing.forking:
Forking
~~~~~~~~
~~~~~~~
You will need your own fork to work on the code. Go to the `geopandas project
You will need your own fork to work on the code. Go to the `GeoPandas project
page <https://github.com/geopandas/geopandas>`_ and hit the ``Fork`` button. You will
want to clone your fork to your machine::
......@@ -109,7 +113,7 @@ want to clone your fork to your machine::
git remote add upstream git://github.com/geopandas/geopandas.git
This creates the directory `geopandas-yourname` and connects your repository to
the upstream (main project) *geopandas* repository.
the upstream (main project) *GeoPandas* repository.
The testing suite will run automatically on Travis-CI once your pull request is
submitted. However, if you wish to run the test suite on a branch prior to
......@@ -132,7 +136,7 @@ The above can be simplified to::
This changes your working directory to the shiny-new-feature branch. Keep any
changes in this branch specific to one bug or feature so it is clear
what the branch brings to *geopandas*. You can have many shiny-new-features
what the branch brings to *GeoPandas*. You can have many shiny-new-features
and switch in between them using the git checkout command.
To update this branch, you need to retrieve the changes from the master branch::
......@@ -140,7 +144,7 @@ To update this branch, you need to retrieve the changes from the master branch::
git fetch upstream
git rebase upstream/master
This will replay your commits on top of the latest geopandas git master. If this
This will replay your commits on top of the latest GeoPandas git master. If this
leads to merge conflicts, you must resolve these before submitting your pull
request. If you have uncommitted changes, you will need to ``stash`` them prior
to updating. This will effectively store your changes and they can be reapplied
......@@ -150,11 +154,11 @@ after updating.
2) Creating a development environment
---------------------------------------
A development environment is a virtual space where you can keep an independent installation of *geopandas*.
A development environment is a virtual space where you can keep an independent installation of *GeoPandas*.
This makes it easy to keep both a stable version of python in one place you use for work, and a development
version (which you may break while playing with code) in another.
An easy way to create a *geopandas* development environment is as follows:
An easy way to create a *GeoPandas* development environment is as follows:
- Install either `Anaconda <http://docs.continuum.io/anaconda/>`_ or
`miniconda <http://conda.pydata.org/miniconda.html>`_
......@@ -164,24 +168,18 @@ An easy way to create a *geopandas* development environment is as follows:
Tell conda to create a new environment, named ``geopandas_dev``, or any other name you would like
for this environment, by running::
conda create -n geopandas_dev
For a python 3 environment::
conda create -n geopandas_dev python=3.4
conda create -n geopandas_dev python
This will create the new environment, and not touch any of your existing environments,
nor any existing python installation.
To work in this environment, Windows users should ``activate`` it as follows::
activate geopandas_dev
To work in this environment, you need to ``activate`` it. The instructions below
should work for both Windows, Mac and Linux::
Mac OSX and Linux users should use::
conda activate geopandas_dev
source activate geopandas_dev
You will then see a confirmation message to indicate you are in the new development environment.
Once your environment is activated, you will see a confirmation message to
indicate you are in the new development environment.
To view your environments::
......@@ -189,7 +187,7 @@ To view your environments::
To return to you home root environment::
deactivate
conda deactivate
See the full conda docs `here <http://conda.pydata.org/docs>`__.
......@@ -198,21 +196,20 @@ At this point you can easily do a *development* install, as detailed in the next
3) Installing Dependencies
--------------------------
To run *geopandas* in an development environment, you must first install
*geopandas*'s dependencies. We suggest doing so using the following commands
To run *GeoPandas* in an development environment, you must first install
*GeoPandas*'s dependencies. We suggest doing so using the following commands
(executed after your development environment has been activated)::
conda install -c conda-forge fiona shapely pyproj rtree
conda install pandas
conda install -c conda-forge pandas fiona shapely pyproj rtree pytest
This should install all necessary dependencies.
4) Making a development build
-----------------------------
Once dependencies are in place, make an in-place build by navigating to the git
clone of the *geopandas* repository and running::
clone of the *GeoPandas* repository and running::
python setup.py develop
......@@ -220,7 +217,7 @@ clone of the *geopandas* repository and running::
5) Making changes and writing tests
-------------------------------------
*geopandas* is serious about testing and strongly encourages contributors to embrace
*GeoPandas* is serious about testing and strongly encourages contributors to embrace
`test-driven development (TDD) <http://en.wikipedia.org/wiki/Test-driven_development>`_.
This development process "relies on the repetition of a very short development cycle:
first the developer writes an (initially failing) automated test case that defines a desired
......@@ -229,10 +226,10 @@ So, before actually writing any code, you should write your tests. Often the te
taken from the original GitHub issue. However, it is always worth considering additional
use cases and writing corresponding tests.
Adding tests is one of the most common requests after code is pushed to *geopandas*. Therefore,
Adding tests is one of the most common requests after code is pushed to *GeoPandas*. Therefore,
it is worth getting in the habit of writing tests ahead of time so this is never an issue.
*geopandas* uses the `pytest testing system
*GeoPandas* uses the `pytest testing system
<http://doc.pytest.org/en/latest/>`_ and the convenient
extensions in `numpy.testing
<http://docs.scipy.org/doc/numpy/reference/routines.testing.html>`_.
......@@ -253,29 +250,75 @@ Running the test suite
~~~~~~~~~~~~~~~~~~~~~~
The tests can then be run directly inside your Git clone (without having to
install *geopandas*) by typing::
install *GeoPandas*) by typing::
pytest
6) Updating the Documentation
-----------------------------
*geopandas* documentation resides in the `doc` folder. Changes to the docs are
*GeoPandas* documentation resides in the `doc` folder. Changes to the docs are
make by modifying the appropriate file in the `source` folder within `doc`.
*geopandas* docs us reStructuredText syntax, `which is explained here <http://www.sphinx-doc.org/en/stable/rest.html#rst-primer>`_
*GeoPandas* docs use reStructuredText syntax, `which is explained here <http://www.sphinx-doc.org/en/stable/rest.html#rst-primer>`_
and the docstrings follow the `Numpy Docstring standard <https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_.
Once you have made your changes, you can build the docs by navigating to the `doc` folder and typing::
Once you have made your changes, you may try if they render correctly by
building the docs using sphinx. To do so, you can navigate to the `doc` folder
and type::
make html
The resulting html pages will be located in `doc/build/html`.
The resulting html pages will be located in `doc/build/html`. In case of any
errors, you can try to use `make html` within a new environment based on
environment.yml specification in the `doc` folder. Using conda::
conda env create -f environment.yml
conda activate geopandas_docs
make html
For minor updates, you can skip whole `make html` part as reStructuredText syntax
is usually quite straightforward.
7) Submitting a Pull Request
------------------------------
Once you've made changes and pushed them to your forked repository, you then
submit a pull request to have them integrated into the *geopandas* code base.
submit a pull request to have them integrated into the *GeoPandas* code base.
You can find a pull request (or PR) tutorial in the `GitHub's Help Docs <https://help.github.com/articles/using-pull-requests/>`_.
.. _contributing_style:
Style Guide & Linting
---------------------
GeoPandas follows the `PEP8 <http://www.python.org/dev/peps/pep-0008/>`_ standard
and uses `Black <https://black.readthedocs.io/en/stable/>`_ and
`Flake8 <http://flake8.pycqa.org/en/latest/>`_ to ensure a consistent code
format throughout the project.
Continuous Integration (Travis CI) will run those tools and
report any stylistic errors in your code. Therefore, it is helpful before
submitting code to run the check yourself::
black geopandas
git diff upstream/master -u -- "*.py" | flake8 --diff
to auto-format your code. Additionally, many editors have plugins that will
apply ``black`` as you edit files.
Optionally (but recommended), you can setup `pre-commit hooks <https://pre-commit.com/>`_
to automatically run ``black`` and ``flake8`` when you make a git commit. This
can be done by installing ``pre-commit``::
$ python -m pip install pre-commit
From the root of the geopandas repository, you should then install the
``pre-commit`` included in *GeoPandas*::
$ pre-commit install
Then ``black`` and ``flake8`` will be run automatically
each time you commit changes. You can skip these checks with
``git commit --no-verify``.