pybikes

bike sharing + python = pybikes

https://github.com/eskerda/pybikes

Science Score: 36.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 107 committers (1.9%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.0%) to scientific vocabulary

Keywords from Contributors

data-mining langchain cycling
Last synced: 10 months ago · JSON representation

Repository

bike sharing + python = pybikes

Basic Info
  • Host: GitHub
  • Owner: eskerda
  • License: agpl-3.0
  • Language: Python
  • Default Branch: master
  • Homepage: https://citybik.es
  • Size: 2.47 MB
Statistics
  • Stars: 588
  • Watchers: 32
  • Forks: 174
  • Open Issues: 27
  • Releases: 0
Created almost 16 years ago · Last pushed 10 months ago
Metadata Files
Readme License

README.md

pybikes Build Status

Chat on Matrix

pybikes

pybikes provides a set of tools to scrape bike sharing data from different websites and APIs, thus providing a coherent and generalized set of classes and methods to access this sort of information.

The library is distributed and intended mainly for statistics and data sharing projects. More importantly, it powers the CityBikes project, and is composed of a set of classes and a pack of data files that provide instances for all different systems.

Installation

Install from PyPI:

bash pip install pybikes

Install directly from GitHub: bash pip install git+https://github.com/eskerda/pybikes.git

Or after downloading/cloning the source: bash pip install .

Usage

```python

import pybikes

Capital BikeShare instantiation data is in bixi.json file

capital_bikeshare = pybikes.get('capital-bikeshare')

The instance contains all possible metadata regarding this system

print(capital_bikeshare.meta) { 'name': 'Capital BikeShare', 'city': 'Washington, DC - Arlington, VA', 'longitude': -77.0363658, 'system': 'Bixi', 'company': ['PBSC'], 'country': 'USA', 'latitude': 38.8951118 }

The update method retrieves the list of stations

print(len(capitalbikeshare.stations)) 0 capitalbikeshare.update() print(len(capitalbikeshare.stations)) 191 print(capitalbikeshare.stations[0]) --- 31000 - 20th & Bell St --- bikes: 7 free: 4 latlng: 38.8561,-77.0512 extra: { 'installed': True, 'uid': 1, 'locked': False, 'removalDate': '', 'installDate': '1316059200000', 'terminalName': '31000', 'temporary': False, 'name': '20th & Bell St', 'latestUpdateTime': '1353454305589' } ```

Some systems might require an API key to work (for instance, Cyclocity). In these cases, the instance factory can take an extra API key parameter.

```python

key = "This is not an API key" dublinbikes = pybikes.get('dublinbikes', key) ```

Note that pybikes works as an instance factory and, choicely, instances can be generated by passing the right arguments to the desired class

```python

from pybikes.cyclocity import BixiSystem capitalbikeshare = BixiSystem( tag = 'footag', root_url = 'http://capitalbikeshare.com/data/stations/', meta = {'foo':'bar'} ) ```

The way information is retrieved can be tweaked using the PyBikesScraper class included on the utils module thus allowing session reusing and niceties such as using a proxy. This class uses Requests module internally.

```python

scraper = pybikes.utils.PyBikesScraper() scraper.enableProxy() scraper.setProxies({ "http" : "127.0.0.1:8118", "https": "127.0.0.1:8118" }) scraper.setUserAgent("Walrus™ v3.0") scraper.headers['Foo'] = 'bar' capital_bikeshare.update(scraper) ```

Tests

Tests are separated between unit tests and integration tests with the different sources supported.

To run unit tests simply

bash make test

To run integration tests

bash make test-update

Note that some systems require authorization keys, tests expect these to be set as environment variables like:

```bash PYBIKESCYCLOCITY='some-api-key' PYBIKESDEUTSCHEBAHNCLIENTID='some-client-id' PYBIKESDEUTSCHEBAHNCLIENT_SECRET='some-client-secret'

or if using an .env file

source .env

make test-update ```

This project uses pytest for tests. Test a particular network by passing a filter expresson

bash pytest -k bicing pytest -k gbfs

To speed up tests execution, install pytest-xdist to specify the number of CPUs to use

bash pytest -k gbfs -n auto

To use Makefile steps and pass along pytest arguments, append to the T_FLAGS variable

bash make test-update T_FLAGS+='-n 10 -k gbfs'

Integration tests can generate a json report file with all extracted data stored as geojson. Using this json report file, further useful reports can be generated like a summary of the overall health of the library or a map visualization of all the information.

For more information on reports see utils/README.md

Development

We welcome contributions from the community! The best place to get started is by diving into the codebase or checking the issues list.

Join our developer community on Matrix: #citybikes:matrix.org

