Generate resolver code for VSS GraphQL Schema and deploy map.
For this project you will need to have:
- Python 3.8.5 or later
- Pip
- Pipenv
If you don't have Python installed already I suggest you to use pyenv to install Python by using this following command:
pyenv install <desired py version>
Then in this repo's folder there should be a .python-version
file that describes
the version of python to be used, in our repo there is this file with the version 3.8.5
written. If you want to create this file by yourself and use a specific version you can run:
pyenv local <desired py version>
Make sure you have pip installed too. To check you can run
python3 -m pip -V
and see the version of your pip. Make sure your pip is updated with
python3 -m pip install --upgrade pip
If you don't have you can install with
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall
To install Pipenv just run
python3 -m pip install --user pipenv
And pipenv will be installed as a python package under the --user
flag and you
will be able to run python3 -m pipenv --help
.
It is a good practice to set on your .bashrc
(or other, see note 2), the
variable which configures PIPENV
to always create the virtual environment
inside a .env
folder the project.
echo "export PIPENV_VENV_IN_PROJECT=1" >> ~/.bashrc
source ~/.bashrc
Note 1: When you install pipenv using pip with
--user
flag, you are installing pipenv under a folder.local
under your home directory, so if your system does not recognize pipenv as a command, it's maybe because your$PATH
variable does not see this.local
folder. One alternative is to add this line to your.bashrc
(or similar please see note 2) file as follows:echo "export PATH=$PATH:$HOME/.local/bin" >> ~/.bashrc source ~/.bashrcand you will be able to run pipenv directly. If you prefer you can always just use:
python3 -m pipenvwhen you want to just run pipenv
Note 2: Every time
.bashrc
is referred here in this file, we are talking about the file that runs when your terminal is open, this file may change depending on the system and what shell you are using, this may be~/.bash_profile
or./zsh
.
To install the project and dependencies you can run the following command:
pipenv sync
This command will install this package and its dependencies under your pipenv
isolated environment (.env
folder if you followed Note 1). Then you can run
commands of this environment with pipenv run <command in environment>
.
To run the program please cd
to root path of this project and run:
pipenv run graphql_schema2cpp_codegen --help
and
pipenv run vssdeploy2json --help
To install dev packages one may run:
pipenv sync -d
One may format with autopep8 with command-line:
autopep8 --in-place --aggressive --aggressive file.py
And to check linting you can run:
pipenv run flake8 --config setup.cfg file.py
To use mypy you can run:
pipenv run mypy --config-file ./setup.cfg file.py
To run nosetests you can run:
pipenv run nosetests --with-doctest file.py