From 532dbd03fb75e4fcda1b4ff62a5fb8ff1e7d2557 Mon Sep 17 00:00:00 2001 From: Miguel Ballesteros Date: Wed, 14 Jan 2026 10:25:28 -0500 Subject: [PATCH 1/3] Added support to hierarchies and extended --- .../analytics/taxonomy/factiva_taxonomies.py | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/factiva/analytics/taxonomy/factiva_taxonomies.py b/src/factiva/analytics/taxonomy/factiva_taxonomies.py index d957983..07e9209 100644 --- a/src/factiva/analytics/taxonomy/factiva_taxonomies.py +++ b/src/factiva/analytics/taxonomy/factiva_taxonomies.py @@ -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(): @@ -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 } From adbe0e8b6c438d03561f34c541e8a898a915712f Mon Sep 17 00:00:00 2001 From: Miguel Ballesteros Date: Thu, 26 Mar 2026 04:02:31 +0100 Subject: [PATCH 2/3] Optimised pypi publish action without test --- .github/workflows/dev_test_publish.yml | 25 +----- .github/workflows/main_test_publish.yml | 100 ++++++++++++++---------- 2 files changed, 60 insertions(+), 65 deletions(-) diff --git a/.github/workflows/dev_test_publish.yml b/.github/workflows/dev_test_publish.yml index 1a9abdb..17b4d38 100644 --- a/.github/workflows/dev_test_publish.yml +++ b/.github/workflows/dev_test_publish.yml @@ -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: | @@ -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: @@ -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/ diff --git a/.github/workflows/main_test_publish.yml b/.github/workflows/main_test_publish.yml index 684948b..16fd884 100644 --- a/.github/workflows/main_test_publish.yml +++ b/.github/workflows/main_test_publish.yml @@ -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
(this repo) - run: | - python -m pip install -e . >> $GITHUB_OUTPUT + # - name: Setup factiva-analytics
(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 \ No newline at end of file From fa825a0bd0d3a9644e7d800c4dacf984dbaa8af1 Mon Sep 17 00:00:00 2001 From: Miguel Ballesteros Date: Thu, 26 Mar 2026 04:03:18 +0100 Subject: [PATCH 3/3] Version bump 0.4.2 --- src/factiva/analytics/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/factiva/analytics/__version__.py b/src/factiva/analytics/__version__.py index f0ede3d..a987347 100644 --- a/src/factiva/analytics/__version__.py +++ b/src/factiva/analytics/__version__.py @@ -1 +1 @@ -__version__ = '0.4.1' +__version__ = '0.4.2'