Skip to content

Commit

Permalink
Added poetry and lock pyparsing to ^2.4.7. (#86)
Browse files Browse the repository at this point in the history
Summary:
I think it's a good idea to revisit the discussion from facebookarchive/python-nubia#20. The tools have matured and considering the current state of Nubia, this would at least fix the problems we are having. Using poetry is considerably simpler and [distutils is deprecated](https://www.python.org/dev/peps/pep-0632/).

The following changes are also included:
* All dependencies have been set to the latest version and pyparsing to `^2.4.7` as `3.x` is not supported right now.

Resolves facebookarchive/python-nubia#85.

Pull Request resolved: facebookarchive/python-nubia#86

Reviewed By: AhmedSoliman

Differential Revision: D32879106

Pulled By: AndreasBackx

fbshipit-source-id: e07de2b1eaba3a9e82a5d12493a7079297e42727
  • Loading branch information
vinspam committed Dec 6, 2021
1 parent 1f5d364 commit e1755fc
Show file tree
Hide file tree
Showing 8 changed files with 636 additions and 124 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ name: Nubia Build

on: [push, pull_request]
jobs:
build:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8]

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
- name: Test with nosetests
run: |
nosetests --with-coverage --cover-package=nubia
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install poetry
uses: abatilo/[email protected]
- name: Install dependencies
run: |
poetry install
- name: Test with nosetests
run: |
poetry run nosetests --with-coverage --cover-package=nubia
30 changes: 13 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,42 +70,38 @@ async def lookup(hosts: typing.List[str], bad_name: int) -> int:

## Requirements

Nubia-based applications require python 3.7+ and works with both Mac OS X or Linux. While in theory it should work on Windows, it has never been tried.
Nubia-based applications require Python 3.7+ and works with both Mac OS X or Linux. While in theory it should work on Windows, it has never been tried.

## Installing Nubia

If you are installing nubia for your next project, you should be able to easily use pip for that:
```bash
pip3 install python-nubia
pip install python-nubia
```

## Building Nubia from source

You can either setup.py to build a tarball, or use pipenv to setup a virtualenv with all the dependencies installed.
```bash
poetry build
```

## Running example in virtualenv:

It's often best to create a virtualenv to contain the dependencies required for python-nubia project.
```bash
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```
_We recommend setting up a separate Python environment using a tool like virtualenv, pyenv-virtualenv, or `poetry shell`._

If you would like to run the example, then you need to add the root of the source tree into your PYTHONPATH.
```bash
virtualenv .venv
source .venv/bin/activate

export PYTHONPATH="$(pwd)"
python3 example/nubia_example.py
If you would like to run the example, install the dependencies and run the example module as a script.

```bash
poetry install
cd example
python -m nubia_example
```

To run the unit tests:

From within the virtualenv you can use nosetests:
```bash
nosetests
poetry run nosetests
```

## Getting Started
Expand Down
9 changes: 0 additions & 9 deletions build.sh

This file was deleted.

Loading

0 comments on commit e1755fc

Please sign in to comment.