Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions .github/workflows/dev_test_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10.9'

# changes
python-version: '3.13.12'

- name: Install pypa/build
run: |
Expand All @@ -81,16 +79,6 @@ jobs:
name: python-package-distributions
path: dist/

# - name: Install latest pip, setuptools, twine + wheel
# run: |
# python -m pip install --upgrade pip setuptools wheel >> $GITHUB_STEP_SUMMARY

# - name: Build wheels
# run: |
# python setup.py bdist_wheel >> $GITHUB_STEP_SUMMARY
# python setup.py sdist >> $GITHUB_STEP_SUMMARY


publish-to-testpypi:
name: Publish 📦 to TestPyPI
needs:
Expand All @@ -116,14 +104,3 @@ jobs:
repository-url: https://test.pypi.org/legacy/
verbose: true
skip-existing: true

# - name: GitHub Repo Artifact Upload
# uses: actions/upload-artifact@v4
# with:
# name: Wheel_library
# path: dist/

# - name: Publish package to TestPyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# repository-url: https://test.pypi.org/legacy/
100 changes: 59 additions & 41 deletions .github/workflows/main_test_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,64 +20,82 @@ env:

jobs:

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# test:
# name: Test
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10.9'
# - name: Set up Python
# uses: actions/setup-python@v3
# with:
# python-version: '3.10.9'

- name: Install latest PIP
run: |
python -m pip install --upgrade pip >> $GITHUB_OUTPUT
# - name: Install latest PIP
# run: |
# python -m pip install --upgrade pip

- name: Install Dependencies
run: |
python -m pip install pytest pytest-cov >> $GITHUB_OUTPUT
# - name: Install Dependencies
# run: |
# python -m pip install pytest pytest-cov

- name: Setup factiva-analytics <MAIN> (this repo)
run: |
python -m pip install -e . >> $GITHUB_OUTPUT
# - name: Setup factiva-analytics <MAIN> (this repo)
# run: |
# python -m pip install -e .

- name: pytest
run: pytest test/
# - name: pytest
# run: pytest test/

build:
name: Build and Publish
name: Build 📦
runs-on: ubuntu-latest
needs: [test]
# needs: [test]
permissions:
id-token: write
steps:
- name : Checkout code
uses : actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.10.9'
python-version: '3.12'

- name: Install latest pip, setuptools, twine + wheel
- name: Install pypa/build
run: |
python -m pip install --upgrade pip setuptools wheel >> $GITHUB_OUTPUT

- name: Build wheels
python -m pip install --upgrade build
- name: Build a binary build and a source tarball
run: |
python setup.py bdist_wheel >> $GITHUB_OUTPUT
python setup.py sdist >> $GITHUB_OUTPUT

- name: Upload Artifact
uses: actions/upload-artifact@v3
python -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: Wheel_library
name: python-package-distributions
path: dist/

- name: Publish package to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: false
publish-to-pypi:
name: Publish 📦 to TestPyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: pypi
url: https://test.pypi.org/p/factiva-analytics

permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
skip-existing: true
2 changes: 1 addition & 1 deletion src/factiva/analytics/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.4.1'
__version__ = '0.4.2'
25 changes: 18 additions & 7 deletions src/factiva/analytics/taxonomy/factiva_taxonomies.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,25 @@ class FactivaTaxonomyCategories(Enum):

from factiva.analytics import FactivaTaxonomyCategories
FactivaTaxonomyCategories.SUBJECTS
FactivaTaxonomyCategories.SUBJECTS_HIERARCHY
FactivaTaxonomyCategories.REGIONS
FactivaTaxonomyCategories.COMPANIES
FactivaTaxonomyCategories.REGIONS_HIERARCHY
FactivaTaxonomyCategories.INDUSTRIES
FactivaTaxonomyCategories.INDUSTRIES_HIERARCHY
FactivaTaxonomyCategories.COMPANIES
FactivaTaxonomyCategories.EXECUTIVES
FactivaTaxonomyCategories.SOURCES

"""
SUBJECTS = 'hierarchySubject'
REGIONS = 'hierarchyRegion'
INDUSTRIES = 'hierarchyIndustry'
SUBJECTS_HIERARCHY = 'hierarchySubject'
SUBJECTS = 'news_subjects'
REGIONS_HIERARCHY = 'hierarchyRegion'
REGIONS = 'regions'
INDUSTRIES_HIERARCHY = 'hierarchyIndustry'
INDUSTRIES = 'industries'
COMPANIES = 'companies'
EXECUTIVES = 'executives'
SOURCES = 'sources'


class FactivaTaxonomy():
Expand Down Expand Up @@ -245,11 +253,14 @@ def download_raw_category(self, category:FactivaTaxonomyCategories, path=None, f
if not isinstance(file_format, str):
raise ValueError('The file_format parameter must be a string')
file_format = file_format.lower()
if file_format not in ['csv', 'avro']:
raise ValueError('The file_format parameter must be either csv or avro.')
if file_format not in ['csv', 'avro', 'json']:
raise ValueError('The file_format parameter must be either csv, avro, or json.')
if not path:
path = os.getcwd()
endpoint = f"{self.__TAXONOMY_BASEURL}/{category.value}/{file_format}"
if category.value in [FactivaTaxonomyCategories.COMPANIES, FactivaTaxonomyCategories.REGIONS]:
endpoint = f"{self.__TAXONOMY_BASEURL}/{category.value}/{file_format}?extended=true"
else:
endpoint = f"{self.__TAXONOMY_BASEURL}/{category.value}/{file_format}"
download_headers = {
'user-key': self.user_key.key
}
Expand Down
Loading