Package: pyaurorax
PyAuroraX is a Python library for interacting withAuroraX, a project working to be the world's first and foremost data platform for auroral science. The primary objective of AuroraX is to enable mining and exploration of existing and future auroral data, enabling key science and enhancing the benefits of the world's investment in auroral instrumentation. This will be accomplished with the development of key systems/standards for uniform metadata generation and search, image content analysis, interfaces to leading international tools, and a community involvement that includes more than 80% of the world's data providers.PyAuroraX officially supports Python 3.7, 3.8, 3.9, and 3.10Some links to help:AuroraX main websitePyAuroraX documentationPyAuroraX API ReferenceInstallationPyAuroraX is available on PyPI so pip can be used to install it:$pipinstallpyauroraxTo get full functionality, you can install PyAuroraX with the aacgmv2 dependency. Note that without this, the calculate_btrace methods in the util module will show warning messages. All other functionality will work without this dependency.$pipinstallpyaurorax[aacgmv2]Futhermore, if you want the most bleeding edge version of PyAuroraX, you can install it directly from the Github repository:$gitclonehttps://github.com/aurorax-space/pyaurorax.git$cdpyaurorax$pipinstall.[ or with the aacgmv2 extra ]$pipinstall.[aacgmv2]UsageThere are two things you can use as part of the PyAuroraX library: the main library, and the command line tool.Library importYou can import the library using the following statement:>>>importpyauroraxCLI programThe programaurorax-cliis included in the PyAuroraX package as a command line tool. Try it out using:$ aurorax-cli --helpDevelopmentSome common things you can do:make updateUpdate the Python dependency librariestools/bump_version.pyBump the version numbermake test-pytest-unauthorized-accessOnly run the authorization testsmake test-pytest-readOnly run the read-based testsmake test-pytest-create-update-deleteOnly run the write-based testsmake docsGenerate pdoc documentationSetupClone the repository and install primary and development dependencies using Poetry.$gitclonegit@github.com:aurorax-space/pyaurorax.git$cdpyaurorax$python-mpipinstallpoetry$poetryinstall-Eaacgmv2DocumentationDocumentation for the PyAuroraX project is managed by a separate repositoryhere. However, you are still able to generate the documentation for this repo for testing/development purposes. To generate the docs, run the following:$makedocsTestingPyAuroraX includes several test evaluations bundled into two groups: linting and functionality tests. The linting includes looking through the codebase using tools such as Flake8, PyLint, Pycodestyle, Bandit, and MyPy. The functionality tests use PyTest to test modules in the library.When running the functionality tests using PyTest, you must have the environment variableAURORAX_APIKEY_STAGINGset to your API key on the staging API system. Alternatively, you can specifiy your API key using the command line (see example at the bottom of this section).There exist several makefile targets to help run these tests quicker/easier. Below are the available commands:make test-lintingRun all linting testsmake test-pytestRun all automated functional testsmake test-flake8Run Flake8 styling testsmake test-pylintRun PyLint styling testsmake test-pycodestyleRun pycodestyle styling testsmake test-banditRun Bandit security testmake test-mypyRun mypy type checking testmake test-coverageView test coverage report (must be done aftermake test-pytestor other coverage command)The PyTest functionality tests include several categories of tests. You can run each category separately if you want using the "markers" feature of PyTest. All markers are found in the pytest.ini file at the root of the repository.poetry run pytest --markersList all markerspoetry run pytest -v -m accountsPerform only the tests for the "accounts" markerpoetry run pytest -v -m availabilityPerform only the tests for the "availability" markerpoetry run pytest -v -m conjunctionsPerform only the tests for the "conjunctions" markerpoetry run pytest -v -m ephemerisPerform only the tests for the "ephemeris" markerpoetry run pytest -v -m exceptionsPerform only the tests for the "exceptions" markerpoetry run pytest -v -m locationPerform only the tests for the "location" markerpoetry run pytest -v -m metadataPerform only the tests for the "metadata" markerpoetry run pytest -v -m requestsPerform only the tests for the "request" markerpoetry run pytest -v -m sourcesPerform only the tests for the "sources" markerpoetry run pytest -v -m utilPerform only the tests for the "util" markerBelow are some more commands for advanced usages of PyTest.poetry run pytest -vRun all tests in verbose modepoetry run pytest --collect-onlyList all available testspoetry run pytest --markersList all markers (includes builtin, plugin and per-project ones)cat pytest.iniList custom markerspoetry run pytest tests/test_suite/ephemeris/test_ephemeris.py::test_get_request_url -vRun a single specific testYou can also run Pytest against a different API. By default, it runs agains the staging API, but you can alternatively tell it to run against the production API, or a local instance.poetry run pytest -v --env=productionRun all tests against production API, using the AURORAX_APIKEY_PRODUCTION environment variablepoetry run pytest --env=local --host=http://localhost:3000Run all tests against a local instance of the API, using the AURORAX_APIKEY_LOCAL environment variablepoetry run pytest -v --api-key=SOME_API_KEYRun all tests with the specified API key (will run against the staging API since that's the default)poetry run pytest --helpView usage for pytest, including the usage for custom options (see the 'custom options' section of the output)Below are some more commands for evaluating the PyTest coverage.poetry run coverage reportView test coverage reportpoetry run coverage htmlGenerate an HTML page of the coverage reportpoetry run coverage report --show-missingView the test coverage report and include the lines deemed to be not covered by testsNote that the coverage report only gets updated when using the Makefile pytest targets, or when running coverage manually likecoverage run -m pytest -v. More information about usage of thecoveragecommand can be foundhere.Publishing new releaseTo publish a new release, you must set the PyPI token first within Poetry and then upload the new package:$poetryconfigpypi-token.pypi<pypitoken>$makepublish