Package: pds-doi-service
NASA PDS DOI ServiceThe Planetary Data System (PDS) Digital Object Identifier (DOI) Service provides tools for PDS operators to mintDOIs.PrerequisitesPython 3.9 or aboveA login to the DOI Service Provider endpoint server (currently DataCite)User DocumentationPlease visit the documentation at:https://nasa-pds.github.io/doi-service/DevelopersJPL Internal WikiGet the code and work on a branch:git clone ...
git checkout -b "#<issue number>"Install a Python virtual environment, say in avenvdirectory:python3 -m venv venv
source venv/bin/activateInstall the package and its dependencies for development into the virtual environment:pip install --editable '.[dev]'If you get an error likesrc/types.h:36:2: error: You need a compatible libgit2 version (1.1.x)then you're probably usingbrew.sh's Python 3.10. Use their Python 3.9 instead.Update your local configuration to access the DOI service provider's test server.Create a file in the base directory of the project namedpds_doi_service.ini; the following may be used as a template[SERVICE]
# Should be set to DataCite (case-insensitive)
provider = datacite

[DATACITE]
# Select the appropriate URL endpoint for either a test or production deployment
url = https://api.test.datacite.org/dois
#url = https://api.datacite.org/dois
user = <contact [PDS Help Desk](https://pds.nasa.gov/?feedback=true)>
password = <contact [PDS Help Desk](https://pds.nasa.gov/?feedback=true)>
doi_prefix = 10.17189
validate_against_schema = True

[OSTI]
# This section is kept for posterity, but should be ignored as OSTI is no longer a supported endpoint
url = https://www.osti.gov/iad2test/api/records
#url = https://www.osti.gov/iad2/api/records
user = <contact [PDS Help Desk](https://pds.nasa.gov/?feedback=true)>
password = <contact [PDS Help Desk](https://pds.nasa.gov/?feedback=true)>
doi_prefix = 10.17189
validate_against_schema = True

[PDS4_DICTIONARY]
url = https://pds.nasa.gov/pds4/pds/v1/PDS4_PDS_JSON_1D00.JSON
pds_node_identifier = 0001_NASA_PDS_1.pds.Node.pds.name

[API_AUTHENTICATION]
# Add the issuer of the oauth tokens, for cognito https://cognito-idp.<aws-region>.amazonaws.com/<userpoolID>
jwt_issuer =
# Add the entire content of the JSON file at https://cognito-idp.<aws-region>.amazonaws.com/<userpoolID>/.well-known/jwks.json
json_web_key_set =
jwt_lifetime_seconds = 3600
jwt_algorithm = RS256

[OTHER]
logging_level = INFO
doi_publisher = NASA Planetary Data System
global_keyword_values = PDS,PDS4
pds_uri = https://pds.nasa.gov/pds4/pds/v1/
transaction_dir = ./transaction_history
db_file = doi.db
db_table = doi
api_host = 0.0.0.0
api_port = 8080
api_valid_referrers =
emailer_local_host = localhost
emailer_port       = 25
emailer_sender     = pdsen-doi-test@jpl.nasa.gov
emailer_receivers  = pdsen-doi-test@jpl.nasa.govLaunch API serverTo run the DOI API server, try:$pipinstallpds-doi-service$pds-doi-apiThe started service documentation is available onhttp://localhost:8080/PDS_APIs/pds_doi_api/0.2/ui/👉Note:When theapi_valid_referrersoption is set inpds_doi_service.ini, this service documentation UI will be unavailable.Running with DockerTo run the server on a Docker container, please execute the following from the package directory:$# building the image$dockerimagebuild--tagpds-doi-service.$# starting up a container$dockercontainerrun--publish8080:8080pds-doi-serviceHowever, note that when launching the container viadocker container run, all configuration values are derived from the default INI file bundled with the repository. To override the configuration, it is recommended to launch the service via a Docker Composition:$# Make a copy of the docker composition environment template:$cpdoi_service.env.indoi_service.env$# Edit the environment file, setting the credentials within:$vidoi_service.env$# Start the composition; on some systems, `docker compose` is `docker-compose`:$dockercomposeupThis will launch the DOI Service container using the top-leveldocker-compose.ymlfile, which specifies that environment variables be imported fromdoi_service.env. Modifydoi_service.env(after copying it fromdoi_service.env.in) to define any configuration values to override when the service is launched.TestTesting details are detailed in this section.Tox (for developers)N.B. Updates to pip dependencies are not automatically applied to existing tox virtual environments, to keep unit testing fast.  The simplest way to propagate dependency updates is to delete./.toxand run tox again.toxis installed automatically duringpip install --editable .[dev], and provides virtual environments and run configurations forunit/functional testinglintingbuilding the rich documentation.To launch the full set of tests, simply run:toxYou can also run individual components:$tox-etests# Run unit, functional, and integration tests$tox-elint# Run flake8, mypy, and black code reformatting$tox-edocs# Build the documentation to see if that worksIt is strongly recommended to addtox -e lintto yourpre-commitgit hook, andtox -e testsin apre-pushhook, as only linted and test-passing PRs will be merged.The following linting example is provided for ease of use:STAGED_FILES=$(gitdiff--cached--name-only--diff-filter=ACM|grep".py$")echo"Linting files"tox-elint
gitadd$STAGED_FILES# add any lint-related changes to the current commitif[$?-ne0]thenecho"Initial lint detected errors, re-linting to determine whether errors remain"tox-elintif[$?-ne0]thenexit1fifiexit0You can also runpytest,sphinx-build,mypy, etc., if that's more your speed.Behavioral testing (for Integration & Testing)Behavioral tests are also pre-installed in the Python virtual environment when you runpip install --editable .[dev]. Launch those by running:behaveNote this will download reference test data. If they need to be updated you have to first remove your local copy of the reference data (test/aaDOI_production_submitted_labels)You can also run them for a nicer reporting:behave -f allure_behave.formatter:AllureFormatter -o ./allure ./features
allure service allure👉Note:This assumes you haveAllure Test Reportingframework installed.Testrail ReportingTest reports can be pushed toTestrailProject: Planetary Data System (PDS)
Test suite: pds-doi-serviceSet your environment:export TESTRAIL_USER=<your email in testrail>
export TESTRAIL_KEY=<your API key in tesrail>Run the tests:behaveSee the results inhttps://cae-testrail.jpl.nasa.gov/testrail/index.php?/projects/overview/168👉Note:This assumes you have access to theJet Propulsion Laboratory's Testrail installation.Documentation ManagementDocumentation about the documentation is described in this section.DesignSee in this repository:https://github.com/NASA-PDS/pds-doi-service/tree/main/docsor thedocsdirectory in the source package.User DocumentationUser documentation is managed with Sphinx, which is also installed in your Python virtual environment when you runpip install --editable .[dev]. You can usetoxas described above to make the docs, or by hand at any time by running:sphinx-build -ab html docs/source docs/buildBuild & ReleaseThe build and release process is managed byGitHub Actionsand theRoundup.