Giter Club home page Giter Club logo

pyimporter-starter-template's Introduction

PyImporter-Starter-Template

Starter template for PyImporter, the CollectiveAccess Python-based importer.

This starter template:

  • creates a new repo with a directory structure and environmental variables to use PyImporter.
  • downloads the latest version of PyImporter as a git submodule
  • includes a demo import script and demo data to show how to use Pyimporter
  • includes a template that you can use to create your own import script
  • sets up pytest for testing
  • sets up flake8 and black for code linting

Installation part 1

  1. Clone this repo

  2. Run the pyimporter_create.py to create a new directory, download the latest version of PyImporter, and create the first commit.

python pyimporter_create.py

You can use absolute or relative paths when the prompt asks for a path for the new directory.

Generated files and directories

pyimporter_create.py creates a new directory that you can use to import your data files.

Installation part 2

  1. Install the required packages for the directory created by pyimporter_create.py. You can use the virtual environment / package manager of your choice.
cd path/to/generated/directory
pip install -r requirements.txt
  1. Setup environmental variables.

We are using python-dotenv to handle environmental variables. Copy .env_example, rename to .env, and fill in the envars.

Read PyImporter environmental variables for more info the required envars.

  1. Read the PyImporter docs for instructions on how to use PyImporter. Examine the demo import script (./scripts/demo.py) and data (./data/demo.csv) to see an example of how to use PyImporter.

  2. Copy ./scripts/template.py to serve as a starting point for your import scripts.

Directories/Files

These are the files and directories generated by pyimporter_create.py.

  • /data - Demo data to show how to use PyImporter. For your project, you can store the data files anywhere you want.
  • /logs - Log files.
  • /PyImporter - Git submodule for PyImporter.
  • /scripts - Your scripts that will use PyImporter to import data. You should create a separate import script for each CollectiveAccess table and type.
    • /bulk_import - Bash script to run all the import scripts.
    • config.py - Setup paths and envars for /scripts.
    • demo.py - Demo import script to show how to use PyImporter.
    • template.py - A basic template you can copy to create your import scripts.
  • /tests - Optional tests for /scripts. We are using pytest.
  • .env_example - Example .env file
  • .gitignore
  • .gitmodules
  • conftest.py - Configuration for pytest.
  • linter.py - Script to lint /scripts and /tests using black and flake8.
  • requirements.txt - List of packages required by the starter template and PyImporter.
  • secrets.json - File created by PyImporter to store JWT tokens.
  • setup.cfg - Configuration for the linters.

Testing

Run tests using pytest.

pytest

Run linter (flake8) and code formatter (black).

python linter.py

Updating PyImporter

To update the PyImporter submodule:

git submodule update --remote PyImporter

pyimporter-starter-template's People

Contributors

collectiveaccess avatar wykhuh avatar

Watchers

 avatar  avatar  avatar

pyimporter-starter-template's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.