Owner

  • Name: eskerda
  • Login: eskerda
  • Kind: user
  • Location: Barcelona

GitHub Events

Total
  • Issues event: 26
  • Watch event: 34
  • Delete event: 18
  • Issue comment event: 66
  • Push event: 73
  • Pull request event: 86
  • Pull request review event: 7
  • Pull request review comment event: 9
  • Fork event: 7
  • Create event: 21
Last Year
  • Issues event: 26
  • Watch event: 34
  • Delete event: 18
  • Issue comment event: 66
  • Push event: 73
  • Pull request event: 86
  • Pull request review event: 7
  • Pull request review comment event: 9
  • Fork event: 7
  • Create event: 21

Committers

Last synced: 11 months ago

All Time
  • Total Commits: 1,311
  • Total Committers: 107
  • Avg Commits per committer: 12.252
  • Development Distribution Score (DDS): 0.435
Past Year
  • Commits: 116
  • Committers: 10
  • Avg Commits per committer: 11.6
  • Development Distribution Score (DDS): 0.345
Top Committers
Name Email Commits
eskerda e****a@g****m 741
Martín González Gómez m****z@n****m 127
eduardom e****i@g****m 64
Altonss 6****s 53
Jean-Luc Tibaux e****c@o****e 20
felix.gravet f****t@g****r 17
Adam Danielczyk 1****k 15
Benjamin Stolte b****e@i****e 14
bparmentier d****v@b****e 13
Ortwin Gentz g****z@f****m 13
Emmanuel Haguet M****0 10
Lev Aronsky a****y@g****m 9
Hugo h****k 9
R0nd r****1@g****m 7
bcaller b****r 7
Olav Alexander Mjelde o****e@g****m 7
Mauricio Maia m****a@g****m 7
Martin Ichilevici de Oliveira m****a@g****m 7
Anastasios Mag a****s@m****m 6
Maximilian Richt m****i@r****e 6
Ulrich Stroetz u****z@g****m 5
João Pereira 6****p 5
Gabor Szathmari g****i@g****m 5
Kostiantyn Plakhotia k****l 4
Snarkorel s****7@m****u 4
thesebas t****s@t****t 4
François FERREIRA DE SOUSA f****s@f****r 4
Igor Matos i****s@l****m 4
Daniel Korp d****p@b****t 4
thomas t****r@o****r 4
and 77 more...

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 212
  • Total pull requests: 648
  • Average time to close issues: over 1 year
  • Average time to close pull requests: about 2 months
  • Total issue authors: 93
  • Total pull request authors: 113
  • Average comments per issue: 2.49
  • Average comments per pull request: 1.34
  • Merged pull requests: 563
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 19
  • Pull requests: 98
  • Average time to close issues: 10 days
  • Average time to close pull requests: 1 day
  • Issue authors: 8
  • Pull request authors: 10
  • Average comments per issue: 1.05
  • Average comments per pull request: 0.63
  • Merged pull requests: 85
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • eskerda (60)
  • Altonss (18)
  • futuretap (5)
  • Manu1400 (5)
  • nixta (4)
  • Gabriel44200 (4)
  • tuxayo (4)
  • habi (3)
  • rolinger (3)
  • homtec (3)
  • bcaller (3)
  • arrobaraujo (3)
  • MichalPP (3)
  • f8full (3)
  • innovimax (2)
Pull Request Authors
  • eskerda (213)
  • martgnz (140)
  • edumucelli (47)
  • Altonss (46)
  • Ephtolens (24)
  • BenSto (14)
  • Manu1400 (13)
  • adamdanielczyk (10)
  • eUgEntOptIc44 (9)
  • futuretap (8)
  • anastmag (7)
  • bparmentier (7)
  • joaodcp (6)
  • 1Maxnet1 (5)
  • bcaller (5)
Top Labels
Issue Labels
accepted (2) experimental (2) feature (1) bug (1)
Pull Request Labels
dependencies (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 30 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 7
  • Total maintainers: 1
pypi.org: pybikes

A python library for scraping bike sharing data

  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 30 Last month
Rankings
Dependent packages count: 9.3%
Average: 30.7%
Dependent repos count: 52.1%
Maintainers (1)
Last synced: 10 months ago

Dependencies

requirements.txt pypi
  • flake8 *
  • jinja2 *
  • mock *
  • pytest *
  • pytest-json-report *
  • pytest-xdist *
setup.py pypi
  • cssselect >=0.9
  • lxml *
  • requests >=2.20.0
  • shapely >=1.5.13
.github/workflows/test.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
.github/workflows/test_python2.yml actions
  • MatteoH2O1999/setup-python v1 composite
  • actions/checkout v3 composite