Serializing plots.
Project description
Overview
[[TOC]]
Installation
Install Plot Serializer with pip:
pip install plot-serializer
Contributing
Clone this repository with
git clone git@git.rwth-aachen.de:rdm-tools/plot-serializer.git
Creating the virtual environment
On Windows, run
py -m venv env
The second argument is the location to create the virtual environment. Generally, you can just create this in your project and call it env.
venv will create a virtual Python installation in the env folder.
Before you can start installing or using packages in your virtual environment you’ll need to activate it. Activating a virtual environment will put the virtual environment-specific python and pip executables into your shell’s PATH.
.\env\Scripts\activate
You can confirm you’re in the virtual environment by checking the location of your Python interpreter:
where python
Tell pip to install all of the packages in the requirements.txt
file using the -r flag:
py -m pip install -r requirements.txt
Update the requirements.txt
file when you install new packages.
For more detailed instructions, check https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/.
Linting
This project uses the flake8
linter and the black
autoformatter.
Documentation
Documentation is an essential part of writing code.
:warning: All public functions, methods, classes and modules must be properly documented with docstrings.
This project uses google
-style docstrings. An example for a good docstring:
def find_largest_distance(point, polygon):
"""Finds the largest distance between a point and the edges of a polygon.
Args:
point (shapely.geometry.Point): shapely point object
polygon (shapely.geometry.Polygon): shapely polygon object
Returns:
float: the largest distance between a point and the edges of a polygon
"""
distance_list = np.array([])
for poly_point in list(zip(*polygon.exterior.coords.xy)):
distance = point.distance(Point(poly_point))
distance_list = np.append(distance_list, distance)
max_distance = max(distance_list)
return max_distance
because:
- short and easy to understand description
- starts with a verb in third person
-
type
of the args are given - args and returns are described sufficiently
Where necessary, add additional information using comments.
Naming Convention
Follow Guido's recommendations (taken from Google Python Styleguide):
Type | Public | Internal |
---|---|---|
Packages | lower_with_under |
|
Modules | lower_with_under |
_lower_with_under |
Classes | CapWords |
_CapWords |
Exceptions | CapWords |
|
Functions | lower_with_under() |
_lower_with_under() |
Global/Class Constants | CAPS_WITH_UNDER |
_CAPS_WITH_UNDER |
Global/Class Variables | lower_with_under |
_lower_with_under |
Instance Variables | lower_with_under |
_lower_with_under (protected) |
Method Names | lower_with_under() |
_lower_with_under() (protected) |
Function/Method Parameters | lower_with_under |
|
Local Variables | lower_with_under |
For better readability, use meaningful, expressive names instead of hard-to-understand short names. Don’t drop letters from your source code. Although dropped letters in names like memcpy
(memory copy) and strcmp
(string compare) were popular in the C programming language before the 1990s, they’re an unreadable style of naming that you shouldn’t use today. If a name isn’t easily pronounceable, it isn’t easily understood.
Additionally, feel free to use short phrases that can make your code read like plain English. For example, number_of_trials
is more readable than simply number_trials
.
Use a spell checker.
Code Structure
The maximum line length is 120 characters.
Whitespaces should be automatically deleted; the autoformatter should take care of this.
Improve readability by limiting the number of nested statements.
Preferrably write short functions, and pure functions that can be tested.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file plot-serializer-0.1.0.tar.gz
.
File metadata
- Download URL: plot-serializer-0.1.0.tar.gz
- Upload date:
- Size: 17.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f869b4b1e702daee51ca6c6bd60e28e5968746e960bc56aac02fe04aa451e1e |
|
MD5 | b700d2e0d2844a979fd4dbdfb0db2573 |
|
BLAKE2b-256 | 0c3dd2f2b39830ab5cab004c956a64586ca12a1e194ab3743a354ca185ddbc59 |
File details
Details for the file plot_serializer-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: plot_serializer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 400b08400c40b61a51cda63fe176394f91f8035d1b1af1aa9e55c6a2b05aebed |
|
MD5 | 452dddd5612c5f056769710cd003e83e |
|
BLAKE2b-256 | 36bd02e94f8bc236db6e63d9c64861cb865e8385760b81f87ba2c5e0b394afdf |