.. raw:: html Tutorials ========= Getting started with the Java client library -------------------------------------------- In this tutorial you will create a Maven project that accesses the EDG API using the Java client library. It is based on the Java example. **Create a Maven project** Create a new Maven project with the usual structure (``src/main/java``, et al.) and a pom.xml. The example pom.xml can be used as a guide. .. literalinclude:: ../../example/java/pom.xml :language: xml **Create an entrypoint class** Create an entrypoint class such as ``Main.java`` or ``ClientExample.java`` in ``src/main/java``. .. literalinclude:: ../../example/java/src/main/java/ClientExample.java :language: xml **Configure the client** The example client uses a pre-defined configuration that corresponds to the :ref:`example-edg-server-configuration`. You will need to specify a ``ClientConfiguration`` that corresponds to your EDG installation. See the ``ClientConfiguration`` :ref:`lib-java-apidocs` Javadocs for information on this object. See :ref:`servlet-context-configuration` for a more advanced example. Getting started with the Python client library -------------------------------------------- In this tutorial you will create a Pytho project that accesses the EDG API using the Python client library. It is based on the Python example. **Create a Python project** Create a new directory for your project:: mkdir yourproject Subsequent commands will be executed in this directory. **Create a Python virtual environment** :: python3 -m venv venv The ``venv`` directory should be .gitignored. **Activate the virtual environment** Unix:: source venv/bin/activate Windows:: venv\Scripts\activate **Install the EDG client in the virtual environment** :: cd /path/to/client/repo/lib/py python setup.py install Then change back to your project directory. **Save your project dependencies** Use ``pip freeze`` to record exact versions of your project's dependencies:: pip freeze >requirements.txt Since the virtual environment (``venv``) is not committed to version control, you/your team need a mechanism to re-install exact versions of dependencies. The ``requirements.txt`` serves this purpose. You can re-install the dependencies with:: pip install -r requirements.txt **Create an entrypoint file** The entrypoint should should resemble the client example: .. literalinclude:: ../../example/py/client_example.py :language: py Note the inline comments. **Run the entrypoint** :: python client_example.py