Skip to content

Commit

Permalink
Python 3.12 support (#76)
Browse files Browse the repository at this point in the history
* Python 3.12 support

Signed-off-by: Prabhu Subramanian <[email protected]>

---------

Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu authored May 5, 2024
1 parent ab80745 commit 7ba1e4d
Show file tree
Hide file tree
Showing 14 changed files with 289 additions and 295 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
- name: Use Node.js
uses: actions/setup-node@v4
with:
Expand All @@ -58,13 +58,13 @@ jobs:
sbt stage createDistribution
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SCALAPY_PYTHON_LIBRARY: "python3.11"
SCALAPY_PYTHON_LIBRARY: "python3.12"
- name: Export python requirements
run: |
python3.11 -m pip install --upgrade pip
python3.11 -m pip install poetry
python3.11 -m poetry export -f requirements.txt --with=science --without-hashes --output target/chen-science-requirements.txt
python3.11 -m poetry export -f requirements.txt --with=database --without-hashes --output target/chen-database-requirements.txt
python3.12 -m pip install --upgrade pip
python3.12 -m pip install poetry
python3.12 -m poetry export -f requirements.txt --with=science --without-hashes --output target/chen-science-requirements.txt
python3.12 -m poetry export -f requirements.txt --with=database --without-hashes --output target/chen-database-requirements.txt
- name: Upload chen to ghcr
run: |
cd target
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
- name: Use Node.js
uses: actions/setup-node@v4
with:
Expand All @@ -50,11 +50,11 @@ jobs:
run: |
bash ./platform/frontends/php2atom/install.sh
npm install -g @appthreat/atom
python3.11 -m pip install --upgrade pip
python3.11 -m pip install poetry
python3.11 -m poetry config virtualenvs.create false
python3.11 -m poetry install --no-cache
python3.11 -m poetry run flake8 chenpy --count --select=E9,F63,F7,F82 --show-source --statistics
python3.12 -m pip install --upgrade pip
python3.12 -m pip install poetry
python3.12 -m poetry config virtualenvs.create false
python3.12 -m poetry install --no-cache
python3.12 -m poetry run flake8 chenpy --count --select=E9,F63,F7,F82 --show-source --statistics
- uses: actions/cache@v4
with:
path: |
Expand All @@ -65,7 +65,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JAVA_TOOL_OPTIONS: "-Dfile.encoding=UTF-8 -Djna.library.path=${{ env.Python3_ROOT_DIR }}"
SCALAPY_PYTHON_LIBRARY: "python3.11"
SCALAPY_PYTHON_LIBRARY: "python3.12"
if: runner.os != 'Windows'
- name: Compile and run tests
run: sbt scalafmtCheck +test
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: pr
on: pull_request
jobs:
test:
pr-tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
- name: Use Node.js
uses: actions/setup-node@v4
with:
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JAVA_TOOL_OPTIONS: "-Dfile.encoding=UTF-8 -Djna.library.path=${{ env.Python3_ROOT_DIR }}"
SCALAPY_PYTHON_LIBRARY: "python3.11"
SCALAPY_PYTHON_LIBRARY: "python3.12"
if: runner.os != 'Windows'
- name: Compile and run tests
run: |
Expand All @@ -78,5 +78,5 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JAVA_TOOL_OPTIONS: "-Dfile.encoding=UTF-8 -Djna.library.path=${{ env.Python3_ROOT_DIR }}"
SCALAPY_PYTHON_LIBRARY: "python311"
SCALAPY_PYTHON_LIBRARY: "python312"
if: runner.os == 'Windows'
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
- name: Use Node.js
uses: actions/setup-node@v4
with:
Expand All @@ -50,7 +50,7 @@ jobs:
sbt createDistribution publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SCALAPY_PYTHON_LIBRARY: "python3.11"
SCALAPY_PYTHON_LIBRARY: "python3.12"
- name: Install and test
run: |
npm install -g @appthreat/atom
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Once the download finishes, the command will display the download location along
[21:53:36] INFO To run chennai console, add the following environment variables to your .zshrc or .bashrc:
export JAVA_OPTS="-Xmx16G"
export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8 -Djna.library.path=<lib dir>"
export SCALAPY_PYTHON_LIBRARY=python3.11
export SCALAPY_PYTHON_LIBRARY=python3.12
export CHEN_HOME=/home/user/.local/share/chen
export PATH=$PATH:/home/user/.local/share/chen/platform:/home/user/.local/share/chen/platform/bin:
```
Expand Down Expand Up @@ -182,7 +182,7 @@ chennai> help
This error is mostly due to missing python .so (linux), .dll (windows) or .dylib (mac) file. Ensure the environment variables below are set correctly.
- SCALAPY_PYTHON_LIBRARY - Use values such as python3.10, python3.11 based on the version installed. On Windows, there are no dots. python311
- SCALAPY_PYTHON_LIBRARY - Use values such as python3.10, python3.11 based on the version installed. On Windows, there are no dots. python312
- JAVA_TOOL_OPTIONS - jna.library.path must be set to the python lib directory
- SCALAPY_PYTHON_PROGRAMNAME - Path to Python executable in case of virtual environments (Usually not required)
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name := "chen"
ThisBuild / organization := "io.appthreat"
ThisBuild / version := "2.0.11"
ThisBuild / version := "2.1.0"
ThisBuild / scalaVersion := "3.4.1"

val cpgVersion = "1.0.0"
Expand Down
4 changes: 2 additions & 2 deletions chenpy/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ def install_py_modules(pack="database"):
"About to install the science pack using conda. A new environment called 'chenpy-local' will be created."
)
with Progress(transient=True) as progress:
conda_install_script = """conda create --name chenpy-local python=3.11 -y
conda_install_script = """conda create --name chenpy-local python=3.12 -y
conda install -n chenpy-local conda-libmamba-solver -y
conda install -n chenpy-local -c conda-forge networkx --solver=libmamba -y
conda install -n chenpy-local -c pytorch pytorch torchtext cpuonly --solver=libmamba -y
pip install pyg_lib -f https://data.pyg.org/whl/torch-2.1.0+cpu.html
pip install pyg_lib -f https://data.pyg.org/whl/torch-2.3.0+cpu.html
conda install -n chenpy-local -c conda-forge scipy numpy packageurl-python nbconvert jupyter_core jupyter_client notebook --solver=libmamba -y
conda install -n chenpy-local -c conda-forge oras-py==0.1.26 httpx websockets orjson rich appdirs psutil gitpython --solver=libmamba -y"""
for line in conda_install_script.split("\n"):
Expand Down
4 changes: 2 additions & 2 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LABEL maintainer="appthreat" \
org.opencontainers.image.authors="Team AppThreat <[email protected]>" \
org.opencontainers.image.source="https://github.com/appthreat/chen" \
org.opencontainers.image.url="https://github.com/appthreat/chen" \
org.opencontainers.image.version="2.0.x" \
org.opencontainers.image.version="2.1.x" \
org.opencontainers.image.vendor="appthreat" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.title="chen" \
Expand All @@ -27,7 +27,7 @@ ENV JAVA_VERSION=$JAVA_VERSION \
PYTHONIOENCODING="utf-8" \
JAVA_OPTS="-XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent -XX:+ParallelRefProcEnabled -XX:+UseStringDeduplication -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:+UnlockDiagnosticVMOptions -XX:G1SummarizeRSetStatsPeriod=1" \
CHEN_DATAFLOW_TRACKED_WIDTH=128 \
SCALAPY_PYTHON_LIBRARY=python3.11 \
SCALAPY_PYTHON_LIBRARY=python3.12 \
ANDROID_HOME=/opt/android-sdk-linux \
CHEN_INSTALL_DIR=/opt/workspace \
PHP_PARSER_BIN=/opt/vendor/bin/php-parse \
Expand Down
2 changes: 1 addition & 1 deletion ci/conda-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ pip install -U pip setuptools poetry
conda install -c conda-forge networkx -y
conda install -c conda-forge scipy numpy -y
conda install -c pytorch pytorch torchtext cpuonly -y
pip install pyg_lib -f https://data.pyg.org/whl/torch-2.1.0+cpu.html
pip install pyg_lib -f https://data.pyg.org/whl/torch-2.3.0+cpu.html
conda install -c conda-forge packageurl-python nbconvert jupyter_core jupyter_client notebook -y
conda install -c conda-forge oras-py httpx websockets orjson rich appdirs psutil gitpython -y
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"downloadUrl": "https://github.com/AppThreat/chen",
"issueTracker": "https://github.com/AppThreat/chen/issues",
"name": "chen",
"version": "2.0.11",
"version": "2.1.0",
"description": "Code Hierarchy Exploration Net (chen) is an advanced exploration toolkit for your application source code and its dependency hierarchy.",
"applicationCategory": "code-analysis",
"keywords": [
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.9"
services:
chennai:
image: ghcr.io/appthreat/chen
Expand Down Expand Up @@ -29,7 +28,7 @@ services:
target: /opt/chenpy
- action: sync
path: ./chenpy
target: /opt/miniconda3/lib/python3.11/site-packages/chenpy
target: /opt/miniconda3/lib/python3.12/site-packages/chenpy
volumes:
- ./notebooks:/opt/notebooks
- /tmp:/tmp
Expand Down
2 changes: 1 addition & 1 deletion meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set version = "2.0.11" %}
{% set version = "2.1.0" %}

package:
name: chen
Expand Down
Loading

0 comments on commit 7ba1e4d

Please sign in to comment.